]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Log command stdout when using isctest.run.cmd()
authorNicki Křížek <nicki@isc.org>
Thu, 26 Jun 2025 14:18:01 +0000 (16:18 +0200)
committerNicki Křížek <nicki@isc.org>
Fri, 27 Jun 2025 16:09:08 +0000 (18:09 +0200)
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.

(cherry picked from commit 9f3f6ec38e2ebb5314b1df72d0b28eb951a61038)

bin/tests/system/isctest/run.py
bin/tests/system/keyfromlabel/tests_keyfromlabel.py
bin/tests/system/rsabigexponent/tests_rsabigexponent.py
bin/tests/system/verify/tests_verify.py

index 6e694a7efc710bc1a317990c73e046a6c7c7a6f9..f33fa3cad28a1cfef942a7823ed46227fa0b36bc 100644 (file)
@@ -26,7 +26,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,
@@ -78,7 +78,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")
 
 
index 705dff2934c20ed875daa48d6c3a0440693af067..e66fcdebee6466bfd02e8aec6f8b394d2237f837 100644 (file)
@@ -71,19 +71,20 @@ def token_init_and_cleanup():
     isctest.run.cmd(
         token_cleanup_command,
         env=EMPTY_OPENSSL_CONF_ENV,
-        log_stderr=False,
         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
     finally:
         output = isctest.run.cmd(
-            token_cleanup_command, env=EMPTY_OPENSSL_CONF_ENV, log_stdout=True
+            token_cleanup_command,
+            env=EMPTY_OPENSSL_CONF_ENV,
+            raise_on_exception=False,
         ).stdout.decode("utf-8")
         assert re.search("Found token (.*) with matching token label", output)
         assert re.search("The token (.*) has been deleted", output)
@@ -127,7 +128,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 +148,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)
@@ -194,6 +195,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")
index 571fe2fe132704eef378352d5e51ad0810147d54..45882297421e60aafe5db9b115d558a49a75a109 100644 (file)
@@ -43,7 +43,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():
index 6b5d5ecfe7f0fb1d5f0b5afecb6daa315aa4e5e9..d900e56039be3619a3226c92988a2bfbc7753a55 100644 (file)
@@ -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