Whamcloud - gitweb
LU-6345 test: compare /bin/sleep in sanity-hsm.sh test_30c
[fs/lustre-release.git] / lustre / tests / sanity-hsm.sh
index 3624f30..9ca5bc7 100755 (executable)
@@ -1385,6 +1385,26 @@ test_12o() {
 }
 run_test 12o "Layout-swap failure during Restore leaves file released"
 
+test_12p() {
+       # test needs a running copytool
+       copytool_setup
+
+       mkdir $DIR/$tdir
+       local f=$DIR/$tdir/$tfile
+       local fid=$(copy_file /etc/hosts $f)
+
+       $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
+       wait_request_state $fid ARCHIVE SUCCEED
+       do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+       $LFS hsm_release $f || error "cannot release $f"
+       do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+       $LFS hsm_release $f || error "cannot release $f"
+       do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+
+       copytool_cleanup
+}
+run_test 12p "implicit restore of a file on copytool mount point"
+
 test_13() {
        # test needs a running copytool
        copytool_setup
@@ -2187,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
@@ -2203,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
@@ -2803,6 +2829,16 @@ test_60() {
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
                error "could not archive file"
 
+       local agent=$(facet_active_host $SINGLEAGT)
+       local prefix=$TESTLOG_PREFIX
+       [[ -z "$TESTNAME" ]] || prefix=$prefix.$TESTNAME
+       local copytool_log=$prefix.copytool_log.$agent.log
+
+
+       wait_update $agent \
+           "grep -o start.copy $copytool_log" "start copy" 100 ||
+               error "copytool failed to start"
+
        local cmd="$LCTL get_param -n ${mdt}.hsm.active_requests"
        cmd+=" | awk '/'$fid'.*action=ARCHIVE/ {print \\\$12}' | cut -f2 -d="
 
@@ -3969,6 +4005,10 @@ test_251() {
        set_hsm_param loop_period 2
        cdt_enable
 
+       # clear locks to avoid extra delay caused by flush/cancel
+       # and thus prevent early copytool death to timeout.
+       cancel_lru_locks osc
+
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
        wait_request_state $fid ARCHIVE STARTED
        sleep 5