Add regression test

This commit is contained in:
psakiev 2024-04-29 11:46:59 -06:00
parent 317ecd82b9
commit 93ff027045
2 changed files with 18 additions and 1 deletions

View File

@ -7,6 +7,7 @@
import shutil
import sys
import pathlib
import pytest
import llnl.util.filesystem as fs
@ -630,3 +631,15 @@ def test_install_from_binary_with_missing_patch_succeeds(
s.package.do_install(package_cache_only=True, dependencies_cache_only=True, unsigned=True)
assert temporary_store.db.query_local_by_spec_hash(s.dag_hash())
@pytest.mark.regression("38484")
def test_git_ref_version_can_be_reused(monkeypatch, mock_git_version_info, install_mockery):
repo_path, filename, commits = mock_git_version_info
monkeypatch.setattr(
spack.package_base.PackageBase, "git", pathlib.Path(repo_path).as_uri(), raising=False
)
spec = spack.spec.Spec("git-test-commit@git.v1.0=1.0+generic_install+feature").concretized()
spec.package.do_install()
new_spec = spack.spec.Spec("git-test-commit@git.v1.0=1.0+generic_install~feature")
new_spec.concretize()

View File

@ -17,10 +17,14 @@ class GitTestCommit(Package):
version("1.2", tag="1.2") # not a typo
version("2.0", tag="v2.0")
variant("generic_install", default=False, description="Override install feature for original implementations tests")
variant("feature", default=False, description="A very cool feature")
def install(self, spec, prefix):
# It is assumed for the test which installs this package, that it will
# be using the earliest commit, which is contained in the range @:0
assert spec.satisfies("@:0")
if not spec.variants["generic_install"].value:
assert spec.satisfies("@:0")
mkdir(prefix.bin)
# This will only exist for some second commit