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>
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/SLEEP
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
local fid=$(copy_file /bin/sleep $f)
chmod 755 $f
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
wait $pid
[[ $? == 0 ]] || error "Execution failed during run"
cmp /bin/sleep $f
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
# cleanup
# remove no try action mode