diff --git a/tests/terminal/test_archive_gaps.py b/tests/terminal/test_archive_gaps.py index efe7cec8..79bc3ae9 100644 --- a/tests/terminal/test_archive_gaps.py +++ b/tests/terminal/test_archive_gaps.py @@ -16,6 +16,7 @@ sys.path.insert(0, str(ROOT)) from strata_control import calibration, tune_apply, tuning # noqa: E402 from strata_control.profiles import ProfileError # noqa: E402 +from strata_control.targets import host_platform # noqa: E402 class BooleanFlags(unittest.TestCase): @@ -83,6 +84,7 @@ class CalibrateWithoutAFullFolder(unittest.TestCase): self.assertTrue(calibration._tools_available()) +@unittest.skipIf(host_platform() == "linux-aarch64", "there is no HIP engine for arm64 Linux (BACKEND_MATRIX)") class HipPackageForAnotherCard(unittest.TestCase): """A HIP package built for gfx1200/gfx1201 must not be chosen for a Phoenix iGPU (gfx1103): P2006 resolved it as usable.""" diff --git a/tests/terminal/test_engine_component.py b/tests/terminal/test_engine_component.py index 6f9fc567..f7de0de8 100644 --- a/tests/terminal/test_engine_component.py +++ b/tests/terminal/test_engine_component.py @@ -20,6 +20,7 @@ from strata_control import acquisition, components, engine_component as ec WINDOWS = os.name == "nt" HERE = components.host_platform() +NO_HIP = HERE == "linux-aarch64" # the DGX Spark: CUDA only EXE = "strata.exe" if WINDOWS else "strata" @@ -116,6 +117,7 @@ class Resolution(unittest.TestCase): ec.resolve(self.root, backend="cuda") self.assertIn(f"is for {other}", str(caught.exception)) + @unittest.skipIf(NO_HIP, "there is no HIP engine for arm64 Linux (BACKEND_MATRIX): this test builds one for the host platform") def test_another_backend_is_refused_with_the_reason(self): make_package(self.root, backend="hip") with self.assertRaises(ec.EngineMissing) as caught: @@ -303,6 +305,7 @@ class WindowsAmd(unittest.TestCase): self.assertIn(device, ec.WIN_AMD_IGPU_IDS) +@unittest.skipIf(NO_HIP, "there is no HIP engine for arm64 Linux (BACKEND_MATRIX): this test builds one for the host platform") class WrongCardFamily(unittest.TestCase): """A tester build is for one AMD card family; on another family the person gets one plain line, not a technical list.""" @@ -333,6 +336,7 @@ class WrongCardFamily(unittest.TestCase): self.assertEqual(ec.resolve(self.root, backend="hip", runtime="1").backend, "hip") +@unittest.skipIf(NO_HIP, "there is no HIP engine for arm64 Linux (BACKEND_MATRIX): this test builds one for the host platform") class Rx6000Package(unittest.TestCase): """0.2.2: the RX 6000 package (gfx1030 / gfx1031) is the one an RX 6000 card finds, and no other card family finds it.""" diff --git a/tests/terminal/test_launch_install.py b/tests/terminal/test_launch_install.py index 7a8d011f..78339a43 100644 --- a/tests/terminal/test_launch_install.py +++ b/tests/terminal/test_launch_install.py @@ -5,6 +5,7 @@ from __future__ import annotations import hashlib import json import os +import platform import shutil import subprocess import sys @@ -21,6 +22,9 @@ sys.path.insert(0, str(ROOT / "packaging")) sys.path.insert(0, str(ROOT)) import make_local_feed as mlf # noqa: E402 +# the fixture Terminal is built for the machine the test runs on: install.sh picks its archive by uname +PLAT = "linux-aarch64" if sys.platform.startswith("linux") and platform.machine().lower() in ("aarch64", "arm64") else "linux-x86_64" + class Scripts(unittest.TestCase): def test_install_sh_syntax_and_guard(self): @@ -59,7 +63,7 @@ class Scripts(unittest.TestCase): class Feed(unittest.TestCase): def make_bundle(self, work: Path) -> Path: """A tiny terminal archive that is a working `strata` (the repo's own source with the system Python).""" - top = work / "bundle" / "strata-terminal-9.9.9-linux-x86_64" + top = work / "bundle" / ("strata-terminal-9.9.9-" + PLAT) top.mkdir(parents=True) for name in ("strata.py", "strata_cli", "strata_control", "serve"): src = ROOT / name @@ -68,7 +72,7 @@ class Feed(unittest.TestCase): shutil.copy2(ROOT / "bin" / "strata", top / "bin" / "strata") (top / "bin" / "strata").chmod(0o755) (top / "VERSION").write_text("9.9.9\n", encoding="utf-8") - archive = work / "strata-terminal-9.9.9-linux-x86_64.tar.gz" + archive = work / ("strata-terminal-9.9.9-" + PLAT + ".tar.gz") with tarfile.open(archive, "w:gz") as tf: tf.add(top, arcname=top.name) return archive @@ -84,7 +88,7 @@ class Feed(unittest.TestCase): for name in ("strata-feed.json", "strata-feed.json.sig", "install-manifest.txt", "install.sh", "install.ps1", "test-trust.json"): self.assertTrue((feed / name).is_file(), name) line = (feed / "install-manifest.txt").read_text().split() - self.assertEqual(line[0], "linux-x86_64") + self.assertEqual(line[0], PLAT) self.assertEqual(line[1], "9.9.9") control = feed / line[2] self.assertEqual(hashlib.sha256(control.read_bytes()).hexdigest(), line[3]) @@ -121,7 +125,7 @@ class Feed(unittest.TestCase): # an archive with one top folder (a terminal archive, not the feed's control package) installs too data = archive.read_bytes() (feed / "top.tar.gz").write_bytes(data) - (feed / "install-manifest.txt").write_text(f"linux-x86_64 9.9.9 top.tar.gz {hashlib.sha256(data).hexdigest()} {len(data)}" + chr(10)) + (feed / "install-manifest.txt").write_text(f"{PLAT} 9.9.9 top.tar.gz {hashlib.sha256(data).hexdigest()} {len(data)}" + chr(10)) home3 = work / "home3" home3.mkdir() r = subprocess.run(["sh", str(feed / "install.sh")], capture_output=True, text=True, env={**env, "HOME": str(home3)}, timeout=240) @@ -152,11 +156,11 @@ class Feed(unittest.TestCase): release = work / "release" feed_tool.keygen(work / "keys") key = feed_tool._load_key(work / "keys" / "feed-key.json") - entry = feed_tool.pack_control(folder, release / "control", version="9.9.9", platform="linux-x86_64", url_prefix="") + entry = feed_tool.pack_control(folder, release / "control", version="9.9.9", platform=PLAT, url_prefix="") shutil.move(str(release / "control" / entry["url"]), str(release / entry["url"])) # GitHub assets are flat feed_tool.build_feed(release, key=key, sequence=1, control_dir=release / "control") line = (release / "install-manifest.txt").read_text().split() - self.assertEqual(line, ["linux-x86_64", "9.9.9", entry["url"], entry["sha256"], str(entry["size"])]) + self.assertEqual(line, [PLAT, "9.9.9", entry["url"], entry["sha256"], str(entry["size"])]) self.assertEqual(json.loads((release / "strata-feed.json").read_text())["control"]["packages"][0]["sha256"], entry["sha256"]) bad = work / "bad" # a Windows pack that is not a zip cannot be installed by install.ps1: left out of the manifest feed_tool.build_feed(bad, key=key, sequence=1, control_dir=self._windows_tar_pack(folder, work)) diff --git a/tests/terminal/test_packaging_pins.py b/tests/terminal/test_packaging_pins.py index b38a75c7..ef9c9113 100644 --- a/tests/terminal/test_packaging_pins.py +++ b/tests/terminal/test_packaging_pins.py @@ -19,7 +19,7 @@ def norm(name): class InterpreterPins(unittest.TestCase): def test_every_target_has_a_digest_and_a_matching_url(self): - self.assertEqual(sorted(pt.PYTHON_PINS), ["darwin-arm64", "linux-x86_64", "windows-x86_64"]) + self.assertEqual(sorted(pt.PYTHON_PINS), ["darwin-arm64", "linux-aarch64", "linux-x86_64", "windows-x86_64"]) for target, pin in pt.PYTHON_PINS.items(): with self.subTest(target): self.assertRegex(pin["sha256"], r"^[0-9a-f]{64}$") @@ -27,7 +27,7 @@ class InterpreterPins(unittest.TestCase): self.assertIn(pt.PBS_RELEASE, pin["url"]) self.assertTrue(pin["url"].startswith("https://github.com/astral-sh/python-build-standalone/")) self.assertTrue(pin["url"].endswith("install_only.tar.gz")) - self.assertEqual(len({p["sha256"] for p in pt.PYTHON_PINS.values()}), 3) + self.assertEqual(len({p["sha256"] for p in pt.PYTHON_PINS.values()}), 4) def test_the_mac_pin_is_the_one_setup_sh_downloads(self): text = (ROOT / "setup.sh").read_text(encoding="utf-8") @@ -47,8 +47,8 @@ class InterpreterPins(unittest.TestCase): class WheelLocks(unittest.TestCase): def locks(self): found = sorted((ROOT / "packaging" / "locks").glob("runtime-*-cp312.txt")) - self.assertEqual([p.name for p in found], ["runtime-darwin-arm64-cp312.txt", "runtime-linux-x86_64-cp312.txt", - "runtime-windows-x86_64-cp312.txt"]) + self.assertEqual([p.name for p in found], ["runtime-darwin-arm64-cp312.txt", "runtime-linux-aarch64-cp312.txt", + "runtime-linux-x86_64-cp312.txt", "runtime-windows-x86_64-cp312.txt"]) return found def test_every_entry_is_pinned_and_hashed_and_nothing_else_is_in_the_file(self):