Files
TheRock/rocm-libraries/projects/hipblaslt/utilities/geko/tests/test_paths_unit.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

73 lines
2.4 KiB
Python

# Copyright Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT
from __future__ import annotations
from pathlib import Path
import pytest
from geko import paths
def test_looks_like_and_is_built(tmp_path: Path) -> None:
root = tmp_path / "hip"
root.mkdir()
assert paths.looks_like_hipblaslt_root(root) is False
assert paths.is_hipblaslt_built(root) is False
(root / "tensilelite").mkdir()
assert paths.looks_like_hipblaslt_root(root) is True
(root / "build/release").mkdir(parents=True)
assert paths.is_hipblaslt_built(root) is True
def test_resolve_explicit_and_env_priority(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
env_root = tmp_path / "env"
env_root.mkdir()
(env_root / "tensilelite").mkdir()
exp_root = tmp_path / "exp"
exp_root.mkdir()
(exp_root / "tensilelite").mkdir()
monkeypatch.setenv(paths.HIPBLASLT_PATH_ENV_VAR, str(env_root))
out = paths.resolve_hipblaslt_path(explicit=str(exp_root), anchor=None)
assert out == exp_root.resolve()
def test_resolve_from_env_and_anchor(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
env_root = tmp_path / "env"
env_root.mkdir()
(env_root / "tensilelite").mkdir()
monkeypatch.setenv(paths.HIPBLASLT_PATH_ENV_VAR, str(env_root))
out = paths.resolve_hipblaslt_path(anchor=None)
assert out == env_root.resolve()
monkeypatch.delenv(paths.HIPBLASLT_PATH_ENV_VAR, raising=False)
anchor_root = tmp_path / "repo"
anchor_file = anchor_root / "a/b/c.py"
anchor_file.parent.mkdir(parents=True)
anchor_file.write_text("x", encoding="utf-8")
(anchor_root / "tensilelite").mkdir()
out2 = paths.resolve_hipblaslt_path(anchor=anchor_file)
assert out2 == anchor_root.resolve()
def test_resolve_errors_and_require_built(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
bad = tmp_path / "bad"
bad.mkdir()
with pytest.raises(SystemExit):
paths.resolve_hipblaslt_path(explicit=bad)
monkeypatch.delenv(paths.HIPBLASLT_PATH_ENV_VAR, raising=False)
with pytest.raises(SystemExit):
paths.resolve_hipblaslt_path(anchor=tmp_path / "none/x.py")
not_built = tmp_path / "nb"
not_built.mkdir()
(not_built / "tensilelite").mkdir()
with pytest.raises(SystemExit):
paths.resolve_hipblaslt_path(explicit=not_built, require_built=True)