Skip to content

Commit

Permalink
also debug-only
Browse files Browse the repository at this point in the history
  • Loading branch information
mrc0mmand committed Apr 10, 2024
1 parent 44b20ba commit df2927c
Showing 1 changed file with 55 additions and 70 deletions.
125 changes: 55 additions & 70 deletions vagrant/test_scripts/test-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ SCRIPT_DIR="$(dirname "$0")"
# See respective bootstrap script under vagrant/bootstrap_scripts/ for reasoning
export BUILD_DIR="${BUILD_DIR:-/systemd-meson-build}"

at_exit() {
exectask "journalctl-testsuite" "journalctl -b -o short-monotonic --no-hostname --no-pager"
}

trap at_exit EXIT

# Following scripts are copied from the systemd-centos-ci/common directory
# by vagrant-build.sh
# shellcheck source=common/task-control.sh
Expand Down Expand Up @@ -49,17 +43,11 @@ fi

# Disable swap, since it seems to cause CPU soft lock-ups in some cases
swapoff -av
swapon --show

pushd /build || { echo >&2 "Can't pushd to /build"; exit 1; }

journalctl -o short-monotonic -b --grep "soft lockup" && exit 1

# Run the internal unit tests (make check)
for _ in {0..99}; do
exectask "ninja-test" "meson test -C $BUILD_DIR --print-errorlogs --timeout-multiplier=3"
journalctl -o short-monotonic -b --grep "soft lockup" && exit 1
done
exectask "ninja-test" "meson test -C $BUILD_DIR --print-errorlogs --timeout-multiplier=3"
[[ -d "$BUILD_DIR/meson-logs" ]] && rsync -amq --include '*.txt' --include '*/' --exclude '*' "$BUILD_DIR/meson-logs" "$LOGDIR"

# Ignore any coredumps generated by unit tests, as there's a lot of intentional crashes
Expand All @@ -80,10 +68,10 @@ fi
# Don't strip systemd binaries installed into test images, so we can get nice
# stack traces when something crashes
export STRIP_BINARIES=no

# Initialize the 'base' image (default.img) on which the other images are based
exectask "setup-the-base-image" "make -C test/TEST-01-BASIC clean setup TESTDIR=/var/tmp/systemd-test-TEST-01-BASIC"

journalctl -o short-monotonic -b --grep "soft lockup" && exit 1
# Parallelized tasks
EXECUTED_LIST=()
FLAKE_LIST=(
Expand All @@ -100,17 +88,16 @@ SKIP_LIST=(
# runtime without requiring too much resources, hence it can run in parallel
# with the "standard" integration tests, saving ~30 minutes ATTOW
TEST_LIST=(
"test/test-network/systemd-networkd-tests.py"
)

# Prepare environment for the systemd-networkd testsuite
systemctl disable --now dhcpcd dnsmasq
systemctl reload dbus.service

#for _ in {0..5}; do
# t="${TEST_LIST[0]}"
# exectask "${t##*/}" "/bin/time -v -- timeout -k 60s 60m ./$t" || break
# journalctl -o short-monotonic -b --grep "soft lockup" && break
#done
for t in "${TEST_LIST[@]}"; do
exectask_p "${t##*/}" "/bin/time -v -- timeout -k 60s 60m ./$t"
done

# Shared test env variables
#
Expand All @@ -120,8 +107,7 @@ export NSPAWN_TIMEOUT=900
# Enforce nested KVM
export TEST_NESTED_KVM=1

while :; do
t="test/TEST-01-BASIC"
for t in test/TEST-??-*; do
if [[ ${#SKIP_LIST[@]} -ne 0 ]] && in_set "$t" "${SKIP_LIST[@]}"; then
echo -e "[SKIP] Skipping test $t\n"
continue
Expand All @@ -144,63 +130,62 @@ while :; do
mkdir -p "$TESTDIR"
rm -f "$TESTDIR/pass"

exectask "${t##*/}" "/bin/time -v -- make -C $t clean setup run" || break
journalctl -o short-monotonic -b --no-hostname --grep "soft lockup" && break

exectask_p "${t##*/}" "/bin/time -v -- make -C $t setup run && touch $TESTDIR/pass"
EXECUTED_LIST+=("$t")
done

finish_and_exit
# Wait for remaining running tasks
exectask_p_finish

## Wait for remaining running tasks
#exectask_p_finish
#
#for t in "${FLAKE_LIST[@]}"; do
# ## Configure test environment
# # Set the test dir to something predictable so we can refer to it later
# export TESTDIR="/var/tmp/systemd-test-${t##*/}"
# # Set QEMU_SMP appropriately (regarding the parallelism)
# # OPTIMAL_QEMU_SMP is part of the common/task-control.sh file
# export QEMU_SMP=$(nproc)
#
# # Suffix the $TESTDIR of each retry with an index to tell them apart
# export MANGLE_TESTDIR=1
# exectask_retry "${t##*/}" "/bin/time -v -- make -C $t setup run && touch \$TESTDIR/pass"
#
# # Retried tasks are suffixed with an index, so update the $EXECUTED_LIST
# # array accordingly to correctly find the respective journals
# for ((i = 1; i <= TASK_RETRY_DEFAULT; i++)); do
# [[ -d "/var/tmp/systemd-test-${t##*/}_${i}" ]] && EXECUTED_LIST+=("${t}_${i}")
# done
#done
#
## Save journals created by integration tests
#for t in "${EXECUTED_LIST[@]}"; do
# testdir="/var/tmp/systemd-test-${t##*/}"
# if [[ -f "$testdir/system.journal" ]]; then
# # Filter out test-specific coredumps which are usually intentional
# # Note: $COREDUMPCTL_EXCLUDE_MAP resides in common/utils.sh
# if [[ -v "COREDUMPCTL_EXCLUDE_MAP[$t]" ]]; then
# export COREDUMPCTL_EXCLUDE_RX="${COREDUMPCTL_EXCLUDE_MAP[$t]}"
# fi
# # Attempt to collect coredumps from test-specific journals as well
# exectask "${t##*/}_coredumpctl_collect" "coredumpctl_collect '$testdir/'"
# # Make sure to not propagate the custom coredumpctl filter override
# [[ -v COREDUMPCTL_EXCLUDE_RX ]] && unset -v COREDUMPCTL_EXCLUDE_RX
#
# # Keep the journal files only if the associated test case failed
# if [[ ! -f "$testdir/pass" ]]; then
# rsync -aq "$testdir/system.journal" "$LOGDIR/${t##*/}/"
# fi
# fi
#
# # Clean the no longer necessary test artifacts
# [[ -d "$t" ]] && make -C "$t" clean-again > /dev/null
#done
for t in "${FLAKE_LIST[@]}"; do
## Configure test environment
# Set the test dir to something predictable so we can refer to it later
export TESTDIR="/var/tmp/systemd-test-${t##*/}"
# Set QEMU_SMP appropriately (regarding the parallelism)
# OPTIMAL_QEMU_SMP is part of the common/task-control.sh file
export QEMU_SMP=$(nproc)

# Suffix the $TESTDIR of each retry with an index to tell them apart
export MANGLE_TESTDIR=1
exectask_retry "${t##*/}" "/bin/time -v -- make -C $t setup run && touch \$TESTDIR/pass"

# Retried tasks are suffixed with an index, so update the $EXECUTED_LIST
# array accordingly to correctly find the respective journals
for ((i = 1; i <= TASK_RETRY_DEFAULT; i++)); do
[[ -d "/var/tmp/systemd-test-${t##*/}_${i}" ]] && EXECUTED_LIST+=("${t}_${i}")
done
done

# Save journals created by integration tests
for t in "${EXECUTED_LIST[@]}"; do
testdir="/var/tmp/systemd-test-${t##*/}"
if [[ -f "$testdir/system.journal" ]]; then
# Filter out test-specific coredumps which are usually intentional
# Note: $COREDUMPCTL_EXCLUDE_MAP resides in common/utils.sh
if [[ -v "COREDUMPCTL_EXCLUDE_MAP[$t]" ]]; then
export COREDUMPCTL_EXCLUDE_RX="${COREDUMPCTL_EXCLUDE_MAP[$t]}"
fi
# Attempt to collect coredumps from test-specific journals as well
exectask "${t##*/}_coredumpctl_collect" "coredumpctl_collect '$testdir/'"
# Make sure to not propagate the custom coredumpctl filter override
[[ -v COREDUMPCTL_EXCLUDE_RX ]] && unset -v COREDUMPCTL_EXCLUDE_RX

# Keep the journal files only if the associated test case failed
if [[ ! -f "$testdir/pass" ]]; then
rsync -aq "$testdir/system.journal" "$LOGDIR/${t##*/}/"
fi
fi

# Clean the no longer necessary test artifacts
[[ -d "$t" ]] && make -C "$t" clean-again > /dev/null
done

# Collect coredumps using the coredumpctl utility, if any
exectask "coredumpctl_collect" "coredumpctl_collect"

# Summary
show_task_summary

exectask "journalctl-testsuite" "journalctl -b -o short-monotonic --no-hostname --no-pager"

finish_and_exit

0 comments on commit df2927c

Please sign in to comment.