Debian Codegraph @

.cockpit-ci/run

raw
1 #!/bin/bash
2
3 # This is the expected entry point for Cockpit CI; will be called without
4 # arguments but with an appropriate $TEST_OS, and optionally $TEST_SCENARIO
5
6 # Currently supported scenarios:
7 # devel - runs tests with coverage enabled and generates a html file
8 # with coverage information and `NODE_ENV=development`
9 # to get additional React checks and useful stack traces.
10 # firefox - runs tests using the Firefox browser instead of Chrome
11 # networking - networking related tests
12 # storage - storage related tests
13 # expensive - expensive tests (usually tests which reboot/generate a new initramfs)
14 # other - non-networking/storage/expensive tests
15 # daily - runs tests with dnf-nightly and udisks-daily repositories enabled
16 # updates-testing - runs tests with updates-testing installed
17
18 set -eu
19
20 test/common/make-bots
21 if [ "$(cat test/reference-image)" = "$TEST_OS" ]; then
22 test/common/pixel-tests pull
23 fi
24
25 PREPARE_OPTS=""
26 RUN_OPTS=""
27 ALL_TESTS="$(test/common/run-tests --test-dir test/verify -l)"
28
29 RE_NETWORKING='Networking|Bonding|Connection|TestBridge|WireGuard|Firewall|Team|IPA|AD|Kerberos'
30 RE_STORAGE='Storage'
31 RE_EXPENSIVE='HostSwitching|MultiMachine|Updates|Superuser|Kdump|Pages'
32
33 # every known case needs to set RUN_OPTS to something non-empty, so that we can check if we hit any branch
34 case "${TEST_SCENARIO:=}" in
35 *devel*) RUN_OPTS="$RUN_OPTS --coverage"; export NODE_ENV=development ;;&
36 *firefox*) RUN_OPTS="$RUN_OPTS "; export TEST_BROWSER=firefox ;;&
37
38 *daily*)
39 bots/image-customize --fresh -v --script test/vm.daily "$TEST_OS"
40 RUN_OPTS="$RUN_OPTS "
41 PREPARE_OPTS="$PREPARE_OPTS --overlay"
42 ;;&
43 *updates-testing*)
44 bots/image-customize --fresh -v --script test/vm.updates-testing "$TEST_OS"
45 RUN_OPTS="$RUN_OPTS "
46 PREPARE_OPTS="$PREPARE_OPTS --overlay"
47 ;;&
48
49 # split tests into roughly equal scenarios for more parallelism
50 # one of them needs to run the unit tests and lintian (on Debian/Ubuntu), pick the fastest one (networking)
51 *networking*)
52 RUN_OPTS="$RUN_OPTS $(echo "$ALL_TESTS" | grep -E "$RE_NETWORKING")"
53 ;;&
54 *storage*)
55 RUN_OPTS="$RUN_OPTS $(echo "$ALL_TESTS" | grep -E "$RE_STORAGE")"
56 PREPARE_OPTS="$PREPARE_OPTS --quick"
57 ;;&
58 *expensive*)
59 RUN_OPTS="$RUN_OPTS $(echo "$ALL_TESTS" | grep -E "$RE_EXPENSIVE")"
60 PREPARE_OPTS="$PREPARE_OPTS --quick"
61 ;;&
62 *other*)
63 RUN_OPTS="$RUN_OPTS $(echo "$ALL_TESTS" | grep -Ev "$RE_NETWORKING|$RE_STORAGE|$RE_EXPENSIVE")"
64 PREPARE_OPTS="$PREPARE_OPTS --quick"
65 ;;&
66 *ws-container*)
67 PREPARE_OPTS="$PREPARE_OPTS --quick --container"
68 RUN_OPTS="$RUN_OPTS "
69 ;;&
70
71 esac
72
73 # these are too volatile/ungated, we can't keep up with reporting issues
74 if [ "${TEST_OS#fedora}" != "$TEST_OS" ] || [ "$TEST_OS" = "centos-10" ]; then
75 export TEST_AUDIT_NO_SELINUX=1
76 fi
77
78 if [ -n "$TEST_SCENARIO" ] && [ -z "$RUN_OPTS" ]; then
79 echo "Unknown test scenario: $TEST_SCENARIO"
80 exit 1
81 fi
82
83 test/image-prepare --verbose ${PREPARE_OPTS} "$TEST_OS"
84 test/common/run-tests --test-dir test/verify --track-naughties ${RUN_OPTS}