bind9/util/check_test_registration.py
Michal Nowak f4ccbe8159 Report all unregistered unit test files at once
Collect every unregistered unit test file before exiting instead of
failing on the first one, so a single configure run lists them all.

Assisted-by: Claude:claude-opus-4-8
2026-06-24 13:57:07 +02:00

33 lines
943 B
Python

# 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:]
missing = []
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:
missing.append((os.path.basename(path), name))
if missing:
for filename, name in missing:
print(
f"Unit test file {filename} is not registered"
f" (add '{name}' to the list)",
file=sys.stderr,
)
sys.exit(1)