Skip to content

Commit 179ca4d

Browse files
committed
test: correctly mask supporting services in tests
It turns out the "supporting services" were run in _all_ tests if TEST-01-BASIC was run as the first test (which is usually the case), since with the original condition in test_create_image() we would skip the masking and then propagate the change to the default image used by other tests. This has been causing multiple bogus test timeouts (especially when the hwdb was being rebuilt in tests with short timeouts, like TEST-52-HONORFIRSTSHUTDOWN). Let's "fix" this by making the call to mask_supporting_services() uncoditional and override the test_create_image() function in TEST-01-BASIC to avoid the masking in this single case.
1 parent 907300c commit 179ca4d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

test/TEST-01-BASIC/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ TEST_REQUIRE_INSTALL_TESTS=0
99
# shellcheck source=test/test-functions
1010
. "${TEST_BASE_DIR:?}/test-functions"
1111

12+
# Explicitly override the default test_create_image() function to avoid the
13+
# call to mask_supporting_services(), since we want to run them in TEST-01-BASIC
14+
test_create_image() {
15+
create_empty_image_rootdir
16+
17+
# Create what will eventually be our root filesystem onto an overlay
18+
(
19+
LOG_LEVEL=5
20+
setup_basic_environment
21+
)
22+
}
23+
1224
test_append_files() {
1325
# install tests manually so the test is functional even when -Dinstall-tests=false
1426
local dst="${1:?}/usr/lib/systemd/tests/testdata/units/"

test/test-functions

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,13 +2355,7 @@ test_create_image() {
23552355
(
23562356
LOG_LEVEL=5
23572357
setup_basic_environment
2358-
2359-
# We want to test all services in TEST-01-BASIC, but mask them in
2360-
# all other tests
2361-
if [[ "$TESTID" != "01" ]]; then
2362-
dinfo "Masking supporting services"
2363-
mask_supporting_services
2364-
fi
2358+
mask_supporting_services
23652359
)
23662360
}
23672361

0 commit comments

Comments
 (0)