summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-23 01:45:04 +0900
committerGitHub <noreply@github.com>2021-06-23 01:45:04 +0900
commitb905f3bbba2de0a96a7382492e87ff023598ee23 (patch)
tree673c9677fa65a6b487087ff689b4bbc06821b63a
parentde806cd6b61ab96848cf390703f336e11a861a5e (diff)
parent179ca4d2b1b5579014773a128462475f99b7a91b (diff)
downloadsystemd-b905f3bbba2de0a96a7382492e87ff023598ee23.tar.gz
Merge pull request #19990 from mrc0mmand/test-tweaks
A couple of stability-related test tweaks
-rwxr-xr-xtest/TEST-01-BASIC/test.sh12
-rw-r--r--test/test-functions8
-rwxr-xr-xtest/units/testsuite-38.sh17
3 files changed, 25 insertions, 12 deletions
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index d42c0df9a0..5a6156d770 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -9,6 +9,18 @@ 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/"
diff --git a/test/test-functions b/test/test-functions
index 7edb55251d..3b225cd677 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -2416,13 +2416,7 @@ test_create_image() {
(
LOG_LEVEL=5
setup_basic_environment
-
- # 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
+ mask_supporting_services
)
}
diff --git a/test/units/testsuite-38.sh b/test/units/testsuite-38.sh
index 818f69bc63..e58bae81fe 100755
--- a/test/units/testsuite-38.sh
+++ b/test/units/testsuite-38.sh
@@ -82,11 +82,18 @@ check_freezer_state() {
name="${1%.$suffix}"
object_path="/org/freedesktop/systemd1/unit/${name//-/_2d}_2e${suffix}"
- state=$(busctl get-property \
- org.freedesktop.systemd1 \
- "${object_path}" \
- org.freedesktop.systemd1.Unit \
- FreezerState | cut -d " " -f2 | tr -d '"')
+ for _ in {0..10}; do
+ state=$(busctl get-property \
+ org.freedesktop.systemd1 \
+ "${object_path}" \
+ org.freedesktop.systemd1.Unit \
+ FreezerState | cut -d " " -f2 | tr -d '"')
+
+ # Ignore the intermediate freezing & thawing states in case we check
+ # the unit state too quickly
+ [[ "$state" =~ ^(freezing|thawing)$ ]] || break
+ sleep .5
+ done
[ "$state" = "$2" ] || {
echo "error: unexpected freezer state, expected: $2, actual: $state" >&2