diff options
author | Martin Pitt <martinpitt@users.noreply.github.com> | 2017-08-04 14:34:14 +0200 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2017-08-04 14:34:14 +0200 |
commit | 054ee249a28194626115a23257870f257bf69fda (patch) | |
tree | 309bf895976f355f02e89277d8c91b0d2028248f /test/TEST-01-BASIC/test.sh | |
parent | Merge pull request #6518 from joukewitteveen/process-rename (diff) | |
download | systemd-054ee249a28194626115a23257870f257bf69fda.tar.xz systemd-054ee249a28194626115a23257870f257bf69fda.zip |
test: Factorize common integration test functions (#6540)
All test/TEST* but TEST-02-CRYPTSETUP share the same check_result_qemu()
and test_cleanup(), so move them into test_functions and only override
them in TEST-02-CRYPTSETUP.
Also provide a common test_run() which by default assumes that both QEMU
and nspawn tests are run. Particular tests which don't support either
need to explicitly opt out by setting $TEST_NO_{QEMU,NSPAWN}. Do it this
way around to avoid accidentally forgetting to opt in, and to encourage
test authors to at least always support nspawn.
Diffstat (limited to 'test/TEST-01-BASIC/test.sh')
-rwxr-xr-x | test/TEST-01-BASIC/test.sh | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 041195dcd8..b1d6e1931b 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -5,34 +5,6 @@ TEST_DESCRIPTION="Basic systemd setup" . $TEST_BASE_DIR/test-functions -check_result_qemu() { - ret=1 - mkdir -p $TESTDIR/root - mount ${LOOPDEV}p1 $TESTDIR/root - [[ -e $TESTDIR/root/testok ]] && ret=0 - [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/root/failed $TESTDIR - cp -a $TESTDIR/root/var/log/journal $TESTDIR - umount $TESTDIR/root - [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed - ls -l $TESTDIR/journal/*/*.journal - test -s $TESTDIR/failed && ret=$(($ret+1)) - return $ret -} - -test_run() { - if run_qemu; then - check_result_qemu || return 1 - else - dwarn "can't run QEMU, skipping" - fi - if run_nspawn; then - check_result_nspawn || return 1 - else - dwarn "can't run systemd-nspawn, skipping" - fi - return 0 -} - test_setup() { create_empty_image mkdir -p $TESTDIR/root @@ -71,10 +43,4 @@ EOF umount $TESTDIR/root } -test_cleanup() { - umount $TESTDIR/root 2>/dev/null - [[ $LOOPDEV ]] && losetup -d $LOOPDEV - return 0 -} - do_test "$@" |