Skip to content

Commit b63a52b

Browse files
committed
Fix unit tests for linux
1 parent 78e53fe commit b63a52b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

test/test_raffle.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919
lib_ext = {
2020
"Darwin": "a",
21-
"Linux": "a"
21+
"Linux": "so"
2222
}[platform.system()]
23-
libraffle_path = os.path.join(lib_dir, f"libraffle.{lib_ext}")
23+
if platform.system() == "Darwin":
24+
libraffle_path = os.path.join(lib_dir, f"libraffle.{lib_ext}")
25+
else:
26+
libraffle_path = raffle._raffle.__file__
2427

2528
with open("test/CMakeLists.txt", "r") as file:
2629
lines = file.readlines()
@@ -41,8 +44,12 @@
4144

4245
def uses_openmp(lib_path):
4346
try:
44-
out = subprocess.check_output(["nm", "-g", lib_path], text=True)
45-
return "_GOMP_parallel" in out
47+
if platform.system() == "Darwin":
48+
out = subprocess.check_output(["nm", "-g", lib_path], text=True)
49+
return "_GOMP_parallel" in out
50+
else:
51+
out = subprocess.check_output(["ldd", lib_path], text=True)
52+
return "libgomp" in out
4653
except Exception:
4754
return False
4855

0 commit comments

Comments
 (0)