Rename test file

This commit is contained in:
psakiev 2024-05-29 11:02:27 -06:00
parent c2ce7ab70c
commit b04e794b6c
3 changed files with 52 additions and 113 deletions

View File

@ -2915,36 +2915,35 @@ def test_spec_filters(specs, include, exclude, expected):
assert f.selected_specs() == expected
@pytest.mark.only_clingo("clingo only re-use feature being tested")
@pytest.mark.only_clingo("clingo only reuse feature being tested")
@pytest.mark.regression("38484")
def test_git_ref_version_can_be_reused(
install_mockery_mutable_config, do_not_check_runtimes_on_reuse
):
first_spec = spack.spec.Spec("zlib-ng@git.2.1.5=2.1.5").concretized()
first_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5").concretized()
first_spec.package.do_install(fake=True, explicit=True)
with spack.config.override("concretizer:reuse", True):
second_spec = spack.spec.Spec("zlib-ng@git.2.1.5=2.1.5~opt").concretized()
# is_installed(first_spec)
second_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5~opt").concretized()
assert second_spec.dag_hash() != first_spec.dag_hash()
@pytest.mark.only_clingo("clingo only re-use feature being tested")
@pytest.mark.only_clingo("clingo only reuse feature being tested")
def test_reuse_prefers_standard_over_git_versions(
install_mockery_mutable_config, do_not_check_runtimes_on_reuse
):
"""
order matters in this test. typically re-use would pick the last installed match
order matters in this test. typically reuse would pick the last installed match
but we want to prefer the standard version over git ref based versions
so install git ref last and ensure it is not picked up by re-use
so install git ref last and ensure it is not picked up by reuse
"""
standard_spec = spack.spec.Spec("zlib-ng@2.1.5").concretized()
standard_spec = spack.spec.Spec("git-ref-package@2.1.5").concretized()
standard_spec.package.do_install(fake=True, explicit=True)
git_spec = spack.spec.Spec("zlib-ng@git.2.1.5=2.1.5").concretized()
git_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5").concretized()
git_spec.package.do_install(fake=True, explicit=True)
with spack.config.override("concretizer:reuse", True):
test_spec = spack.spec.Spec("zlib-ng@2").concretized()
test_spec = spack.spec.Spec("git-ref-package@2").concretized()
assert git_spec.dag_hash() != test_spec.dag_hash()
assert standard_spec.dag_hash() == test_spec.dag_hash()

View File

@ -0,0 +1,43 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems import autotools, cmake
from spack.package import *
class GitRefPackage(AutotoolsPackage):
"""
dummy package copied from zlib-ng
"""
homepage = "https://github.com/dummy/dummy"
url = "https://github.com/dummy/dummy/archive/2.0.0.tar.gz"
git = "https://github.com/dummy/dummy.git"
version("2.1.6", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2")
version("2.1.5", sha256="3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04")
version("2.1.4", sha256="a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a")
version(
"2.1.3",
sha256="d20e55f89d71991c59f1c5ad1ef944815e5850526c0d9cd8e504eaed5b24491a",
deprecated=True,
)
version(
"2.1.2",
sha256="383560d6b00697c04e8878e26c0187b480971a8bce90ffd26a5a7b0f7ecf1a33",
deprecated=True,
)
version("2.0.7", sha256="6c0853bb27738b811f2b4d4af095323c3d5ce36ceed6b50e5f773204fb8f7200")
version("2.0.0", sha256="86993903527d9b12fc543335c19c1d33a93797b3d4d37648b5addae83679ecd8")
variant("compat", default=True, description="Enable compatibility API")
variant("opt", default=True, description="Enable optimizations")
variant("shared", default=True, description="Build shared library")
variant("pic", default=True, description="Enable position-independent code (PIC)")
conflicts("+shared~pic")
variant("new_strategies", default=True, description="Enable new deflate strategies")

View File

@ -1,103 +0,0 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems import autotools, cmake
from spack.package import *
class ZlibNg(AutotoolsPackage, CMakePackage):
"""
zlib replacement with optimizations for next generation systems.
-- added to the mock packages for GitVersion re-use testing, but
removed patches
"""
homepage = "https://github.com/zlib-ng/zlib-ng"
url = "https://github.com/zlib-ng/zlib-ng/archive/2.0.0.tar.gz"
git = "https://github.com/zlib-ng/zlib-ng.git"
license("Zlib")
version("2.1.6", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2")
version("2.1.5", sha256="3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04")
version("2.1.4", sha256="a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a")
version(
"2.1.3",
sha256="d20e55f89d71991c59f1c5ad1ef944815e5850526c0d9cd8e504eaed5b24491a",
deprecated=True,
)
version(
"2.1.2",
sha256="383560d6b00697c04e8878e26c0187b480971a8bce90ffd26a5a7b0f7ecf1a33",
deprecated=True,
)
version("2.0.7", sha256="6c0853bb27738b811f2b4d4af095323c3d5ce36ceed6b50e5f773204fb8f7200")
version("2.0.0", sha256="86993903527d9b12fc543335c19c1d33a93797b3d4d37648b5addae83679ecd8")
variant("compat", default=True, description="Enable compatibility API")
variant("opt", default=True, description="Enable optimizations")
variant("shared", default=True, description="Build shared library")
variant("pic", default=True, description="Enable position-independent code (PIC)")
conflicts("+shared~pic")
variant("new_strategies", default=True, description="Enable new deflate strategies")
provides("zlib-api", when="+compat")
# Default to autotools, since cmake would result in circular dependencies if it's not
# reused.
build_system("autotools", "cmake", default="autotools")
with when("build_system=cmake"):
depends_on("cmake@3.5.1:", type="build")
depends_on("cmake@3.14.0:", type="build", when="@2.1.0:")
conflicts("%nvhpc@:20", msg="the compiler is too old and too broken")
@property
def libs(self):
name = "libz" if self.spec.satisfies("+compat") else "libz-ng"
return find_libraries(
name, root=self.prefix, recursive=True, shared=self.spec.satisfies("+shared")
)
def flag_handler(self, name, flags):
if name == "cflags" and self.spec.satisfies("+pic build_system=autotools"):
flags.append(self.compiler.cc_pic_flag)
return (flags, None, None)
class AutotoolsBuilder(autotools.AutotoolsBuilder):
@run_before("configure")
def pretend_gcc(self):
# All nice things (PIC flags, symbol versioning) that happen to the compilers that are
# recognized as gcc (%gcc, %clang, %intel, %oneapi) we want for some other compilers too:
if self.spec.compiler.name in ["nvhpc"]:
filter_file(r"^gcc=0$", "gcc=1", join_path(self.configure_directory, "configure"))
def configure_args(self):
args = []
if self.spec.satisfies("+compat"):
args.append("--zlib-compat")
if self.spec.satisfies("~opt"):
args.append("--without-optimizations")
if self.spec.satisfies("~shared"):
args.append("--static")
if self.spec.satisfies("~new_strategies"):
args.append("--without-new-strategies")
return args
class CMakeBuilder(cmake.CMakeBuilder):
def cmake_args(self):
return [
self.define_from_variant("ZLIB_COMPAT", "compat"),
self.define_from_variant("WITH_OPTIM", "opt"),
self.define("BUILD_SHARED_LIBS", self.spec.satisfies("+shared")),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
self.define_from_variant("WITH_NEW_STRATEGIES", "new_strategies"),
self.define("ZLIB_ENABLE_TESTS", self.pkg.run_tests),
]