fix: probe CUDA engine in compatible runtime image
Linux / verify (pull_request) Successful in 2m44s
Linux / keyless-cuda (pull_request) Skipped
Linux / hosted-cuda-package (pull_request) Skipped
Linux / linux-cli-container (pull_request) Successful in 21s
Linux / linux-static-cli (pull_request) Successful in 7m17s
Linux / release-cli (pull_request) Skipped

This commit is contained in:
Pavlo Ratushnyi
2026-10-06 06:41:34 +02:00
parent 70f99ba63e
commit 7446c70dfa
6 changed files with 84 additions and 6 deletions
+26
View File
@@ -76,6 +76,20 @@ class PackageTests(unittest.TestCase):
with pkg.lock(alias):
self.fail('symlink lock accepted')
def test_cuda_loader_probe_can_be_deferred_only_as_declared(self):
probe_binary = self.root / 'strata-next'
stage = self.root / 'stage'
stage.mkdir()
with patch.object(pkg, 'run') as run:
self.assertEqual(pkg.probe_engine_help(probe_binary, stage, {}, defer_to_runtime_image=True),
'deferred-to-runtime-image')
run.assert_not_called()
with patch.object(pkg, 'run') as run:
self.assertEqual(pkg.probe_engine_help(probe_binary, stage, {}, defer_to_runtime_image=False),
'passed-on-package-builder-host')
run.assert_called_once()
self.assertTrue((stage / 'probe.json').is_file())
@unittest.skipUnless(sys.platform == 'linux', 'Linux atomic publication')
def test_atomic_publication_never_replaces_existing_directory(self):
staged, output = self.root / 'stage', self.root / 'out'
@@ -117,6 +131,18 @@ class PackageTests(unittest.TestCase):
build.assert_not_called()
self.assertEqual((output / 'old').read_text(), 'keep')
def test_cpu_fixture_cannot_defer_loader_probe(self):
from types import SimpleNamespace
args = SimpleNamespace(engine=self.root/'engine', sha256='0'*64, revision='a'*40,
output=self.root/'out', cargo_target_dir=self.root/'target',
cpu_fixture=True, defer_engine_help_probe_to_runtime_image=True)
with patch.object(pkg.platform, 'system', return_value='Linux'), \
patch.object(pkg.platform, 'machine', return_value='x86_64'), \
patch.object(pkg.subprocess, 'run') as build:
with self.assertRaisesRegex(ValueError, 'only CUDA package builds'):
pkg.assemble(args)
build.assert_not_called()
if __name__ == '__main__':
unittest.main()