chg: nil: followup changes from !10779

Two follow up changes from !10779: turning a sh-based config test into a python one, as well as guarding a pointer initialization.

Merge branch 'colin/zone-plugins-followup' into 'main'

See merge request isc-projects/bind9!10958
This commit is contained in:
Evan Hunt 2025-09-10 17:37:27 +00:00
commit 65f6e8fdbc
3 changed files with 12 additions and 42 deletions

View file

@ -1,40 +0,0 @@
#!/bin/sh
# 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.
set -e
. ../conf.sh
status=0
n=0
for conf in conf/good*.conf; do
n=$((n + 1))
echo_i "checking that $conf is accepted ($n)"
ret=0
$CHECKCONF "$conf" || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
done
for conf in conf/bad*.conf; do
n=$((n + 1))
echo_i "checking that $conf is rejected ($n)"
ret=0
$CHECKCONF "$conf" >/dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
done
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1

View file

@ -9,6 +9,10 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import glob
import os
import subprocess
import dns
import pytest
import isctest
@ -75,5 +79,9 @@ def test_hooks_zone_rndc_reload(servers):
ns2.rndc("reload")
def test_hooks_config(run_tests_sh):
run_tests_sh()
def test_hooks_checkconf():
for filename in glob.glob("conf/good*.conf"):
isctest.run.cmd([os.environ["CHECKCONF"], filename])
for filename in glob.glob("conf/bad*.conf"):
with pytest.raises(subprocess.CalledProcessError):
isctest.run.cmd([os.environ["CHECKCONF"], filename])

View file

@ -5229,6 +5229,8 @@ qctx_destroy(query_ctx_t *qctx) {
*/
static void
qctx_save(query_ctx_t *src, query_ctx_t **targetp) {
REQUIRE(targetp != NULL && *targetp == NULL);
query_ctx_t *target = isc_mem_get(src->client->manager->mctx,
sizeof(query_ctx_t));