From 94a850dbd12df925e79e4aed1b0e1cdc9161134c Mon Sep 17 00:00:00 2001 From: zab Date: Tue, 21 Oct 2003 18:18:51 +0000 Subject: [PATCH] - add the rprintf() that w_a_t.c has. - lots of general style cleanup - teach it to call 'od' to display the corrupt data on exit --- lustre/tests/write_disjoint.c | 147 +++++++++++++++++++++++++++--------------- 1 file changed, 94 insertions(+), 53 deletions(-) diff --git a/lustre/tests/write_disjoint.c b/lustre/tests/write_disjoint.c index 3ccb0e1..1969f3b 100644 --- a/lustre/tests/write_disjoint.c +++ b/lustre/tests/write_disjoint.c @@ -18,55 +18,75 @@ #include #include #include +#include #include #include +#include #include "mpi.h" #define FILENAME "/mnt/lustre/write_disjoint" #define CHUNK_MAX_SIZE 123456 +int rprintf(int rank, int loop, const char *fmt, ...) +{ + va_list ap; + + printf("rank %d, loop %d: ", rank, loop); + + va_start(ap, fmt); + + printf(fmt, ap); + + MPI_Finalize(); + exit(1); +} -int main( int argc,char *argv[] ) { +int main (int argc, char *argv[]) { int i, n, fd, chunk_size, file_size; - int rank, noProcessors, ret, done; + int rank, noProcessors, done; off_t offset; char **chunk_buf; char *read_buf; struct stat stat_buf; + ssize_t ret; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &noProcessors); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - chunk_buf = (char**)malloc(noProcessors * sizeof(void*)); - for( i=0; i %c: %d %d %d\n", + 'A' + j - 1, 'A' + j, + b & ~(4096-1), b, + (b + 4096) & ~(4096-1)); + } + + sprintf(command, "od -Ad -a %s", FILENAME); + system(command); + MPI_Finalize(); + exit(1); + } + } + } - MPI_Finalize(); - return 0; + printf("Finished after %d loops\n", n); + MPI_Finalize(); + return 0; } -- 1.8.3.1