|
| 1 | +from pathlib import Path |
| 2 | + |
| 3 | +from mache.deploy import run as deploy_run |
| 4 | + |
| 5 | + |
| 6 | +def test_write_load_script_includes_machine_for_toolchain( |
| 7 | + tmp_path, monkeypatch |
| 8 | +): |
| 9 | + monkeypatch.chdir(tmp_path) |
| 10 | + |
| 11 | + script_path = deploy_run._write_load_script( |
| 12 | + prefix=str(tmp_path / 'prefix'), |
| 13 | + pixi_exe='/usr/bin/pixi', |
| 14 | + software='polaris', |
| 15 | + software_version='1.0.0', |
| 16 | + runtime_version_cmd=None, |
| 17 | + machine='pm-gpu', |
| 18 | + toolchain_compiler='oneapi/2024.2', |
| 19 | + toolchain_mpi='mpich@4.2', |
| 20 | + spack_library_view=None, |
| 21 | + spack_activation='', |
| 22 | + ) |
| 23 | + |
| 24 | + assert script_path == 'load_polaris_pm-gpu_oneapi_2024.2_mpich_4.2.sh' |
| 25 | + assert Path(script_path).is_file() |
| 26 | + |
| 27 | + |
| 28 | +def test_write_load_script_without_toolchain_keeps_default_name( |
| 29 | + tmp_path, |
| 30 | + monkeypatch, |
| 31 | +): |
| 32 | + monkeypatch.chdir(tmp_path) |
| 33 | + |
| 34 | + script_path = deploy_run._write_load_script( |
| 35 | + prefix=str(tmp_path / 'prefix'), |
| 36 | + pixi_exe='/usr/bin/pixi', |
| 37 | + software='polaris', |
| 38 | + software_version='1.0.0', |
| 39 | + runtime_version_cmd=None, |
| 40 | + machine='chrysalis', |
| 41 | + toolchain_compiler=None, |
| 42 | + toolchain_mpi=None, |
| 43 | + spack_library_view=None, |
| 44 | + spack_activation='', |
| 45 | + ) |
| 46 | + |
| 47 | + assert script_path == 'load_polaris.sh' |
| 48 | + assert Path(script_path).is_file() |
0 commit comments