From f8852de2147f61bc8b4f95c45fa5fc209318b709 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 22 Apr 2005 17:54:23 +0000 Subject: [PATCH] Branch: b1_4 Return a different error code than fail_abort so we know where this test failed. --- lustre/tests/replay-single.sh | 2 +- lustre/tests/writemany.c | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 15a2c99..b909fa5 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -672,7 +672,7 @@ test_33() { touch $DIR/$tfile fail_abort mds # this file should be gone, because the replay was aborted - $CHECKSTAT -t file $DIR/$tfile && return 1 + $CHECKSTAT -t file $DIR/$tfile && return 3 return 0 } run_test 33 "abort recovery before client does replay" diff --git a/lustre/tests/writemany.c b/lustre/tests/writemany.c index 5d4e42e..3473393 100644 --- a/lustre/tests/writemany.c +++ b/lustre/tests/writemany.c @@ -52,16 +52,16 @@ void kill_kids(void) int wait_for_threads(int live_threads) { int rc = 0; - + while (live_threads > 0) { int status; pid_t ret; - + ret = waitpid(0, &status, 0); if (ret == 0) { continue; } - + if (ret < 0) { fprintf(stderr, "%s: error: wait - %s\n", cmdname, strerror(errno)); @@ -100,7 +100,7 @@ int wait_for_threads(int live_threads) void print_err(char *op, char *filename, struct timeval *time, int err) { fprintf(stderr, "%s: %d.%.06d error: %s(%s): %s\n", - cmdname, (int)(time->tv_sec), (int)(time->tv_usec), op, + cmdname, (int)(time->tv_sec), (int)(time->tv_usec), op, filename, strerror(errno)); } @@ -113,11 +113,11 @@ int run_one_child(char *file, int thread, int seconds) int fd, rc = 0, rand, maxrand, len; long nfiles = 0, nbytes = 0; - if (!o_quiet) + if (!o_quiet) printf("%s: running thread #%d\n", cmdname, thread); - + srandom(thread); - /* Higher thread numbers will produce bigger random files. + /* Higher thread numbers will produce bigger random files. Thread 1 will produce only 0-len files. */ maxrand = 1; rand = thread; while (--rand) @@ -131,15 +131,15 @@ int run_one_child(char *file, int thread, int seconds) break; sprintf(filename, "%s-%d-%ld", file, thread, nfiles); - + fd = open(filename, O_RDWR | O_CREAT, 0666); if (fd < 0) { print_err("open", filename, &cur, errno); rc = errno; break; } - - sprintf(buf, "%s %010ld %.19s.%012d\n", cmdname, + + sprintf(buf, "%s %010ld %.19s.%012d\n", cmdname, nfiles++, ctime(&cur.tv_sec), (int)cur.tv_usec); len = strlen(buf); @@ -149,10 +149,10 @@ int run_one_child(char *file, int thread, int seconds) print_err("write", filename, &cur, errno); rc = errno; break; - } + } nbytes += len; - } - + } + if (close(fd) < 0) { print_err("close", filename, &cur, errno); rc = errno; @@ -164,10 +164,10 @@ int run_one_child(char *file, int thread, int seconds) break; } } - + diff = difftime(&cur, &start); - if (!o_quiet) - printf("%s: %7ld files, %4ld MB in %.2fs (%7.2f files/s, " + if (!o_quiet) + printf("%s: %7ld files, %4ld MB in %.2fs (%7.2f files/s, " "%5.2f MB/s): rc = %d\n", cmdname, nfiles, nbytes >> 20, diff, (double)nfiles / diff, (double)nbytes/1024/1024 / diff, @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) char *directory; int i = 1, rc = 0; - sprintf(cmdname, "%s", argv[0]); + sprintf(cmdname, "%s", argv[0]); while((i < argc) && (argv[i][0] == '-')) { switch (argv[i][1]) { @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) } } /* parent process */ - if (!o_quiet) + if (!o_quiet) printf("%s will run for %ld minutes\n", cmdname, duration/60); return (wait_for_threads(threads)); } -- 1.8.3.1