Whamcloud - gitweb
LU-6345 test: compare /bin/sleep in sanity-hsm.sh test_30c 25/14025/3
authorEmoly Liu <emoly.liu@intel.com>
Wed, 4 Mar 2015 22:07:21 +0000 (06:07 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 18 Mar 2015 11:24:02 +0000 (11:24 +0000)
In case /bin/sleep is modified during the test, we do a checksum
at the beginning and the end of the test respectively, and won't
mark the test a failure if the checksum has changed.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Change-Id: I1ff472ea6052e2df9ba9fd4c78a4cf53686e1ccd
Reviewed-on: http://review.whamcloud.com/14025
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh

index 76a88ef..9ca5bc7 100755 (executable)
@@ -2207,6 +2207,7 @@ test_30c() {
 
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/SLEEP
+       local slp_sum1=$(md5sum /bin/sleep)
        local fid=$(copy_file /bin/sleep $f)
        chmod 755 $f
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
@@ -2223,7 +2224,12 @@ test_30c() {
        wait $pid
        [[ $? == 0 ]] || error "Execution failed during run"
        cmp /bin/sleep $f
-       [[ $? == 0 ]] || error "Binary overwritten during exec"
+       if [[ $? != 0 ]]; then
+               local slp_sum2=$(md5sum /bin/sleep)
+               # in case sleep file is modified during the test
+               [[ $slp_sum1 == $slp_sum2 ]] &&
+                       error "Binary overwritten during exec"
+       fi
 
        # cleanup
        # remove no try action mode