summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-27 13:49:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-28 10:39:41 +0200
commit933ab8199d51f25e7dafbaad54d73c80a4d15a1f (patch)
tree7553ab67b358589a42ff57e012f8cc24150ae4cf
parente128723dae62e3c73b29d74ca9f4548d8a5303be (diff)
downloadsystemd-933ab8199d51f25e7dafbaad54d73c80a4d15a1f.tar.gz
test-fs-util: do not assume /dev is always real
When building in Fedora's koji, test-fs-util would fail: --- command --- 10:18:29 SYSTEMD_LANGUAGE_FALLBACK_MAP='/builddir/build/BUILD/systemd-246-rc2/src/locale/language-fallback-map' PATH='/builddir/build/BUILD/systemd-246-rc2/x86_64-redhat-linux-gnu:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin' SYSTEMD_KBD_MODEL_MAP='/builddir/build/BUILD/systemd-246-rc2/src/locale/kbd-model-map' /builddir/build/BUILD/systemd-246-rc2/x86_64-redhat-linux-gnu/test-fs-util --- stderr --- /* test_chase_symlinks */ /* test_unlink_noerrno */ /* test_readlink_and_make_absolute */ /* test_var_tmp */ /* test_dot_or_dot_dot */ /* test_access_fd */ /* test_touch_file */ /* test_unlinkat_deallocate */ /* test_fsync_directory_of_file */ /* test_rename_noreplace */ /* test_path_is_encrypted */ /home encrypted: yes /var encrypted: yes / encrypted: yes /proc encrypted: no /sys encrypted: no /dev encrypted: yes Assertion 'expect < 0 || ((r > 0) == (expect > 0))' failed at src/test/test-fs-util.c:863, function test_path_is_encrypted_one(). Aborting. ------- It seems / is encrypted, but /dev is just a normal directory.
-rw-r--r--src/test/test-fs-util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
index 8d9a1974b2..dfea70ca27 100644
--- a/src/test/test-fs-util.c
+++ b/src/test/test-fs-util.c
@@ -864,14 +864,17 @@ static void test_path_is_encrypted_one(const char *p, int expect) {
}
static void test_path_is_encrypted(void) {
- log_info("/* %s */", __func__);
+ int booted = sd_booted(); /* If this is run in build environments such as koji, /dev might be a
+ * reguar fs. Don't assume too much if not running under systemd. */
+
+ log_info("/* %s (sd_booted=%d)*/", __func__, booted);
test_path_is_encrypted_one("/home", -1);
test_path_is_encrypted_one("/var", -1);
test_path_is_encrypted_one("/", -1);
test_path_is_encrypted_one("/proc", false);
test_path_is_encrypted_one("/sys", false);
- test_path_is_encrypted_one("/dev", false);
+ test_path_is_encrypted_one("/dev", booted > 0 ? false : -1);
}
int main(int argc, char *argv[]) {