mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-16 09:43:02 -04:00
Check for unregistered rdata files in CI
Verify in the misc CI job that every rdata source file under lib/dns/rdata is an input of the generated lib/dns/code.h, i.e. registered in dns_header_depfiles. An unregistered file is still compiled into BIND 9 (gen.c scans the directories directly), but editing it does not trigger regeneration of code.h. Assisted-by: Claude:claude-opus-4-8
This commit is contained in:
parent
f27acdfd5a
commit
11539c7f4a
2 changed files with 57 additions and 0 deletions
|
|
@ -689,6 +689,9 @@ misc:
|
|||
- sh util/check-gitignore.sh
|
||||
- sh util/check-trailing-whitespace.sh
|
||||
- bash util/unused-headers.sh
|
||||
# Check that every rdata source file is registered for header generation
|
||||
- meson setup build
|
||||
- bash util/check-rdata-registration.sh build
|
||||
# Check dangling symlinks in the repository
|
||||
- if find . -xtype l | grep .; then exit 1; fi
|
||||
- muon-meson analyze -Werror
|
||||
|
|
|
|||
54
util/check-rdata-registration.sh
Executable file
54
util/check-rdata-registration.sh
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# Fail if an rdata source file under lib/dns/rdata is not registered as an
|
||||
# input of the generated lib/dns/code.h header, i.e. missing from
|
||||
# dns_header_depfiles in the relevant meson.build. An unregistered file is
|
||||
# still compiled into BIND 9 (gen.c scans the directories directly), but
|
||||
# editing it does not trigger regeneration of code.h.
|
||||
#
|
||||
# Usage: check-rdata-registration.sh [BUILDDIR] (BUILDDIR defaults to "build")
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
builddir=${1:-build}
|
||||
|
||||
registered=$(mktemp)
|
||||
ondisk=$(mktemp)
|
||||
trap 'rm -f "$registered" "$ondisk"' EXIT
|
||||
|
||||
# Registered files: the inputs lib/dns/code.h is generated from, reduced to
|
||||
# repo-relative lib/dns/rdata/<class>/<file> paths.
|
||||
ninja -C "$builddir" -t inputs lib/dns/code.h \
|
||||
| sed -n 's@^.*\(lib/dns/rdata/[^/]*/[^/]*\)$@\1@p' \
|
||||
| sort -u >"$registered"
|
||||
|
||||
# rdata-type source files on disk (e.g. soa_6.c, nsap-ptr_23.h). Skeleton
|
||||
# files such as proforma.c are not type-named and are skipped, mirroring
|
||||
# gen.c's filename filter.
|
||||
printf '%s\n' lib/dns/rdata/*/*.c lib/dns/rdata/*/*.h \
|
||||
| grep -E '/[-0-9a-z]+_[0-9]+\.[ch]$' \
|
||||
| sort -u >"$ondisk"
|
||||
|
||||
unregistered=$(comm -23 "$ondisk" "$registered")
|
||||
|
||||
if [ -n "$unregistered" ]; then
|
||||
echo "$unregistered" | while read -r file; do
|
||||
echo "Rdata file $file is not registered for header" \
|
||||
"generation (add it to dns_header_depfiles in the" \
|
||||
"meson.build)" >&2
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Reference in a new issue