Skip to content

Commit 4b1bb47

Browse files
committed
test: Handle different architectures, where IFUNC not supported
Signed-off-by: Georgios Alexopoulos <[email protected]>
1 parent cda7771 commit 4b1bb47

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Lib/test/test_ctypes/test_dlerror.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import unittest
4+
import platform
45

56
FOO_C = r"""
67
#include <unistd.h>
@@ -79,7 +80,15 @@ def test_null_dlsym(self):
7980
f.write(FOO_C.replace('$DESCRIPTOR', str(pipe_w)))
8081
args = ['gcc', '-fPIC', '-shared', '-o', dstname, srcname]
8182
p = subprocess.run(args, capture_output=True)
82-
self.assertEqual(p.returncode, 0, p)
83+
84+
if p.returncode != 0:
85+
# IFUNC is not supported on all architectures.
86+
if platform.machine() == 'x86_64':
87+
# It should be supported here. Something else went wrong.
88+
p.check_returncode()
89+
else:
90+
# IFUNC might not be supported on this machine.
91+
self.skipTest(f"could not compile indirect function: {p}")
8392

8493
# Case #1: Test 'PyCFuncPtr_FromDll' from Modules/_ctypes/_ctypes.c
8594
L = CDLL(dstname)

0 commit comments

Comments
 (0)