Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mrc0mmand committed Nov 25, 2023
1 parent 6dc0397 commit 26087cf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 52 deletions.
15 changes: 14 additions & 1 deletion vagrant/boxes/archlinux_systemd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ whoami
stat /dev/tpm0
[[ "$(</sys/class/tpm/tpm0/tpm_version_major)" == 2 ]]

cat >/etc/pacman.conf <<EOF
[options]
Architecture = auto
[core-testing]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
EOF

# Clear Pacman's caches
pacman --noconfirm -Scc
rm -fv /var/lib/pacman/sync/*.db
Expand All @@ -16,7 +29,7 @@ pacman-key --init
pacman-key --populate archlinux
pacman --needed --noconfirm -Sy archlinux-keyring
# Upgrade the system
pacman --noconfirm -Syu
pacman --noconfirm -Syuu
# Install build dependencies
# Package groups: base, base-devel
pacman --needed --noconfirm -Sy base base-devel bpf btrfs-progs acl audit bash-completion clang compiler-rt docbook-xsl \
Expand Down
79 changes: 28 additions & 51 deletions vagrant/test_scripts/test-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ swapoff -av
pushd /build || { echo >&2 "Can't pushd to /build"; exit 1; }

# Run the internal unit tests (make check)
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
coredumpctl_set_ts
Expand Down Expand Up @@ -78,8 +76,6 @@ 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-exec-deserialization.py"
"test/test-network/systemd-networkd-tests.py"
)

# Prepare environment for the systemd-networkd testsuite
Expand All @@ -90,64 +86,45 @@ for t in "${TEST_LIST[@]}"; do
exectask_p "${t##*/}" "/bin/time -v -- timeout -k 60s 60m ./$t"
done


# Shared test env variables
#
# Set timeouts for QEMU and nspawn tests to kill them in case they get stuck
export QEMU_TIMEOUT=900
export NSPAWN_TIMEOUT=900
export QEMU_TIMEOUT=600
export NSPAWN_TIMEOUT=600
# Enforce nested KVM
export TEST_NESTED_KVM=1

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
fi
sed -i '/panic=1/d' test/test-functions

## Configure test environment
# Tell the test framework to copy the base image for each test, so we
# can run them in parallel
export TEST_PARALLELIZE=1
# 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=$OPTIMAL_QEMU_SMP
# Use a "unique" name for each nspawn container to prevent scope clash
export NSPAWN_ARGUMENTS="--machine=${t##*/}"

# Skipped test don't create the $TESTDIR automatically, so do it explicitly
# otherwise the `touch` command would fail
mkdir -p "$TESTDIR"
rm -f "$TESTDIR/pass"

exectask_p "${t##*/}" "/bin/time -v -- make -C $t setup run && touch $TESTDIR/pass"
EXECUTED_LIST+=("$t")
done
for ((i = 0; ; i++)); do
for t in test/TEST-71-HOSTNAME test/TEST-64-UDEV-STORAGE; do
if [[ ${#SKIP_LIST[@]} -ne 0 ]] && in_set "$t" "${SKIP_LIST[@]}"; then
echo -e "[SKIP] Skipping test $t\n"
continue
fi

# 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}")
## Configure test environment
# Tell the test framework to copy the base image for each test, so we
# can run them in parallel
# 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=$OPTIMAL_QEMU_SMP
# Use a "unique" name for each nspawn container to prevent scope clash
export NSPAWN_ARGUMENTS="--machine=${t##*/}"

# Skipped test don't create the $TESTDIR automatically, so do it explicitly
# otherwise the `touch` command would fail
mkdir -p "$TESTDIR"
rm -f "$TESTDIR/pass"

if ! exectask "${t##*/}" "/bin/time -v -- make -C $t clean setup run && touch $TESTDIR/pass"; then break 2; fi
done
done

# Save journals created by integration tests
# Wait for remaining running task# Save journals created by integration tests
for t in "${EXECUTED_LIST[@]}"; do
testdir="/var/tmp/systemd-test-${t##*/}"
if [[ -f "$testdir/system.journal" ]]; then
Expand Down

0 comments on commit 26087cf

Please sign in to comment.