[[ -z "$TESTNAME" ]] || prefix=$prefix.$TESTNAME
local copytool_log=$prefix.copytool${arc_id}_log.$agent.log
+ stack_trap cleanup EXIT
do_facet $facet "$cmd < /dev/null > $copytool_log 2>&1"
if [[ $? != 0 ]]; then
[[ $HSMTOOL_NOERROR == true ]] ||
error "start copytool $facet on $agent failed"
echo "start copytool $facet on $agent failed"
fi
-
- trap cleanup EXIT
}
get_copytool_event_log() {
run_test 24c "check that user,group,other request masks work"
cleanup_test_24d() {
- trap 0
mount -o remount,rw $MOUNT2
zconf_umount $(facet_host $SINGLEAGT) "$MOUNT3"
}
mount -o remount,ro $MOUNT2
do_nodes $(comma_list $(nodes_list)) $LCTL clear
- start_full_debug_logging
fid2=$(path2fid $file2)
[ "$fid1" == "$fid2" ] ||
$LFS hsm_archive $file1 || error "Fail to archive $file1"
wait_request_state $fid1 ARCHIVE SUCCEED
- stop_full_debug_logging
-
$LFS hsm_release $file1
$LFS hsm_restore $file2
wait_request_state $fid1 RESTORE SUCCEED
$LFS hsm_release $file2 &&
error "release should fail on read-only mount"
- copytool_cleanup
- cleanup_test_24d
+ return 0
}
run_test 24d "check that read-only mounts are respected"
# Test interface
##################################
+# usage: stack_trap arg sigspec
+#
+# stack_trap() behaves like bash's built-in trap, except that it "stacks" the
+# command ``arg`` on top of previously defined commands for ``sigspec`` instead
+# of overwriting them.
+# stacked traps are executed in reverse order of their registration
+#
+# arg and sigspec have the same meaning as in man (1) trap
+stack_trap()
+{
+ local arg="$1"
+ local sigspec="$2"
+
+ local cmd="$(trap -p $sigspec)"
+
+ cmd="${cmd#trap -- \'}"
+ cmd="${cmd%\'*}"
+ [ -n "$cmd" ] && cmd="; $cmd"
+ cmd="${arg}$cmd"
+
+ trap "$cmd" $sigspec
+}
+
error_noexit() {
report_error "$@"
}