[PATCH] tests/fetch: report OpenSSL certificate generation errors

"Fredrik Svensson (svsvenss)" <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <DM6PR11MB3962E55724AA2F8BCE00B58FCBDA2@DM6PR11MB3962.namprd11.prod.outlook.com>
The HTTPS connection cache test suppresses all output from the OpenSSL
certificate-generation command. When the command fails, the test reports
only its exit status and hides the information needed to diagnose
worker-specific failures.

Capture combined stdout and stderr and include it in the assertion failure.

Signed-off-by: Fredrik Svensson <[email protected]>
---
 lib/bb/tests/fetch.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index fd064743..a1e4b45f 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -1812,11 +1812,13 @@ class FetchCheckStatusTest(FetcherTest):
 
         certificate = os.path.join(self.tempdir, "certificate.pem")
         private_key = os.path.join(self.tempdir, "private-key.pem")
-        subprocess.check_call(
+        result = subprocess.run(
             ["openssl", "req", "-x509", "-newkey", "rsa:2048", "-nodes",
              "-keyout", private_key, "-out", certificate, "-days", "1",
              "-subj", "/CN=127.0.0.1"],
-            stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+            stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
+        self.assertEqual(result.returncode, 0,
+                         "openssl certificate generation failed:\n%s" % result.stdout)
 
         server = HTTPSServer(("127.0.0.1", 0), HTTPSRequestHandler)
         context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.