From a7eed3eca3d7bc022d870258deb2f738b9527c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 5 Dec 2022 13:52:28 +0100 Subject: [PATCH 1/2] TEST-65: check cat-config operation in chroot This verifies the fix in 2075b6dd394e09a0f203b9cc7e3253908397f933. --- test/test-functions | 1 + test/units/testsuite-65.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/test/test-functions b/test/test-functions index a87b7b966d..9aa9c37a9e 100644 --- a/test/test-functions +++ b/test/test-functions @@ -158,6 +158,7 @@ BASICTOOLS=( cat chmod chown + chroot cmp cryptsetup cut diff --git a/test/units/testsuite-65.sh b/test/units/testsuite-65.sh index 1f34308b44..ebe1f57b52 100755 --- a/test/units/testsuite-65.sh +++ b/test/units/testsuite-65.sh @@ -139,6 +139,16 @@ systemd-analyze cat-config systemd/system.conf systemd/journald.conf >/dev/null systemd-analyze cat-config systemd/system.conf foo/bar systemd/journald.conf >/dev/null systemd-analyze cat-config foo/bar +if [[ ! -v ASAN_OPTIONS ]]; then + # check that systemd-analyze cat-config paths work in a chroot + mkdir -p /tmp/root + mount --bind / /tmp/root + systemd-analyze cat-config systemd/system-preset >/tmp/out1 + chroot /tmp/root systemd-analyze cat-config systemd/system-preset >/tmp/out2 + diff /tmp/out{1,2} +fi + +# verify mkdir -p /tmp/img/usr/lib/systemd/system/ mkdir -p /tmp/img/opt/ From 1f9caf28cafbec89b93b8e6b641d387ac5acdd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 7 Dec 2022 09:52:35 +0100 Subject: [PATCH 2/2] TEST-65: use [[ -v ]] more It's a bashism, but we use other bash features anyway, and it's cleaner and much less verbose. --- test/units/testsuite-64.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh index 8e4653312b..c4406f381b 100755 --- a/test/units/testsuite-64.sh +++ b/test/units/testsuite-64.sh @@ -192,7 +192,7 @@ testcase_nvme_subsystem() { testcase_virtio_scsi_identically_named_partitions() { local num - if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then + if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then num=$((4 * 4)) else num=$((16 * 8)) @@ -306,7 +306,7 @@ testcase_simultaneous_events() { local -a devices symlinks local -A running - if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then + if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then num_part=2 iterations=10 timeout=240 @@ -401,7 +401,7 @@ testcase_lvm_basic() { /dev/disk/by-id/ata-foobar_deadbeeflvm{0..3} ) - if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then + if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then timeout=180 else timeout=30 @@ -454,7 +454,7 @@ testcase_lvm_basic() { helper_check_device_units # Same as above, but now with more "stress" - if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then + if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then iterations=10 else iterations=50 @@ -479,7 +479,7 @@ testcase_lvm_basic() { helper_check_device_units # Create & remove LVs in a loop, i.e. with more "stress" - if [[ -n "${ASAN_OPTIONS:-}" ]]; then + if [[ -v ASAN_OPTIONS ]]; then iterations=8 partitions=16 elif [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then