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