From 326341889117faa5e7cbb05de66d759200405525 Mon Sep 17 00:00:00 2001 From: Elena Gryaznova Date: Mon, 8 Nov 2010 18:57:40 +0300 Subject: [PATCH 1/1] b=23049 set path to truncate i=Brian.Murrell --- lustre/tests/metadata-updates.sh | 2 +- lustre/tests/replay-vbr.sh | 6 +++--- lustre/tests/runtests | 2 +- lustre/tests/sanity.sh | 5 ++--- lustre/tests/sanityn.sh | 9 ++++----- lustre/tests/test-framework.sh | 3 +++ 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lustre/tests/metadata-updates.sh b/lustre/tests/metadata-updates.sh index c93d0fe..2212a17 100755 --- a/lustre/tests/metadata-updates.sh +++ b/lustre/tests/metadata-updates.sh @@ -86,7 +86,7 @@ do_truncate () { do_nodes $NODES_TO_USE "set $TRACE; TESTFILE=$TESTDIR/\\\$(hostname)/$FILE; -truncate \\\$TESTFILE 0" || return ${PIPESTATUS[0]} +$TRUNCATE \\\$TESTFILE 0" || return ${PIPESTATUS[0]} FILE_SIZE=0 return 0 diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index 29d47ee..4202032 100644 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -454,7 +454,7 @@ test_4j() { # former test_0q do_node $CLIENT1 mcreate $file pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 truncate $file 1 + do_node $CLIENT1 $TRUNCATE $file 1 post=$(get_version $CLIENT1 $file) if (($pre != $post)); then error "version changed unexpectedly: pre $pre, post $post" @@ -478,7 +478,7 @@ test_4k() { # former test_0r replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 666 $MOUNT2/$tfile - do_node $CLIENT1 truncate $file 1 + do_node $CLIENT1 $TRUNCATE $file 1 sleep 1 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file) do_node $CLIENT1 touch $file @@ -1010,7 +1010,7 @@ test_10b() { # former test_2b do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J - do_node $CLIENT2 truncate $DIR2/$tfile-b 1 # U + do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R zconf_umount $CLIENT2 $MOUNT2 diff --git a/lustre/tests/runtests b/lustre/tests/runtests index 34d24d4..2cc27e8 100755 --- a/lustre/tests/runtests +++ b/lustre/tests/runtests @@ -54,7 +54,7 @@ if [ $COUNT -gt 10 -o $COUNT -eq 0 ]; then rm $HOSTS || error "can't remove $HOSTS" 9 cp /etc/hosts $HOSTS.2 || error "can't cp /etc/hosts to $HOSTS.2" 7 log "truncating $HOSTS.2 to $TRUNCSIZE bytes" - truncate $HOSTS.2 $TRUNCSIZE + $TRUNCATE $HOSTS.2 $TRUNCSIZE fi DST=$MOUNT/runtest.$$ diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c3e586f..ae7e8e9 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -44,7 +44,6 @@ MCREATE=${MCREATE:-mcreate} OPENFILE=${OPENFILE:-openfile} OPENUNLINK=${OPENUNLINK:-openunlink} READS=${READS:-"reads"} -TRUNCATE=${TRUNCATE:-truncate} MUNLINK=${MUNLINK:-munlink} SOCKETSERVER=${SOCKETSERVER:-socketserver} SOCKETCLIENT=${SOCKETCLIENT:-socketclient} @@ -2664,7 +2663,7 @@ test_43b() { cp -p `which multiop` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop MULTIOP_PROG=$DIR/d43/multiop multiop_bg_pause $TMP/test43.junk O_c || return 1 MULTIOP_PID=$! - truncate $DIR/d43/multiop 0 && error "expected error, got success" + $TRUNCATE $DIR/d43/multiop 0 && error "expected error, got success" kill -USR1 $MULTIOP_PID || return 2 wait $MULTIOP_PID || return 3 rm $TMP/test43.junk @@ -3913,7 +3912,7 @@ test_69() { $DIRECTIO write ${f}.2 0 1 || error "directio write error" do_facet ost1 lctl set_param fail_loc=0x217 - truncate $f 1 # vmtruncate() will ignore truncate() error. + $TRUNCATE $f 1 # vmtruncate() will ignore truncate() error. $DIRECTIO write $f 0 2 && error "write succeeded, expect -ENOENT" do_facet ost1 lctl set_param fail_loc=0 diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 255d138..7ecfa9d 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -26,7 +26,6 @@ SETSTRIPE=${SETSTRIPE:-lstripe} MCREATE=${MCREATE:-mcreate} OPENFILE=${OPENFILE:-openfile} OPENUNLINK=${OPENUNLINK:-openunlink} -TRUNCATE=${TRUNCATE:-truncate} export TMP=${TMP:-/tmp} MOUNT_2=${MOUNT_2:-"yes"} CHECK_GRANT=${CHECK_GRANT:-"yes"} @@ -148,7 +147,7 @@ run_test 4 "fstat validation on multiple mount points ==========" test_5() { mcreate $DIR1/f5 - truncate $DIR2/f5 100 + $TRUNCATE $DIR2/f5 100 $CHECKSTAT -t file -s 100 $DIR1/f5 || error rm $DIR1/f5 } @@ -208,13 +207,13 @@ test_10b() { yes "R" | head -c 4000 >$TMP/f10b-seed dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1" - truncate $DIR1/f10b 4096 || error "truncate 4096" + $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096" dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2" # create a test file locally to compare dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random" - truncate $TMP/f10b 4096 || error "truncate 4096" + $TRUNCATE $TMP/f10b 4096 || error "truncate 4096" cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare" rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed } @@ -284,7 +283,7 @@ test_14b() { # bug 3192, 7040 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed" MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1 MULTIOP_PID=$! - truncate $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \ + $TRUNCATE $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \ error "expected truncate error, got success" kill -USR1 $MULTIOP_PID || return 2 wait $MULTIOP_PID || return 3 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index e56b8a0..051effb 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -146,6 +146,9 @@ init_test_env() { export LST=${LST:-"$LUSTRE/../lnet/utils/lst"} [ ! -f "$LST" ] && export LST=$(which lst) export SGPDDSURVEY=${SGPDDSURVEY:-$(which sgpdd-survey)} + # Ubuntu, at least, has a truncate command in /usr/bin + # so fully path our truncate command. + export TRUNCATE=${TRUNCATE:-$LUSTRE/tests/truncate} export MDSRATE=${MDSRATE:-"$LUSTRE/tests/mpi/mdsrate"} [ ! -f "$MDSRATE" ] && export MDSRATE=$(which mdsrate 2> /dev/null) if ! echo $PATH | grep -q $LUSTRE/tests/racer; then -- 1.8.3.1