X Tutup
Skip to content

Commit eb70d94

Browse files
mrc0mmandbluca
authored andcommitted
test: correctly mask supporting services in tests, take adamlaska#2
Due to a little misunderstanding the last patch doesn't work as expected, since test_create_image() is called only for the first image (usually TEST-01-BASIC), and all subsequent images are then (possibly) modified with test_append_files(). Follow-up to 179ca4d.
1 parent 86e24d6 commit eb70d94

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

test/TEST-01-BASIC/test.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ 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-
2412
test_append_files() {
2513
# install tests manually so the test is functional even when -Dinstall-tests=false
2614
local dst="${1:?}/usr/lib/systemd/tests/testdata/units/"

test/test-functions

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,6 @@ test_create_image() {
24162416
(
24172417
LOG_LEVEL=5
24182418
setup_basic_environment
2419-
mask_supporting_services
24202419
)
24212420
}
24222421

@@ -2467,6 +2466,13 @@ test_setup() {
24672466
fi
24682467

24692468
mount_initdir
2469+
# We want to test all services in TEST-01-BASIC, but mask them in
2470+
# all other tests
2471+
if [[ "${TESTID:?}" != "01" ]]; then
2472+
dinfo "Masking supporting services"
2473+
mask_supporting_services
2474+
fi
2475+
24702476
if [ "$hook_defined" -eq 0 ]; then
24712477
test_append_files "${initdir:?}"
24722478
fi

0 commit comments

Comments
 (0)
X Tutup