gh-126554: correct detection of gcc for TestNullDlsym.test_null_dlsym (GH-129872)

In case gcc is not available, the test will fail with FileNotFoundError.
So catch the exception to skip the test correctly.

Signed-off-by: Peter Marko <peter.marko@siemens.com>
This commit is contained in:
Peter Marko 2025-02-10 10:51:56 +01:00 committed by GitHub
parent bff4bfeae1
commit 978211c8a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,11 +58,14 @@ class TestNullDlsym(unittest.TestCase):
import subprocess
import tempfile
retcode = subprocess.call(["gcc", "--version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
if retcode != 0:
try:
retcode = subprocess.call(["gcc", "--version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except OSError:
self.skipTest("gcc is missing")
if retcode != 0:
self.skipTest("gcc --version failed")
pipe_r, pipe_w = os.pipe()
self.addCleanup(os.close, pipe_r)