* Added setup/cleanup records for subtests
Change-Id: Icb203a864fa8785e423a073b4ee0f02ea3d3ac77
Signed-off-by: Alex Deiter <adeiter@tintri.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49582
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
- do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
+ do_facet client "bash runmultiop_bg_pause $DIR/file O_c"
manual_umount_client
rc=$?
do_facet client killall -USR1 multiop
manual_umount_client
rc=$?
do_facet client killall -USR1 multiop
fi
echo "tests: $tests"
for test in $tests; do
fi
echo "tests: $tests"
for test in $tests; do
- local cmd="sh ./runtests -N $cnt_NRUN $test -f $testdir"
+ local cmd="bash ./runtests -N $cnt_NRUN $test -f $testdir"
# File is owned by root, make it accessible to RUNAS user
chmod a+rw $DIR/$tdir/$tfile.shell
stack_trap 'rm -f $DIR/$tdir/$tfile.shell' EXIT
# File is owned by root, make it accessible to RUNAS user
chmod a+rw $DIR/$tdir/$tfile.shell
stack_trap 'rm -f $DIR/$tdir/$tfile.shell' EXIT
- do_facet $SINGLEAGT nsenter -t $PID -U -m "sh $DIR/$tdir/$tfile.shell"
+ do_facet $SINGLEAGT nsenter -t $PID -U -m "bash $DIR/$tdir/$tfile.shell"
do_facet $SINGLEAGT nsenter -t $PID -U -m $LFS pcc attach -i $HSM_ARCHIVE_NUMBER \
$file || error "RW-PCC attach $file failed"
check_lpcc_state $file "readwrite"
do_facet $SINGLEAGT nsenter -t $PID -U -m $LFS pcc attach -i $HSM_ARCHIVE_NUMBER \
$file || error "RW-PCC attach $file failed"
check_lpcc_state $file "readwrite"
shift
if [[ "$host" == "$HOSTNAME" ]]; then
shift
if [[ "$host" == "$HOSTNAME" ]]; then
- sh -c "$(printf -- ' %q' "$@")"
+ bash -c "$(printf -- ' %q' "$@")"
-check_and_setup_lustre() {
+do_check_and_setup_lustre() {
+ echo "=== $TESTSUITE: start setup $(date +'%H:%M:%S (%s)') ==="
+
sanitize_parameters
nfs_client_mode && return
cifs_client_mode && return
sanitize_parameters
nfs_client_mode && return
cifs_client_mode && return
if [ -n "$fs_STRIPEPARAMS" ]; then
setstripe_getstripe $MOUNT $fs_STRIPEPARAMS
fi
if [ -n "$fs_STRIPEPARAMS" ]; then
setstripe_getstripe $MOUNT $fs_STRIPEPARAMS
fi
if $GSS_SK; then
set_flavor_all null
elif $GSS; then
if $GSS_SK; then
set_flavor_all null
elif $GSS; then
if $DELETE_OLD_POOLS; then
destroy_all_pools
fi
if $DELETE_OLD_POOLS; then
destroy_all_pools
fi
if [[ -n "$FS_POOL" ]]; then
create_pools $FS_POOL $FS_POOL_NOSTS
fi
if [[ -n "$FS_POOL" ]]; then
create_pools $FS_POOL $FS_POOL_NOSTS
fi
if [[ -n "$POOLS_QUOTA_USERS_SET" ]]; then
set_pools_quota
fi
if [[ -n "$POOLS_QUOTA_USERS_SET" ]]; then
set_pools_quota
fi
- if [ "$ONLY" == "setup" ]; then
+
+ echo "=== $TESTSUITE: finish setup $(date +'%H:%M:%S (%s)') ==="
+
+ if [[ "$ONLY" == "setup" ]]; then
+check_and_setup_lustre() {
+ local start_stamp=$(date +%s)
+ local saved_umask=$(umask)
+ local log=$TESTLOG_PREFIX.test_setup.test_log.$(hostname -s).log
+ local status='PASS'
+ local stop_stamp=0
+ local duration=0
+ local error=''
+ local rc=0
+
+ umask 0022
+
+ log_sub_test_begin test_setup
+
+ if ! do_check_and_setup_lustre 2>&1 > >(tee -i $log); then
+ error=$(tail -1 $log)
+ status='FAIL'
+ rc=1
+ fi
+
+ stop_stamp=$(date +%s)
+ duration=$((stop_stamp - start_stamp))
+
+ log_sub_test_end "$status" "$duration" "$rc" "$error"
+
+ umask $saved_umask
+
+ return $rc
+}
+
restore_mount () {
local clients=${CLIENTS:-$HOSTNAME}
local mntpt=$1
restore_mount () {
local clients=${CLIENTS:-$HOSTNAME}
local mntpt=$1
}
cleanup_and_setup_lustre() {
}
cleanup_and_setup_lustre() {
- if [ "$ONLY" == "cleanup" -o "`mount | grep $MOUNT`" ]; then
+ if [[ "$ONLY" == "cleanup" ]] || grep -q "$MOUNT" /proc/mounts; then
lctl set_param debug=0 || true
cleanupall
lctl set_param debug=0 || true
cleanupall
- if [ "$ONLY" == "cleanup" ]; then
+
+ if [[ "$ONLY" == "cleanup" ]]; then
+
+ do_check_and_setup_lustre
}
# Run e2fsck on MDT or OST device.
}
# Run e2fsck on MDT or OST device.
-check_and_cleanup_lustre() {
- if [ "$LFSCK_ALWAYS" = "yes" -a "$TESTSUITE" != "sanity-lfsck" -a \
- "$TESTSUITE" != "sanity-scrub" ]; then
+do_check_and_cleanup_lustre() {
+ echo "=== $TESTSUITE: start cleanup $(date +'%H:%M:%S (%s)') ==="
+
+ if [[ "$LFSCK_ALWAYS" == "yes" && "$TESTSUITE" != "sanity-lfsck" && \
+ "$TESTSUITE" != "sanity-scrub" ]]; then
run_lfsck
fi
if is_mounted $MOUNT; then
if $DO_CLEANUP; then
run_lfsck
fi
if is_mounted $MOUNT; then
if $DO_CLEANUP; then
- [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]* ||
+ [[ -n "$DIR" ]] && rm -rf $DIR/[Rdfs][0-9]* ||
error "remove sub-test dirs failed"
else
echo "skip cleanup"
fi
error "remove sub-test dirs failed"
else
echo "skip cleanup"
fi
- [ "$ENABLE_QUOTA" ] && restore_quota || true
+ [[ -n "$ENABLE_QUOTA" ]] && restore_quota || true
- if [ "$I_UMOUNTED2" = "yes" ]; then
+ if [[ "$I_UMOUNTED2" == "yes" ]]; then
restore_mount $MOUNT2 || error "restore $MOUNT2 failed"
fi
restore_mount $MOUNT2 || error "restore $MOUNT2 failed"
fi
- if [ "$I_MOUNTED2" = "yes" ]; then
+ if [[ "$I_MOUNTED2" == "yes" ]]; then
- if [[ "$I_MOUNTED" = "yes" ]] && ! $AUSTER_CLEANUP; then
+ if [[ "$I_MOUNTED" == "yes" ]] && ! $AUSTER_CLEANUP; then
cleanupall -f || error "cleanup failed"
unset I_MOUNTED
fi
cleanupall -f || error "cleanup failed"
unset I_MOUNTED
fi
+
+ echo "=== $TESTSUITE: finish cleanup $(date +'%H:%M:%S (%s)') ==="
+}
+
+check_and_cleanup_lustre() {
+ local start_stamp=$(date +%s)
+ local saved_umask=$(umask)
+ local log=$TESTLOG_PREFIX.test_cleanup.test_log.$(hostname -s).log
+ local status='PASS'
+ local stop_stamp=0
+ local duration=0
+ local error=''
+ local rc=0
+
+ umask 0022
+
+ log_sub_test_begin test_cleanup
+
+ if ! do_check_and_cleanup_lustre 2>&1 > >(tee -i $log); then
+ error=$(tail -1 $log)
+ status='FAIL'
+ rc=1
+ fi
+
+ stop_stamp=$(date +%s)
+ duration=$((stop_stamp - start_stamp))
+
+ log_sub_test_end "$status" "$duration" "$rc" "$error"
+
+ umask $saved_umask
+
+ return $rc