Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit 0bc0cab

Browse files
committed
Merge branch 'tkrizek/system-tests-pytest-prep' into 'main'
Various tweaks of system test framework See merge request isc-projects/bind9!7347
2 parents 6f0c821 + 03d7b45 commit 0bc0cab

File tree

7 files changed

+91
-51
lines changed

7 files changed

+91
-51
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ variables:
88
CCACHE_DIR: "/ccache"
99

1010
GIT_DEPTH: 1
11+
12+
# The following values may be overwritten in GitLab's CI/CD Variables Settings.
1113
BUILD_PARALLEL_JOBS: 6
12-
TEST_PARALLEL_JOBS: 6
14+
TEST_PARALLEL_JOBS: 4
1315

1416
CONFIGURE: ./configure
1517
CLANG_VERSION: 15

bin/tests/system/dupsigs/tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ end=$((start + 140))
3838

3939
while [ $now -lt $end ]; do
4040
et=$((now - start))
41-
echo "=============== $et ============"
41+
echo "............... $et ............"
4242
$JOURNALPRINT ns1/signing.test.db.signed.jnl | $PERL check_journal.pl
4343
$DIG axfr signing.test -p ${PORT} @10.53.0.1 > dig.out.at$et
4444
awk '$4 == "RRSIG" { print $11 }' dig.out.at$et | sort | uniq -c

bin/tests/system/get_algorithms.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ def is_supported(alg: Algorithm) -> bool:
111111
f"{TESTCRYPTO} -q {alg.name}",
112112
shell=True,
113113
check=True,
114-
env={"KEYGEN": KEYGEN},
114+
env={
115+
"KEYGEN": KEYGEN,
116+
"TMPDIR": os.getenv("TMPDIR", "/tmp"),
117+
},
115118
stdout=subprocess.DEVNULL,
116119
)
117120
except subprocess.CalledProcessError as exc:

bin/tests/system/get_core_dumps.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/sh
2+
3+
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4+
#
5+
# SPDX-License-Identifier: MPL-2.0
6+
#
7+
# This Source Code Form is subject to the terms of the Mozilla Public
8+
# License, v. 2.0. If a copy of the MPL was not distributed with this
9+
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
10+
#
11+
# See the COPYRIGHT file distributed with this work for additional
12+
# information regarding copyright ownership.
13+
14+
dir=$(dirname "$0")
15+
. "$dir/conf.sh"
16+
17+
systest=$1
18+
status=0
19+
20+
export SYSTESTDIR="${TOP_SRCDIR}/bin/tests/system/${systest}"
21+
22+
get_core_dumps() {
23+
find "$SYSTESTDIR/" \( -name 'core' -or -name 'core.*' -or -name '*.core' \) ! -name '*.gz' ! -name '*.txt' | sort
24+
}
25+
26+
core_dumps=$(get_core_dumps | tr '\n' ' ')
27+
assertion_failures=$(find "$SYSTESTDIR/" -name named.run -exec grep "assertion failure" {} + | wc -l)
28+
sanitizer_summaries=$(find "$SYSTESTDIR/" -name 'tsan.*' | wc -l)
29+
if [ -n "$core_dumps" ]; then
30+
status=1
31+
echoinfo "I:$systest:Core dump(s) found: $core_dumps"
32+
get_core_dumps | while read -r coredump; do
33+
echoinfo "D:$systest:backtrace from $coredump:"
34+
echoinfo "D:$systest:--------------------------------------------------------------------------------"
35+
binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s|Core was generated by \`\([^' ]*\)[' ].*|\1|p")
36+
if [ ! -f "${binary}" ]; then
37+
binary=$(find "${TOP_BUILDDIR}" -path "*/.libs/${binary}" -type f)
38+
fi
39+
"${TOP_BUILDDIR}/libtool" --mode=execute gdb \
40+
-batch \
41+
-ex bt \
42+
-core="$coredump" \
43+
-- \
44+
"$binary" 2>/dev/null | sed -n '/^Core was generated by/,$p' | cat_d
45+
echoinfo "D:$systest:--------------------------------------------------------------------------------"
46+
coredump_backtrace="${coredump}-backtrace.txt"
47+
echoinfo "D:$systest:full backtrace from $coredump saved in $coredump_backtrace"
48+
"${TOP_BUILDDIR}/libtool" --mode=execute gdb \
49+
-batch \
50+
-command=run.gdb \
51+
-core="$coredump" \
52+
-- \
53+
"$binary" > "$coredump_backtrace" 2>&1
54+
echoinfo "D:$systest:core dump $coredump archived as $coredump.gz"
55+
gzip -1 "${coredump}"
56+
done
57+
elif [ "$assertion_failures" -ne 0 ]; then
58+
status=1
59+
echoinfo "I:$systest:$assertion_failures assertion failure(s) found"
60+
find "$SYSTESTDIR/" -name 'tsan.*' -exec grep "SUMMARY: " {} + | sort -u | cat_d
61+
elif [ "$sanitizer_summaries" -ne 0 ]; then
62+
status=1
63+
echoinfo "I:$systest:$sanitizer_summaries sanitizer report(s) found"
64+
fi
65+
66+
exit $status

bin/tests/system/run.sh.in

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ if [ "${srcdir}" != "${builddir}" ]; then
113113
cp -a "${srcdir}/common" "${builddir}"
114114
fi
115115
# Some tests require additional files to work for out-of-tree test runs.
116-
for file in ckdnsrps.sh conftest.py digcomp.pl ditch.pl fromhex.pl kasp.sh packet.pl pytest_custom_markers.py start.pl stop.pl testcrypto.sh; do
116+
for file in ckdnsrps.sh conftest.py digcomp.pl ditch.pl fromhex.pl get_core_dumps.sh kasp.sh packet.pl pytest_custom_markers.py start.pl stop.pl testcrypto.sh; do
117117
if [ ! -r "${file}" ]; then
118118
cp -a "${srcdir}/${file}" "${builddir}"
119119
fi
@@ -265,51 +265,7 @@ else
265265
exit $status
266266
fi
267267

268-
get_core_dumps() {
269-
find "$systest/" \( -name 'core' -or -name 'core.*' -or -name '*.core' \) ! -name '*.gz' ! -name '*.txt' | sort
270-
}
271-
272-
core_dumps=$(get_core_dumps | tr '\n' ' ')
273-
assertion_failures=$(find "$systest/" -name named.run -exec grep "assertion failure" {} + | wc -l)
274-
sanitizer_summaries=$(find "$systest/" -name 'tsan.*' | wc -l)
275-
if [ -n "$core_dumps" ]; then
276-
status=1
277-
echoinfo "I:$systest:Core dump(s) found: $core_dumps"
278-
get_core_dumps | while read -r coredump; do
279-
export SYSTESTDIR="$systest"
280-
echoinfo "D:$systest:backtrace from $coredump:"
281-
echoinfo "D:$systest:--------------------------------------------------------------------------------"
282-
binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s|Core was generated by \`\([^' ]*\)[' ].*|\1|p")
283-
if [ ! -f "${binary}" ]; then
284-
binary=$(find "${top_builddir}" -path "*/.libs/${binary}" -type f)
285-
fi
286-
"${top_builddir}/libtool" --mode=execute gdb \
287-
-batch \
288-
-ex bt \
289-
-core="$coredump" \
290-
-- \
291-
"$binary" 2>/dev/null | sed -n '/^Core was generated by/,$p' | cat_d
292-
echoinfo "D:$systest:--------------------------------------------------------------------------------"
293-
coredump_backtrace="${coredump}-backtrace.txt"
294-
echoinfo "D:$systest:full backtrace from $coredump saved in $coredump_backtrace"
295-
"${top_builddir}/libtool" --mode=execute gdb \
296-
-batch \
297-
-command=run.gdb \
298-
-core="$coredump" \
299-
-- \
300-
"$binary" > "$coredump_backtrace" 2>&1
301-
echoinfo "D:$systest:core dump $coredump archived as $coredump.gz"
302-
gzip -1 "${coredump}"
303-
done
304-
elif [ "$assertion_failures" -ne 0 ]; then
305-
status=1
306-
SYSTESTDIR="$systest"
307-
echoinfo "I:$systest:$assertion_failures assertion failure(s) found"
308-
find "$systest/" -name 'tsan.*' -exec grep "SUMMARY: " {} + | sort -u | cat_d
309-
elif [ "$sanitizer_summaries" -ne 0 ]; then
310-
status=1
311-
echoinfo "I:$systest:$sanitizer_summaries sanitizer report(s) found"
312-
fi
268+
$SHELL get_core_dumps.sh "$systest" || status=1
313269

314270
print_outstanding_files() {
315271
if test -d ${srcdir}/../../../.git; then

bin/tests/system/testcrypto.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
prog=$0
1515
args=""
1616
quiet=0
17+
dir=""
1718
msg="cryptography"
1819

1920
if test -z "$KEYGEN"; then
@@ -74,9 +75,18 @@ if test -z "$alg"; then
7475
exit 1
7576
fi
7677

78+
if test -n "$TMPDIR"; then
79+
dir=$(mktemp -d "$TMPDIR/XXXXXX")
80+
args="$args -K $dir"
81+
fi
82+
7783
if $KEYGEN $args $alg foo > /dev/null 2>&1
7884
then
79-
rm -f Kfoo*
85+
if test -z "$dir"; then
86+
rm -f Kfoo*
87+
else
88+
rm -rf "$dir"
89+
fi
8090
else
8191
if test $quiet -eq 0; then
8292
echo_i "This test requires support for $msg" >&2

bin/tests/system/testsock.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
require 5.001;
1717

18+
use Cwd 'abs_path';
19+
use File::Basename;
1820
use Socket;
1921
use Getopt::Long;
2022

@@ -27,7 +29,8 @@
2729
if ($id != 0) {
2830
@ids = ($id);
2931
} else {
30-
my $fn = "ifconfig.sh";
32+
my $dir = dirname(abs_path($0));
33+
my $fn = "$dir/ifconfig.sh.in";
3134
open FH, "< $fn" or die "open < $fn: $!\n";
3235
while (<FH>) {
3336
@ids = (1..$1)

0 commit comments

Comments
 (0)