Whamcloud - gitweb
LU-13981 tests: use $TRUNCATE consistently and correctly. 05/40005/2
authorMr NeilBrown <neilb@suse.de>
Wed, 23 Sep 2020 05:11:53 +0000 (15:11 +1000)
committerOleg Drokin <green@whamcloud.com>
Mon, 12 Oct 2020 05:46:35 +0000 (05:46 +0000)
Two changes:
 1/ tests should should always use $TRUNCATE rather than just
    "truncate" to ensure the tests/truncate programs is used
    rather than anything in /bin /usr/bin.  This might not
    be needed in practice, but it is good to be consistent.

 2/ The arguments provided should match what tests/truncate
    expects - "filename size".  Using "-s size filename"
    as expected by /usr/bin/truncate is confusing and
    error prone.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ic0adc0148ea0ff625695dbfc4cf339d0eca70241
Reviewed-on: https://review.whamcloud.com/40005
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-dom.sh
lustre/tests/sanity.sh

index 9385c21..783d45c 100644 (file)
@@ -67,14 +67,14 @@ test_3() {
        # Write on one node to the DoM stripe and then truncate to over DoM size
        dd if=/dev/zero of=$DIR1/$tfile bs=$((DOM_SIZE-100)) count=1 ||
                return 1
-       truncate $DIR1/$tfile $((DOM_SIZE+700)) || return 2
+       $TRUNCATE $DIR1/$tfile $((DOM_SIZE+700)) || return 2
        # read on the second node inside DoM stripe to take a lock data from
        # the first client
        dd if=$DIR2/$tfile of=/dev/null bs=4096 count=1 seek=1 || return 3
        $CHECKSTAT -t file -s $((DOM_SIZE+700)) $DIR2/$tfile ||
                error "Wrong size after first truncate $tfile on first node"
        # now do local truncate over DoM size and check size is correct
-       truncate $DIR2/$tfile $((DOM_SIZE+500)) || return 4
+       $TRUNCATE $DIR2/$tfile $((DOM_SIZE+500)) || return 4
        $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR2/$tfile ||
                error "Wrong size after second truncate on the same node"
        $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR1/$tfile ||
index 079ac70..adcf85b 100755 (executable)
@@ -7028,7 +7028,7 @@ test_56xc() {
                error "cannot setstripe 20MB file"
        echo "done"
        echo -n "Sizing 20MB test file..."
-       truncate "$dir/20mb" 20971520 || error "cannot create 20MB test file"
+       $TRUNCATE "$dir/20mb" 20971520 || error "cannot create 20MB test file"
        echo "done"
        echo -n "Verifying small file autostripe count is 1..."
        $LFS_MIGRATE -y -A -C 1 "$dir/20mb" ||
@@ -7048,7 +7048,7 @@ test_56xc() {
        echo "done"
        echo -n "Sizing 1GB test file..."
        # File size is 1GB + 3KB
-       truncate "$dir/1gb" 1073744896 || error "cannot create 1GB test file"
+       $TRUNCATE "$dir/1gb" 1073744896 || error "cannot create 1GB test file"
        echo "done"
 
        # need at least 512MB per OST for 1GB file to fit in 2 stripes
@@ -22099,7 +22099,7 @@ test_fake_rw() {
        [ $blocks -gt 1000 ] && blocks=1000 # 1G in maximum
 
        if [ "$read_write" = "read" ]; then
-               truncate -s $(expr 1048576 \* $blocks) $DIR/$tfile
+               $TRUNCATE $DIR/$tfile $(expr 1048576 \* $blocks)
        fi
 
        local start_time=$(date +%s.%N)