Whamcloud - gitweb
b=23049 set path to truncate
authorElena Gryaznova <elena.gryaznova@oracle.com>
Mon, 8 Nov 2010 15:57:40 +0000 (18:57 +0300)
committerVitaly Fertman <vitaly.fertman@sun.com>
Mon, 8 Nov 2010 20:56:58 +0000 (23:56 +0300)
i=Brian.Murrell

lustre/tests/metadata-updates.sh
lustre/tests/replay-vbr.sh
lustre/tests/runtests
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh

index c93d0fe..2212a17 100755 (executable)
@@ -86,7 +86,7 @@ do_truncate () {
 
      do_nodes $NODES_TO_USE "set $TRACE;
 TESTFILE=$TESTDIR/\\\$(hostname)/$FILE;
 
      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
 
     FILE_SIZE=0
     return 0
index 29d47ee..4202032 100644 (file)
@@ -454,7 +454,7 @@ test_4j() { # former test_0q
 
     do_node $CLIENT1 mcreate $file
     pre=$(get_version $CLIENT1 $file)
 
     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"
     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
 
     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
     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 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
     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
index 34d24d4..2cc27e8 100755 (executable)
@@ -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"
        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.$$
 fi
 
 DST=$MOUNT/runtest.$$
index c3e586f..ae7e8e9 100755 (executable)
@@ -44,7 +44,6 @@ MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 READS=${READS:-"reads"}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 READS=${READS:-"reads"}
-TRUNCATE=${TRUNCATE:-truncate}
 MUNLINK=${MUNLINK:-munlink}
 SOCKETSERVER=${SOCKETSERVER:-socketserver}
 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
 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=$!
        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
         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
        $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
        $DIRECTIO write $f 0 2 && error "write succeeded, expect -ENOENT"
 
        do_facet ost1 lctl set_param fail_loc=0
index 255d138..7ecfa9d 100644 (file)
@@ -26,7 +26,6 @@ SETSTRIPE=${SETSTRIPE:-lstripe}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 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"}
 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
 
 test_5() {
        mcreate $DIR1/f5
-       truncate $DIR2/f5 100
+       $TRUNCATE $DIR2/f5 100
        $CHECKSTAT -t file -s 100 $DIR1/f5 || error
        rm $DIR1/f5
 }
        $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"
 
        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"
 
        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
 }
        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=$!
        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
                error "expected truncate error, got success"
         kill -USR1 $MULTIOP_PID || return 2
         wait $MULTIOP_PID || return 3
index e56b8a0..051effb 100644 (file)
@@ -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)}
     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
     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