2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00
Commit Graph

39894 Commits

Author SHA1 Message Date
Tom Krizek
652f2725a0 Merge branch '4312-pytest-symlink-name-collision' into 'main'
Rename convenience symlink to pytest artifacts

Closes #4312

See merge request isc-projects/bind9!8306
2023-09-19 15:59:03 +00:00
Tom Krizek
fd13dfb097 Rename convenience symlink to pytest artifacts
The previous symlink name convention was prone to name collisions If a
system test contained both a shell test and a pytest module of the same
name (e.g. dnstap test has both tests.sh and tests_dnstap.py), then
these would have the same convenience symlink, which could cause test
setup issues as well as confusion when examining test artifacts.

Update the naming convention to include the full pytest module name.
This results in a slightly more verbose names for shell tests (e.g.
dnstap_sh_dnstap instead of the previous dnstap_dnstap), but it removes
the chance of a collision.
2023-09-19 17:20:32 +02:00
Tom Krizek
f441e68bb3 Merge branch '4250-remove-legacy-runner-support-for-python-tests' into 'main'
remove support for running python system tests with legacy test runner

Closes #4250

See merge request isc-projects/bind9!8202
2023-09-19 15:09:08 +00:00
Tom Krizek
d050843a30 Update system test runner doc with pytest glue files
Document that pytest requires a glue file for each shell tests in order
to detect it.
2023-09-19 15:45:53 +02:00
Tom Krizek
363677bde7 Add CHANGES note for [GL #4250] 2023-09-19 15:45:49 +02:00
Tom Krizek
8deb026748 Use integers for ports fixtures in pytest
Reorganize individual port fixtures and re-use the ports fixture to
obtain their number. Store it as integer and only cast it to string when
setting it as environment variable.
2023-09-19 15:43:33 +02:00
Tom Krizek
197dac55a2 Reformat conftest.py with black 2023-09-19 15:43:33 +02:00
Tom Krizek
d16e5fd5e5 Remove legacy runner support from conftest.py
Remove code fork for legacy runner, reorganize imports and move a
pylint-silencing snippet to the top of the file. The rest of the code
was just unindented.
2023-09-19 15:43:33 +02:00
Tom Krizek
4af9bafb4e Remove pytest invocation from legacy runner
In order to python system tests, pytest (runner) has to be used
directly. This makes it possible to simplify the pytest runner and make
its behavior simpler and easier to extend.

The legacy runner can still be used to run shell system tests.
2023-09-19 15:43:31 +02:00
Tom Krizek
94856ade3c Merge branch '4262-make-check-pytest' into 'main'
Use pytest runner for make check

Closes #4262

See merge request isc-projects/bind9!8286
2023-09-19 13:41:16 +00:00
Tom Krizek
0a9ee342e9 Remove make check invocation from legacy.run.sh
The legacy runner no longer uses make check. Ensure the legacy runner
script doesn't interact with that automake target in any way. The legacy
runner script remains available to execute the legacy runner, but there
is no out-of-the box support for running tests in parallel. Other tools
such as xargs can be utilized for that.
2023-09-19 14:47:49 +02:00
Tom Krizek
f1c631f448 ci: switch OpenBSD job to use make check
Invoking pytest directly provides a better formatted output and more
flexibility. However, it's prudent to verify that `make check` keeps
working as expected. Use it in the OpenBSD job which isn't executed as
frequently and its output is of least concern.
2023-09-19 14:47:49 +02:00
Tom Krizek
295890a16b Modify custom-test-driver to interpret JUnit results
Pytest provides JUnit output and uses different exit codes from
Automake. Use the conversion script to interpret the JUnit test results
from python rather than relying on the status code.
2023-09-19 14:47:49 +02:00
Tom Krizek
b96c8e8062 Convert JUnit XML from pytest into Automake .trs files
It's important to parse the JUnit result file rather than relying on the
exit code from pytest, which has a different meaning. Include a .trs test
result for each test case and set an exit code which is most appropriate
as the aggregate result (e.g. it will be set to 77 (SKIP) if there's at
least one test case that was skipped).
2023-09-19 14:47:49 +02:00
Tom Krizek
15fa8f1506 Prioritize long-running system tests for legacy runner
Synchronize the test priority with the pytest runner (which handles the
prioritization in conftest.py).
2023-09-19 14:47:48 +02:00
Tom Krizek
0538b7e0da Use prereq.sh for rpzrecurse system test 2023-09-19 14:47:48 +02:00
Tom Krizek
c3abedc0a2 Use prereq.sh for serve-stale system test 2023-09-19 14:47:48 +02:00
Tom Krizek
5d9a09c086 Use prereq.sh for chain system test 2023-09-19 14:47:48 +02:00
Tom Krizek
00b92bd064 Use prereq.sh for digdelv, dnssec, forward system tests 2023-09-19 14:47:48 +02:00
Tom Krizek
78981cee77 Use prereq.sh for qmin, cookie system tests 2023-09-19 14:47:48 +02:00
Tom Krizek
2f962f7041 Use prereq.sh for reclimit system test 2023-09-19 14:47:48 +02:00
Tom Krizek
587129b4c0 Use prereq.sh for xfer system test 2023-09-19 14:47:48 +02:00
Tom Krizek
27281955af Use prereq.sh for statschannel system test 2023-09-19 14:47:48 +02:00
Tom Krizek
9cc821d42f Add prereq.sh scripts for system tests requiring perl mod DNS
prereq.sh mechanism for dependency detection is preferred since it works
for both legacy and pytest runner.
2023-09-19 14:47:47 +02:00
Tom Krizek
f0493890cc Use proper perl interpreter in xfer system test 2023-09-19 14:47:47 +02:00
Tom Krizek
807f67b1cd Remove redundant dependency checks for system tests
Dependencies for these tests are already checked in prereq.sh - if the
dependencies are missing, these tests will be skipped. The extra
dependency check in Makefile.am is extraneous and only applied for the
legacy test runner.
2023-09-19 14:47:47 +02:00
Tom Krizek
d4502206a1 Fix pytest module detection for run.sh
To allow concurrent invocations of pytest, it is necessary to assign
ports properly to avoid conflicts. In order to do that, pytest needs to
know a complete list of all test modules.

When pytest is invoked from run.sh, the current working directory is the
system test directory. To properly detect other tests, the conftest.py
has to look in the bin/tests/system directory, rather than the current
working directory.
2023-09-19 14:47:47 +02:00
Tom Krizek
56c1087304 Use pytest runner for make check
Make python & pytest required dependencies to run system tests and
invoke the pytest runner from the makefile.
2023-09-19 14:47:45 +02:00
Tom Krizek
9a1a10e84f Merge branch 'tkrizek/pytest-check-system-test-files-with-danger' into 'main'
enforce system test file and name conventions with danger CI

See merge request isc-projects/bind9!8254
2023-09-19 12:46:54 +00:00
Tom Krizek
d1371267c6 danger: check system test convetions for pytest runner
When adding a new system test, it might easy to forget to add the
required files for the pytest runner or break a naming convention. Add
danger checks to cover these cases.
2023-09-19 13:29:30 +02:00
Tom Krizek
546212b78b Add missing pytest glue for for host system test
Without this glue file, the test isn't picked up by the pytest runner
and therefore not executed.
2023-09-19 13:29:30 +02:00
Tom Krizek
c026a00696 Rename allow-query pytest glue file
To conform with the expected naming convention, the pytest glue file for
the `allow-query` test should use underscore as the word separator in
the python file name: allow-query/tests_sh_allow_query.py
2023-09-19 13:29:29 +02:00
Tom Krizek
9e13c3dbcb Treat bin/tests/system/_common as non-temp directory
The _common directory is a special case directory which contains shared
files for other system test directories. Make sure it's tracked in git
and not deleted during temporary directory cleanup.
2023-09-19 13:29:29 +02:00
Tom Krizek
168dba163c Rename system test directory with common files to _common
The old name "common" clashes with the convention of system test
directory naming. It appears as a system test directory, but it only
contains helper files.

To reduce confusion and to allow automatic detection of issues with
possibly missing test files, rename the helper directory to "_common".
The leading underscore indicates the directory is different and the its
name can no longer be confused with regular system test directories.
2023-09-19 13:29:27 +02:00
Ondřej Surý
7f91925dad Merge branch '4322-hashmap-iterator-can-iterate-twice-the-same-item-if-deleting-items-via-delcurrent_next' into 'main'
Resolve "hashmap iterator can iterate twice the same item if deleting items via delcurrent_next"

Closes #4322

See merge request isc-projects/bind9!8309
2023-09-19 09:51:24 +00:00
Mark Andrews
f467dbc182 Add CHANGES note for [GL #3422] 2023-09-19 11:18:04 +02:00
Ondřej Surý
45fb84076d Add assertion failure when adding to hashmap when iterating
When iterating the table, we can't add new nodes to the hashmap because
we can't assure that we are not adding the new node before the iterator.

This also applies to rehashing - which might be triggered by both
isc_hashmap_add() and isc_hashmap_delete(), but not
isc_hashmap_iter_delcurrent_next().
2023-09-19 11:18:04 +02:00
Mark Andrews
92a0d65a51 Fix hashmap iteration
When isc_hashmap_iter_delcurrent_next calls hashmap_delete_node
nodes from the front of the table could be added to the end of
the table resulting in them being returned twice.  Detect when
this is happening and prevent those nodes being returned twice
buy reducing the effective size of the table by one each time
it happens.
2023-09-19 11:18:03 +02:00
Mark Andrews
c2b6f4357d Merge branch '4314-dns_ncache_current-fails-to-set-covered-correctly' into 'main'
Resolve "dns_ncache_current fails to set covered correctly"

Closes #4314

See merge request isc-projects/bind9!8300
2023-09-18 05:42:05 +00:00
Mark Andrews
80298ade33 Add a CHANGES note for [GL #4314] 2023-09-18 13:39:17 +10:00
Mark Andrews
8ce359652a Check RRSIG covered type in negative cache entry
The covered type previously displayed as TYPE0 when it should
have reflected the records that was actually covered.
2023-09-18 13:38:27 +10:00
Mark Andrews
779980710c Correctly set the value of covered in dns_ncache_current
Fix the type and rdclass being passed to dns_rdata_tostruct so
that rrsig.covered is correctly set.
2023-09-18 13:38:27 +10:00
Ondřej Surý
b0b0aac505 Merge branch 'ondrej/use-cds_lfht-for-dns_dispatch' into 'main'
Rewrite the QID lookup table to cds_lfht

See merge request isc-projects/bind9!8304
2023-09-16 06:35:49 +00:00
Ondřej Surý
405860022f Add CHANGES note for [GL !8304] 2023-09-16 07:32:18 +02:00
Ondřej Surý
aa0971027c Cleanup unused .localport member of dns_dispatch_t and some macros
The .localport member of dns_dispatch_t structure was unused, clean it
up.  Cleanup unused and/or redundant macros.
2023-09-16 07:32:18 +02:00
Ondřej Surý
c9b4b45943 Replace the linked list of TCP dispatches with hash table
Reusing TCP connections with dns_dispatch_gettcp() used linear linked
list to lookup existing outgoing TCP connections that could be reused.
Replace the linked list with per-loop cds_lfht hashtable to speedup the
lookups.  We use cds_lfht because it allows non-unique node insertion
that we need to check for dispatches in different connection states.
2023-09-16 07:32:18 +02:00
Ondřej Surý
6fd06c461b Make dns_dispatch bound to threads
Instead of high number of dispatches (4 * named_g_udpdisp)[1], make the
dispatches bound to threads and make dns_dispatchset_t create a dispatch
for each thread (event loop).

This required couple of other changes:

1. The dns_dispatch_createudp() must be called on loop, so the isc_tid()
   is already initialized - changes to nsupdate and mdig were required.

2. The dns_requestmgr had only a single dispatch per v4 and v6.  Instead
   of using single dispatch, use dns_dispatchset_t for each protocol -
   this is same as dns_resolver.
2023-09-16 07:32:17 +02:00
Ondřej Surý
282c4709b8 Rewrite the QID lookup table to cds_lfht
Looking up unique message ID in the dns_dispatch has been using custom
hash tables.  Rewrite the custom hashtable to use cds_lfht API, removing
one extra lock in the cold-cache resolver hot path.
2023-09-16 07:32:17 +02:00
Ondřej Surý
7be52f1bad Merge branch 'ondrej-improve-isc_hashmap' into 'main'
Refactor isc_hashmap to accept custom match function

See merge request isc-projects/bind9!8289
2023-09-16 05:25:54 +00:00
Ondřej Surý
e270266627 Refactor isc_hashmap to accept custom match function
Refactor isc_hashmap to allow custom matching functions.  This allows us
to have better tailored keys that don't require fixed uint8_t arrays,
but can be composed of more fields from the stored data structure.
2023-09-16 07:20:48 +02:00