mirror of
https://github.com/systemd/systemd
synced 2024-10-15 20:45:09 +00:00
Merge pull request #30484 from mrc0mmand/test-tweaks
A couple of test-related tweaks
This commit is contained in:
commit
1905d621db
|
@ -188,23 +188,22 @@ TEST_RET(bootspec_boot_config_find_entry) {
|
|||
assert_se(boot_config_load(&config, d, NULL) >= 0);
|
||||
assert_se(config.n_entries == 2);
|
||||
|
||||
// Test finding the first entry
|
||||
/* Test finding the first entry */
|
||||
BootEntry *entry = boot_config_find_entry(&config, "a-10.conf");
|
||||
assert_se(entry && streq(entry->id, "a-10.conf"));
|
||||
|
||||
// Test finding the second entry
|
||||
/* Test finding the second entry */
|
||||
entry = boot_config_find_entry(&config, "a-05.conf");
|
||||
assert_se(entry && streq(entry->id, "a-05.conf"));
|
||||
|
||||
// Test finding a non-existent entry
|
||||
/* Test finding a non-existent entry */
|
||||
entry = boot_config_find_entry(&config, "nonexistent.conf");
|
||||
assert_se(entry == NULL);
|
||||
|
||||
// Test case-insensitivity
|
||||
/* Test case-insensitivity */
|
||||
entry = boot_config_find_entry(&config, "A-10.CONF");
|
||||
assert_se(entry && streq(entry->id, "a-10.conf"));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1310,19 +1310,35 @@ install_compiled_systemd() {
|
|||
fi
|
||||
}
|
||||
|
||||
install_package_file() {
|
||||
local file="${1:?}"
|
||||
|
||||
# Skip missing files (like /etc/machine-info)
|
||||
[[ ! -e "$file" ]] && return 0
|
||||
# Skip python unit tests, since the image_install machinery will try to pull
|
||||
# in the whole python stack in a very questionable state, making the tests fail.
|
||||
# And given we're trying to transition to mkosi-based images anyway I'm not even
|
||||
# going to bother
|
||||
[[ "$file" =~ /tests/unit-tests/.*.py$ ]] && return 0
|
||||
# If the current file is a directory, create it with the original
|
||||
# mode; if it's a symlink to a directory, copy it as-is
|
||||
if [[ -d "$file" ]]; then
|
||||
inst_dir "$file"
|
||||
else
|
||||
inst "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
install_debian_systemd() {
|
||||
dinfo "Install debian systemd"
|
||||
|
||||
local files
|
||||
local deb file
|
||||
|
||||
while read -r deb; do
|
||||
files="$(dpkg-query -L "$deb" 2>/dev/null)" || continue
|
||||
ddebug "Install debian files from package $deb"
|
||||
for file in $files; do
|
||||
[ -e "$file" ] || continue
|
||||
[ ! -L "$file" ] && [ -d "$file" ] && continue
|
||||
inst "$file"
|
||||
done
|
||||
while read -r file; do
|
||||
install_package_file "$file"
|
||||
done < <(dpkg-query -L "$deb" 2>/dev/null)
|
||||
done < <(grep -E '^Package:' "${SOURCE_DIR}/debian/control" | cut -d ':' -f 2)
|
||||
}
|
||||
|
||||
|
@ -1337,17 +1353,7 @@ install_rpm() {
|
|||
|
||||
dinfo "Installing contents of RPM $rpm"
|
||||
while read -r file; do
|
||||
# Skip missing files (like /etc/machine-info)
|
||||
[[ ! -e "$file" ]] && continue
|
||||
# Skip directories unless they are a symlink (both -L and -d pass in this case)
|
||||
[[ -d "$file" && ! -L "$file" ]] && continue
|
||||
# Skip python unit tests, since the image_install machinery will try to pull
|
||||
# in the whole python stack in a very questionable state, making the tests fail.
|
||||
# And given we're trying to transition to mkosi-based images anyway I'm not even
|
||||
# going to bother
|
||||
[[ "$file" =~ /tests/unit-tests/.*.py$ ]] && continue
|
||||
|
||||
image_install "$file"
|
||||
install_package_file "$file"
|
||||
done < <(rpm -ql "$rpm")
|
||||
}
|
||||
|
||||
|
@ -3303,9 +3309,10 @@ test_create_image() {
|
|||
}
|
||||
|
||||
test_setup() {
|
||||
if get_bool "${TEST_REQUIRE_INSTALL_TESTS:?}" && \
|
||||
command -v meson >/dev/null && \
|
||||
[[ "$(meson configure "${BUILD_DIR:?}" | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
|
||||
if ! get_bool "$NO_BUILD" && \
|
||||
get_bool "${TEST_REQUIRE_INSTALL_TESTS:?}" && \
|
||||
command -v meson >/dev/null && \
|
||||
[[ "$(meson configure "${BUILD_DIR:?}" | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
|
||||
dfatal "$BUILD_DIR needs to be built with -Dinstall-tests=true"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -22,6 +22,9 @@ at_exit() {
|
|||
journalctl --flush
|
||||
fi
|
||||
|
||||
rm -f /run/systemd/journald.conf.d/99-forward-to-console.conf
|
||||
systemctl restart systemd-journald
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -49,7 +52,12 @@ vcs_dump_and_check() {
|
|||
# current boot, let's temporarily overmount /var/log/journal with a tmpfs,
|
||||
# as we're going to wipe it multiple times, but we need to keep the original
|
||||
# journal intact for the other tests to work correctly.
|
||||
#
|
||||
# Also, since we'll eventually lose the journal from this test, let's temporarily
|
||||
# forward everything to console, to make potential fails debug-able.
|
||||
trap at_exit EXIT
|
||||
mkdir -p /run/systemd/journald.conf.d/
|
||||
echo -ne '[Journal]\nForwardToConsole=yes' >/run/systemd/journald.conf.d/99-forward-to-console.conf
|
||||
mount -t tmpfs tmpfs /var/log/journal
|
||||
systemctl restart systemd-journald
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ run() {
|
|||
"$@" |& tee "$RUN_OUT"
|
||||
}
|
||||
|
||||
run_delv() {
|
||||
# Since [0] delv no longer loads /etc/(bind/)bind.keys by default, so we
|
||||
# have to do that explicitly for each invocation
|
||||
run delv -a /etc/bind.keys "$@"
|
||||
}
|
||||
|
||||
disable_ipv6() {
|
||||
sysctl -w net.ipv6.conf.all.disable_ipv6=1
|
||||
}
|
||||
|
@ -356,15 +362,15 @@ grep -qF "unsigned.test IN MX 15 mail.unsigned.test" "$RUN_OUT"
|
|||
# Check the trust chain (with and without systemd-resolved in between
|
||||
# Issue: https://github.com/systemd/systemd/issues/22002
|
||||
# PR: https://github.com/systemd/systemd/pull/23289
|
||||
run delv @ns1.unsigned.test signed.test
|
||||
run_delv @ns1.unsigned.test signed.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
run delv signed.test
|
||||
run_delv signed.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
|
||||
for addr in "${DNS_ADDRESSES[@]}"; do
|
||||
run delv "@$addr" -t A mail.signed.test
|
||||
run_delv "@$addr" -t A mail.signed.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
run delv "@$addr" -t AAAA mail.signed.test
|
||||
run_delv "@$addr" -t AAAA mail.signed.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
done
|
||||
run resolvectl query mail.signed.test
|
||||
|
@ -402,7 +408,7 @@ grep -qF "10.0.0.123" "$RUN_OUT"
|
|||
grep -qF "fd00:dead:beef:cafe::123" "$RUN_OUT"
|
||||
grep -qF "authenticated: yes" "$RUN_OUT"
|
||||
# Check OPENPGPKEY support
|
||||
run delv -t OPENPGPKEY 5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test
|
||||
run_delv -t OPENPGPKEY 5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
run resolvectl openpgp mr.smith@signed.test
|
||||
grep -qF "5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test" "$RUN_OUT"
|
||||
|
@ -418,11 +424,11 @@ check_domain() {
|
|||
local addr
|
||||
|
||||
for addr in "${DNS_ADDRESSES[@]}"; do
|
||||
run delv "@$addr" -t "$record" "$domain"
|
||||
run_delv "@$addr" -t "$record" "$domain"
|
||||
grep -qF "$message" "$RUN_OUT"
|
||||
done
|
||||
|
||||
run delv -t "$record" "$domain"
|
||||
run_delv -t "$record" "$domain"
|
||||
grep -qF "$message" "$RUN_OUT"
|
||||
|
||||
run resolvectl query "$domain"
|
||||
|
@ -458,9 +464,9 @@ grep -qE "^follow14\.final\.signed\.test\..+IN\s+NSEC\s+" "$RUN_OUT"
|
|||
# Check the trust chain (with and without systemd-resolved in between
|
||||
# Issue: https://github.com/systemd/systemd/issues/22002
|
||||
# PR: https://github.com/systemd/systemd/pull/23289
|
||||
run delv @ns1.unsigned.test sub.onlinesign.test
|
||||
run_delv @ns1.unsigned.test sub.onlinesign.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
run delv sub.onlinesign.test
|
||||
run_delv sub.onlinesign.test
|
||||
grep -qF "; fully validated" "$RUN_OUT"
|
||||
|
||||
run dig +short sub.onlinesign.test
|
||||
|
@ -474,11 +480,11 @@ run resolvectl query --legend=no -t TXT onlinesign.test
|
|||
grep -qF 'onlinesign.test IN TXT "hello from onlinesign"' "$RUN_OUT"
|
||||
|
||||
for addr in "${DNS_ADDRESSES[@]}"; do
|
||||
run delv "@$addr" -t A dual.onlinesign.test
|
||||
run_delv "@$addr" -t A dual.onlinesign.test
|
||||
grep -qF "10.0.0.135" "$RUN_OUT"
|
||||
run delv "@$addr" -t AAAA dual.onlinesign.test
|
||||
run_delv "@$addr" -t AAAA dual.onlinesign.test
|
||||
grep -qF "fd00:dead:beef:cafe::135" "$RUN_OUT"
|
||||
run delv "@$addr" -t ANY ipv6.onlinesign.test
|
||||
run_delv "@$addr" -t ANY ipv6.onlinesign.test
|
||||
grep -qF "fd00:dead:beef:cafe::136" "$RUN_OUT"
|
||||
done
|
||||
run resolvectl query dual.onlinesign.test
|
||||
|
|
Loading…
Reference in a new issue