diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-04-19 13:01:59 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-20 10:26:43 +0200 |
commit | 3f161ba9bc43e68e5ac3dd9ef18309e6e88bee89 (patch) | |
tree | 08f9ff10b2b06341ab6f4ea97bc83817d30a4154 /test/TEST-55-OOMD/test.sh | |
parent | mount-util: make umount_and_rmdir_and_freep() cleanup handler deal with NULL (diff) | |
download | systemd-3f161ba9bc43e68e5ac3dd9ef18309e6e88bee89.tar.xz systemd-3f161ba9bc43e68e5ac3dd9ef18309e6e88bee89.zip |
test: make the test entrypoint scripts shellcheck-compliant
Diffstat (limited to 'test/TEST-55-OOMD/test.sh')
-rwxr-xr-x | test/TEST-55-OOMD/test.sh | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh index 121aa8d56e..afc6706e32 100755 --- a/test/TEST-55-OOMD/test.sh +++ b/test/TEST-55-OOMD/test.sh @@ -1,47 +1,56 @@ #!/usr/bin/env bash set -e + TEST_DESCRIPTION="systemd-oomd Memory Pressure Test" -. $TEST_BASE_DIR/test-functions +# shellcheck source=test/test-functions +. "${TEST_BASE_DIR:?}/test-functions" check_result_nspawn() { + local workspace="${1:?}" local ret=1 local journald_report="" local pids="" - [[ -e $1/testok ]] && ret=0 - if [[ -e $1/skipped ]]; then + + [[ -e "$workspace/testok" ]] && ret=0 + if [[ -e "$workspace/skipped" ]]; then echo "TEST-56-OOMD was skipped:" - cat $1/skipped + cat "$workspace/skipped" ret=0 fi - [[ -f $1/failed ]] && cp -a $1/failed $TESTDIR - save_journal $1/var/log/journal - [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed - echo $JOURNAL_LIST - test -s $TESTDIR/failed && ret=$(($ret+1)) - [ -n "$TIMED_OUT" ] && ret=$(($ret+1)) - check_asan_reports "$1" || ret=$(($ret+1)) - _umount_dir $initdir + + [[ -f "$workspace/failed" ]] && cp -a "$workspace/failed" "${TESTDIR:?}" + save_journal "$workspace/var/log/journal" + [[ -f "$TESTDIR/failed" ]] && cat "$TESTDIR/failed" + echo "${JOURNAL_LIST:-No journals were saved}" + + test -s "$TESTDIR/failed" && ret=$((ret + 1)) + [ -n "${TIMED_OUT:=}" ] && ret=$((ret + 1)) + check_asan_reports "$workspace" || ret=$((ret + 1)) + _umount_dir "${initdir:?}" return $ret } check_result_qemu() { local ret=1 + mount_initdir - [[ -e $initdir/testok ]] && ret=0 - if [[ -e $initdir/skipped ]]; then + [[ -e "${initdir:?}/testok" ]] && ret=0 + if [[ -e "$initdir/skipped" ]]; then echo "TEST-56-OOMD was skipped:" - cat $initdir/skipped + cat "$initdir/skipped" ret=0 fi - [[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR - save_journal $initdir/var/log/journal - check_asan_reports "$initdir" || ret=$(($ret+1)) - _umount_dir $initdir - [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed - echo $JOURNAL_LIST - test -s $TESTDIR/failed && ret=$(($ret+1)) - [ -n "$TIMED_OUT" ] && ret=$(($ret+1)) + + [[ -f "$initdir/failed" ]] && cp -a "$initdir/failed" "${TESTDIR:?}" + save_journal "$initdir/var/log/journal" + check_asan_reports "$initdir" || ret=$((ret + 1)) + _umount_dir "$initdir" + [[ -f "$TESTDIR/failed" ]] && cat "$TESTDIR/failed" + echo "${JOURNAL_LIST:-No journals were saved}" + + test -s "$TESTDIR/failed" && ret=$((ret + 1)) + [ -n "${TIMED_OUT:=}" ] && ret=$((ret + 1)) return $ret } |