]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: correctly mask supporting services in tests, take #2
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 24 Jun 2021 10:13:52 +0000 (12:13 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 24 Jun 2021 15:26:19 +0000 (16:26 +0100)
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 179ca4d2b1b5579014773a128462475f99b7a91b.

test/TEST-01-BASIC/test.sh
test/test-functions

index 5a6156d77000712f84c8774312d13926e047d2d2..d42c0df9a02948f90171779d57d030d961b5772f 100755 (executable)
@@ -9,18 +9,6 @@ TEST_REQUIRE_INSTALL_TESTS=0
 # shellcheck source=test/test-functions
 . "${TEST_BASE_DIR:?}/test-functions"
 
-# Explicitly override the default test_create_image() function to avoid the
-# call to mask_supporting_services(), since we want to run them in TEST-01-BASIC
-test_create_image() {
-    create_empty_image_rootdir
-
-    # Create what will eventually be our root filesystem onto an overlay
-    (
-        LOG_LEVEL=5
-        setup_basic_environment
-    )
-}
-
 test_append_files() {
     # install tests manually so the test is functional even when -Dinstall-tests=false
     local dst="${1:?}/usr/lib/systemd/tests/testdata/units/"
index 3b225cd6778450f231ad5bdbe226bc943c30bb2f..3451e16d9ade4fa32d2ff9ec0d7cac8b9d6efd0d 100644 (file)
@@ -2416,7 +2416,6 @@ test_create_image() {
     (
         LOG_LEVEL=5
         setup_basic_environment
-        mask_supporting_services
     )
 }
 
@@ -2467,6 +2466,13 @@ test_setup() {
         fi
 
         mount_initdir
+        # We want to test all services in TEST-01-BASIC, but mask them in
+        # all other tests
+        if [[ "${TESTID:?}" != "01" ]]; then
+            dinfo "Masking supporting services"
+            mask_supporting_services
+        fi
+
         if [ "$hook_defined" -eq 0 ]; then
             test_append_files "${initdir:?}"
         fi