From 98e16af267808e7715496f7e5c1397286a31b93f Mon Sep 17 00:00:00 2001 From: adilger Date: Sat, 8 Jun 2002 01:05:58 +0000 Subject: [PATCH] Exit out if there are setup errors. --- lustre/tests/common.sh | 15 +++++++++------ lustre/tests/directio.c | 24 ++++++++++++++---------- lustre/tests/llsetup.sh | 10 +++++----- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lustre/tests/common.sh b/lustre/tests/common.sh index 964c9f8..9c2a5a8 100644 --- a/lustre/tests/common.sh +++ b/lustre/tests/common.sh @@ -26,7 +26,7 @@ do_insmod() { BASE=`echo $MODULE | sed -e "s^.*/^^" -e "s/\.o$//"` [ "$MODULE" ] || fail "usage: $0 " - [ -f $MODULE ] || fail "$0: module '$MODULE' not found" + [ -f $MODULE ] || echo "$0: module '$MODULE' not found" 1>&2 lsmod | grep -q "\<$BASE\>" && return 0 insmod $MODULE } @@ -218,7 +218,7 @@ setup_lustre() { return 0 fi - $OBDCTL <<- EOF || return $rc + $OBDCTL <<- EOF || return $? newdev attach ptlrpc RPCDEV setup @@ -233,7 +233,7 @@ setup_ldlm() { [ -c /dev/portals ] || mknod /dev/portals c 10 240 - $OBDCTL <<- EOF || return $rc + $OBDCTL <<- EOF || return $? newdev attach ldlm LDLMDEV setup @@ -273,7 +273,7 @@ setup_mds() { $DO_FS ${MDSFS} ${MDSDEV} ${MDSSIZE} MDS=${LOOPDEV} - $OBDCTL <<- EOF || return $rc + $OBDCTL <<- EOF || return $? newdev attach mds MDSDEV setup ${MDS} ${MDSFS} @@ -326,10 +326,13 @@ setup_ost() { OBD=${LOOPDEV} fi - $OBDCTL <<- EOF || return $rc + $OBDCTL <<- EOF || return $? newdev attach ${OSTTYPE} OBDDEV setup ${OBD} ${OBDARG} + quit + EOF + $OBDCTL <<- EOF || return $? newdev attach ost OSTDEV setup \$OBDDEV @@ -349,7 +352,7 @@ setup_osc() { return 0 fi - $OBDCTL <<- EOF || return $rc + $OBDCTL <<- EOF || return $? newdev attach osc OSCDEV setup -1 diff --git a/lustre/tests/directio.c b/lustre/tests/directio.c index b531c50..e495517 100644 --- a/lustre/tests/directio.c +++ b/lustre/tests/directio.c @@ -7,16 +7,20 @@ #include // not correctly in the headers yet!! +#ifndef O_DIRECT #define O_DIRECT 040000 /* direct disk access hint */ +#endif + +#define BLOCKSIZE 4096 int main(int argc, char **argv) { int fd; char *buf; int pages; - int rc; + int rc; - if (argc != 3) { + if (argc != 3) { printf("Usage: %s file nr_pages\n", argv[0]); return 1; } @@ -24,32 +28,32 @@ int main(int argc, char **argv) pages = strtoul(argv[2], 0, 0); printf("directio on %s for %d pages \n", argv[1], pages); - buf = mmap(0, pages * 4096, PROT_READ|PROT_WRITE, + buf = mmap(0, pages * BLOCKSIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0); - if (!buf) { + if (!buf) { printf("No memory %s\n", strerror(errno)); return 1; } fd = open(argv[1], O_DIRECT | O_RDWR | O_CREAT); - if (fd == -1) { + if (fd == -1) { printf("Cannot open %s: %s\n", argv[1], strerror(errno)); return 1; } - rc = read(fd, buf, pages * 4096); - if (rc != pages * 4096) { + rc = read(fd, buf, pages * BLOCKSIZE); + if (rc != pages * BLOCKSIZE) { printf("Read error: %s, rc %d\n", strerror(errno), rc); return 1; } - if ( lseek(fd, 0, SEEK_SET) != 0 ) { + if ( lseek(fd, 0, SEEK_SET) != 0 ) { printf("Cannot seek %s\n", strerror(errno)); return 1; } - rc = write(fd, buf, pages * 4096); - if (rc != pages * 4096) { + rc = write(fd, buf, pages * BLOCKSIZE); + if (rc != pages * BLOCKSIZE) { printf("Write error %s\n", strerror(errno)); return 1; } diff --git a/lustre/tests/llsetup.sh b/lustre/tests/llsetup.sh index 2e9e9a4..0f7df5d 100644 --- a/lustre/tests/llsetup.sh +++ b/lustre/tests/llsetup.sh @@ -5,9 +5,9 @@ SRCDIR="`dirname $0`/" setup_opts "$@" -setup_portals -setup_lustre -setup_ldlm +setup_portals || exit $? +setup_lustre || exit $? +setup_ldlm || exit $? -setup_server new_fs -setup_client +setup_server new_fs || exit $? +setup_client || exit $? -- 1.8.3.1