]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/TEST-02-UNITTESTS/test.sh
test: switch TEST-02-CRYPTSETUP and TEST-24-UNITTESTS
[thirdparty/systemd.git] / test / TEST-02-UNITTESTS / test.sh
CommitLineData
ff12a795 1#!/usr/bin/env bash
3f6f58e0
YW
2set -e
3TEST_DESCRIPTION="Run unit tests under containers"
4RUN_IN_UNPRIVILEGED_CONTAINER=yes
5
f4c7bf9e
ZJS
6# embed some newlines in the kernel command line to stress our test suite
7KERNEL_APPEND="
8
9frobnicate!
10
11$KERNEL_APPEND
12"
13
3f6f58e0
YW
14. $TEST_BASE_DIR/test-functions
15
16check_result_nspawn() {
17 local _ret=1
ec43f686
ZJS
18 [[ -e $1/testok ]] && _ret=0
19 if [[ -s $1/failed ]]; then
3f6f58e0
YW
20 _ret=$(($_ret+1))
21 echo "=== Failed test log ==="
ec43f686 22 cat $1/failed
3f6f58e0 23 else
ec43f686 24 if [[ -s $1/skipped ]]; then
3f6f58e0 25 echo "=== Skipped test log =="
ec43f686 26 cat $1/skipped
3f6f58e0 27 fi
ec43f686 28 if [[ -s $1/testok ]]; then
3f6f58e0 29 echo "=== Passed tests ==="
ec43f686 30 cat $1/testok
3f6f58e0
YW
31 fi
32 fi
8943daf8 33 save_journal $1/var/log/journal
1506edca 34 _umount_dir $initdir
ec43f686 35 [[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
3f6f58e0
YW
36 return $_ret
37}
38
39check_result_qemu() {
40 local _ret=1
8c3534b5 41 mount_initdir
0036ce06
DS
42 [[ -e $initdir/testok ]] && _ret=0
43 if [[ -s $initdir/failed ]]; then
3f6f58e0
YW
44 _ret=$(($_ret+1))
45 echo "=== Failed test log ==="
0036ce06 46 cat $initdir/failed
3f6f58e0 47 else
0036ce06 48 if [[ -s $initdir/skipped ]]; then
3f6f58e0 49 echo "=== Skipped test log =="
0036ce06 50 cat $initdir/skipped
3f6f58e0 51 fi
0036ce06 52 if [[ -s $initdir/testok ]]; then
3f6f58e0 53 echo "=== Passed tests ==="
0036ce06 54 cat $initdir/testok
3f6f58e0
YW
55 fi
56 fi
8943daf8 57 save_journal $initdir/var/log/journal
1506edca 58 _umount_dir $initdir
3f6f58e0
YW
59 [[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
60 return $_ret
61}
62
9309a23b 63do_test "$@" 02