diff --git a/.gitattributes b/.gitattributes index e2a0641fbf..79c472aba8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -32,4 +32,5 @@ dangerfile.py export-ignore /util/dtrace.sh -export-ignore /util/meson.build -export-ignore /util/meson-system-test-init.sh -export-ignore +/util/check_test_registration.py -export-ignore /util/meson-dist-package.sh -export-ignore diff --git a/tests/dns/meson.build b/tests/dns/meson.build index a13482f9d9..36294a0629 100644 --- a/tests/dns/meson.build +++ b/tests/dns/meson.build @@ -18,6 +18,7 @@ dns_tests = [ 'dbiterator', 'dbversion', 'deleg', + 'diff', 'dispatch', 'dns64', 'dst', @@ -40,6 +41,7 @@ dns_tests = [ 'resolver', 'rsa', 'sigs', + 'skr', 'time', 'transport', 'tsig', @@ -51,6 +53,14 @@ dns_tests = [ 'zt', ] +_all_dns_tests = dns_tests + ['geoip', 'dnstap'] +run_command( + check_test_registration, + meson.current_source_dir(), + _all_dns_tests, + check: true, +) + if config.has('HAVE_GEOIP2') dns_tests += 'geoip' endif diff --git a/tests/dns/skr_test.c b/tests/dns/skr_test.c index 55b533dc52..8f29f304f3 100644 --- a/tests/dns/skr_test.c +++ b/tests/dns/skr_test.c @@ -40,7 +40,6 @@ #include #include #include -#include #include "zone_p.h" diff --git a/tests/isc/meson.build b/tests/isc/meson.build index 81955d759d..7790181941 100644 --- a/tests/isc/meson.build +++ b/tests/isc/meson.build @@ -62,6 +62,14 @@ flaky_isc_test = [ is_el8 = run_command('grep', '-q', '-F', 'platform:el8', '/etc/os-release', check: false).returncode() == 0 +_all_isc_test = isc_test + ['doh'] +run_command( + check_test_registration, + meson.current_source_dir(), + _all_isc_test, + check: true, +) + if config.has('HAVE_LIBNGHTTP2') and not is_el8 isc_test += 'doh' endif diff --git a/tests/isccfg/meson.build b/tests/isccfg/meson.build index 0055f42f43..66adda5ccd 100644 --- a/tests/isccfg/meson.build +++ b/tests/isccfg/meson.build @@ -9,11 +9,20 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -foreach unit : [ +isccfg_tests = [ 'duration', 'grammar', 'parser', ] + +run_command( + check_test_registration, + meson.current_source_dir(), + isccfg_tests, + check: true, +) + +foreach unit : isccfg_tests test_bin = executable( unit, files(f'@unit@_test.c'), diff --git a/tests/meson.build b/tests/meson.build index e62cf01de3..7b7cb9f9c8 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -52,6 +52,8 @@ if not cmocka_dep.found() subdir_done() endif +check_test_registration = [python, files('../util/check_test_registration.py')] + subdir('bench') subdir('dns') subdir('isc') diff --git a/tests/ns/meson.build b/tests/ns/meson.build index 75c5260223..452c7ea05f 100644 --- a/tests/ns/meson.build +++ b/tests/ns/meson.build @@ -9,11 +9,15 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -foreach unit : [ +ns_tests = [ 'notify', 'plugin', 'query', ] + +run_command(check_test_registration, meson.current_source_dir(), ns_tests, check: true) + +foreach unit : ns_tests test_bin = executable( unit, files(f'@unit@_test.c', 'netmgr_wrap.c'), diff --git a/util/check_test_registration.py b/util/check_test_registration.py new file mode 100644 index 0000000000..1bde17ef77 --- /dev/null +++ b/util/check_test_registration.py @@ -0,0 +1,28 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + + +import glob +import os +import sys + +test_dir = sys.argv[1] +registered = sys.argv[2:] + +for path in sorted(glob.glob(os.path.join(test_dir, "*_test.c"))): + name = os.path.basename(path).removesuffix("_test.c") + if name not in registered: + print( + f"Unit test file {os.path.basename(path)} is not registered" + f" (add '{name}' to the list)", + file=sys.stderr, + ) + sys.exit(1)