From: Nicki Křížek Date: Thu, 26 Jun 2025 14:18:01 +0000 (+0200) Subject: Log command stdout when using isctest.run.cmd() X-Git-Tag: v9.21.10~15^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f3f6ec38e2ebb5314b1df72d0b28eb951a61038;p=thirdparty%2Fbind9.git Log command stdout when using isctest.run.cmd() The command's stdout may provide useful debug info, so make sure we log it by default. It doesn't seem to have a significant impact on the log size. --- diff --git a/bin/tests/system/dnstap/tests_dnstap.py b/bin/tests/system/dnstap/tests_dnstap.py index 258d2b5f892..e804eaa9ffd 100644 --- a/bin/tests/system/dnstap/tests_dnstap.py +++ b/bin/tests/system/dnstap/tests_dnstap.py @@ -44,7 +44,7 @@ def run_rndc(server, rndc_command): cmdline = [rndc, "-c", "../_common/rndc.conf", "-p", port, "-s", server] cmdline.extend(rndc_command) - isctest.run.cmd(cmdline, log_stdout=True) + isctest.run.cmd(cmdline) def test_dnstap_dispatch_socket_addresses(): @@ -64,7 +64,6 @@ def test_dnstap_dispatch_socket_addresses(): # Read the contents of the dnstap file using dnstap-read. run = isctest.run.cmd( [isctest.vars.ALL["DNSTAPREAD"], "dnstap.out.resolver_addresses"], - log_stdout=True, ) # Check whether all frames contain the expected addresses. diff --git a/bin/tests/system/isctest/kasp.py b/bin/tests/system/isctest/kasp.py index 26ab63c740f..6a5e8ecde69 100644 --- a/bin/tests/system/isctest/kasp.py +++ b/bin/tests/system/isctest/kasp.py @@ -459,7 +459,7 @@ class Key: str(self.keyfile), ] - out = isctest.run.cmd(dsfromkey_command, log_stdout=True) + out = isctest.run.cmd(dsfromkey_command) dsfromkey = out.stdout.decode("utf-8").split() rdata_fromfile = " ".join(dsfromkey[:7]) diff --git a/bin/tests/system/isctest/run.py b/bin/tests/system/isctest/run.py index 4c3acc5d2b6..e4fbd459dd2 100644 --- a/bin/tests/system/isctest/run.py +++ b/bin/tests/system/isctest/run.py @@ -24,7 +24,7 @@ def cmd( timeout=60, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - log_stdout=False, + log_stdout=True, log_stderr=True, input_text: Optional[bytes] = None, raise_on_exception=True, @@ -111,7 +111,6 @@ class Dig: """Run the dig command with the given parameters and return the decoded output.""" return cmd( [os.environ.get("DIG")] + f"{self.base_params} {params}".split(), - log_stdout=True, ).stdout.decode("utf-8") diff --git a/bin/tests/system/kasp/tests_kasp.py b/bin/tests/system/kasp/tests_kasp.py index 2440914995a..9ffd70b87ca 100644 --- a/bin/tests/system/kasp/tests_kasp.py +++ b/bin/tests/system/kasp/tests_kasp.py @@ -1258,7 +1258,7 @@ def test_kasp_dnssec_keygen(): zone, ] - return isctest.run.cmd(keygen_command, log_stdout=True).stdout.decode("utf-8") + return isctest.run.cmd(keygen_command).stdout.decode("utf-8") # check that 'dnssec-keygen -k' (configured policy) creates valid files. keyprops = [ @@ -1294,7 +1294,7 @@ def test_kasp_dnssec_keygen(): str(publish), key.path, ] - out = isctest.run.cmd(settime, log_stdout=True).stdout.decode("utf-8") + out = isctest.run.cmd(settime).stdout.decode("utf-8") isctest.check.file_contents_equal(f"{key.statefile}", f"{key.statefile}.backup") assert key.get_metadata("Publish", file=key.privatefile) == str(publish) @@ -1343,7 +1343,7 @@ def test_kasp_dnssec_keygen(): str(now), key.path, ] - out = isctest.run.cmd(settime, log_stdout=True).stdout.decode("utf-8") + out = isctest.run.cmd(settime).stdout.decode("utf-8") isctest.kasp.check_keys("kasp", keys, expected) isctest.kasp.check_keytimes(keys, expected) @@ -1378,7 +1378,7 @@ def test_kasp_dnssec_keygen(): str(now), key.path, ] - out = isctest.run.cmd(settime, log_stdout=True).stdout.decode("utf-8") + out = isctest.run.cmd(settime).stdout.decode("utf-8") isctest.kasp.check_keys("kasp", keys, expected) isctest.kasp.check_keytimes(keys, expected) @@ -1423,7 +1423,7 @@ def test_kasp_dnssec_keygen(): str(soon), key.path, ] - out = isctest.run.cmd(settime, log_stdout=True).stdout.decode("utf-8") + out = isctest.run.cmd(settime).stdout.decode("utf-8") isctest.kasp.check_keys("kasp", keys, expected) isctest.kasp.check_keytimes(keys, expected) diff --git a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py index dc3fe553286..ae9305df3ee 100644 --- a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py +++ b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py @@ -70,13 +70,12 @@ def token_init_and_cleanup(): isctest.run.cmd( token_cleanup_command, env=EMPTY_OPENSSL_CONF_ENV, - log_stdout=True, raise_on_exception=False, ) try: output = isctest.run.cmd( - token_init_command, env=EMPTY_OPENSSL_CONF_ENV, log_stdout=True + token_init_command, env=EMPTY_OPENSSL_CONF_ENV ).stdout.decode("utf-8") assert "The token has been initialized and is reassigned to slot" in output yield @@ -84,7 +83,6 @@ def token_init_and_cleanup(): output = isctest.run.cmd( token_cleanup_command, env=EMPTY_OPENSSL_CONF_ENV, - log_stdout=True, raise_on_exception=False, ).stdout.decode("utf-8") assert re.search("Found token (.*) with matching token label", output) @@ -129,7 +127,7 @@ def test_keyfromlabel(alg_name, alg_type, alg_bits): ] output = isctest.run.cmd( - pkcs11_command, env=EMPTY_OPENSSL_CONF_ENV, log_stdout=True + pkcs11_command, env=EMPTY_OPENSSL_CONF_ENV ).stdout.decode("utf-8") assert "Key pair generated" in output @@ -147,7 +145,7 @@ def test_keyfromlabel(alg_name, alg_type, alg_bits): zone, ] - output = isctest.run.cmd(keyfrlab_command, log_stdout=True) + output = isctest.run.cmd(keyfrlab_command) output_decoded = output.stdout.decode("utf-8").rstrip() + ".key" assert os.path.exists(output_decoded) @@ -186,6 +184,6 @@ def test_keyfromlabel(alg_name, alg_type, alg_bits): zone, zone_file, ] - isctest.run.cmd(signer_command, log_stdout=True) + isctest.run.cmd(signer_command) assert os.path.exists(f"{zone_file}.signed") diff --git a/bin/tests/system/ksr/tests_ksr.py b/bin/tests/system/ksr/tests_ksr.py index fa09e85d84a..ed8c18c31bb 100644 --- a/bin/tests/system/ksr/tests_ksr.py +++ b/bin/tests/system/ksr/tests_ksr.py @@ -96,9 +96,7 @@ def ksr(zone, policy, action, options="", raise_on_exception=True): zone, ] - out = isctest.run.cmd( - ksr_command, log_stdout=True, raise_on_exception=raise_on_exception - ) + out = isctest.run.cmd(ksr_command, raise_on_exception=raise_on_exception) return out.stdout.decode("utf-8"), out.stderr.decode("utf-8") diff --git a/bin/tests/system/rollover/tests_rollover.py b/bin/tests/system/rollover/tests_rollover.py index f30eb2fad99..c42f3ef0658 100644 --- a/bin/tests/system/rollover/tests_rollover.py +++ b/bin/tests/system/rollover/tests_rollover.py @@ -265,7 +265,7 @@ def test_rollover_multisigner(servers): zone, ] - return isctest.run.cmd(keygen_command, log_stdout=True).stdout.decode("utf-8") + return isctest.run.cmd(keygen_command).stdout.decode("utf-8") zone = "multisigner-model2.kasp" diff --git a/bin/tests/system/rsabigexponent/tests_rsabigexponent.py b/bin/tests/system/rsabigexponent/tests_rsabigexponent.py index 9d02346c447..e42e114f728 100644 --- a/bin/tests/system/rsabigexponent/tests_rsabigexponent.py +++ b/bin/tests/system/rsabigexponent/tests_rsabigexponent.py @@ -42,7 +42,7 @@ def test_max_rsa_exponent_size_good(exponent_size, templates): def test_max_rsa_exponent_size_bad(exponent_size, templates): templates.render("options.conf", {"max_rsa_exponent_size": exponent_size}) with pytest.raises(subprocess.CalledProcessError): - isctest.run.cmd([CHECKCONF, "options.conf"], log_stdout=True) + isctest.run.cmd([CHECKCONF, "options.conf"]) def test_rsa_big_exponent_keys_cant_load(): diff --git a/bin/tests/system/verify/tests_verify.py b/bin/tests/system/verify/tests_verify.py index ae82dee1c53..203c2181be1 100644 --- a/bin/tests/system/verify/tests_verify.py +++ b/bin/tests/system/verify/tests_verify.py @@ -47,7 +47,7 @@ VERIFY = os.environ.get("VERIFY") ], ) def test_verify_good_zone_files(zone): - isctest.run.cmd([VERIFY, "-z", "-o", zone, f"zones/{zone}.good"], log_stdout=True) + isctest.run.cmd([VERIFY, "-z", "-o", zone, f"zones/{zone}.good"]) def test_verify_good_zone_nsec_next_name_case_mismatch(): @@ -58,7 +58,6 @@ def test_verify_good_zone_nsec_next_name_case_mismatch(): "nsec-next-name-case-mismatch", "zones/nsec-next-name-case-mismatch.good", ], - log_stdout=True, ) @@ -67,7 +66,6 @@ def get_bad_zone_output(zone): output = isctest.run.cmd( [VERIFY, *only_opt, "-o", zone, f"zones/{zone}.bad"], raise_on_exception=False, - log_stdout=True, ) stream = (output.stdout + output.stderr).decode("utf-8").replace("\n", "") return stream