@@ -382,6 +382,17 @@ def punittest(ars, report=False):
382
382
Pass --regex to further filter the junit and TSK tests. GraalPy tests are always run in two configurations:
383
383
with language home on filesystem and with language home served from the Truffle resources.
384
384
"""
385
+ path = os .environ .get ("PATH" , "" )
386
+ if mx .is_linux () and not shutil .which ("patchelf" ):
387
+ venv = Path (SUITE .get_output_root ()).absolute () / "patchelf-venv"
388
+ path += os .pathsep + str (venv / "bin" )
389
+ if not shutil .which ("patchelf" , path = path ):
390
+ mx .log (f"{ time .strftime ('[%H:%M:%S] ' )} Building patchelf-venv with { sys .executable } ... [patchelf not found on PATH]" )
391
+ t0 = time .time ()
392
+ subprocess .check_call ([sys .executable , "-m" , "venv" , str (venv )])
393
+ subprocess .check_call ([str (venv / "bin" / "pip" ), "install" , "patchelf" ])
394
+ mx .log (f"{ time .strftime ('[%H:%M:%S] ' )} Building patchelf-venv with { sys .executable } ... [duration: { time .time () - t0 } ]" )
395
+
385
396
args = [] if ars is None else ars
386
397
@dataclass
387
398
class TestConfig :
@@ -426,7 +437,8 @@ def __str__(self):
426
437
for c in configs :
427
438
mx .log (f"Python JUnit tests configuration: { c } " )
428
439
PythonMxUnittestConfig .useResources = c .useResources
429
- mx_unittest .unittest (c .args , test_report_tags = ({"task" : f"punittest-{ c .identifier } -{ 'w' if c .useResources else 'wo' } -resources" } if c .reportConfig else None ))
440
+ with set_env (PATH = path ):
441
+ mx_unittest .unittest (c .args , test_report_tags = ({"task" : f"punittest-{ c .identifier } -{ 'w' if c .useResources else 'wo' } -resources" } if c .reportConfig else None ))
430
442
431
443
if skip_leak_tests :
432
444
return
0 commit comments