vc: improvements for testing (#28887)

This commit is contained in:
Valentin Volkl 2023-03-01 14:29:43 +01:00 committed by GitHub
parent 206cd94c0b
commit 1500246ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 55 deletions

View File

@ -10,32 +10,35 @@ class Vc(CMakePackage):
"""SIMD Vector Classes for C++""" """SIMD Vector Classes for C++"""
homepage = "https://github.com/VcDevel/Vc" homepage = "https://github.com/VcDevel/Vc"
url = "https://github.com/VcDevel/Vc/archive/1.3.0.tar.gz" git = "https://github.com/VcDevel/Vc.git"
url = "https://github.com/VcDevel/Vc/archive/refs/tags/1.3.3.tar.gz"
version("1.4.2", sha256="50d3f151e40b0718666935aa71d299d6370fafa67411f0a9e249fbce3e6e3952") version("1.4.2", sha256="50d3f151e40b0718666935aa71d299d6370fafa67411f0a9e249fbce3e6e3952")
version("1.4.1", sha256="7e8b57ed5ff9eb0835636203898c21302733973ff8eaede5134dd7cb87f915f6") version("1.4.1", sha256="7e8b57ed5ff9eb0835636203898c21302733973ff8eaede5134dd7cb87f915f6")
version("1.3.3", sha256="32f1bdd4046a90907a2b63ee39d72ad0e6d0608937f8202d759d7fa0eddd1ec1")
version("1.3.0", sha256="2309a19eea136e1f9d5629305b2686e226093e23fe5b27de3d6e3d6084991c3a") version("1.3.0", sha256="2309a19eea136e1f9d5629305b2686e226093e23fe5b27de3d6e3d6084991c3a")
version("1.2.0", sha256="9cd7b6363bf40a89e8b1d2b39044b44a4ce3f1fd6672ef3fc45004198ba28a2b") version("1.2.0", sha256="9cd7b6363bf40a89e8b1d2b39044b44a4ce3f1fd6672ef3fc45004198ba28a2b")
version("1.1.0", sha256="281b4c6152fbda11a4b313a0a0ca18565ee049a86f35f672f1383967fef8f501") version("1.1.0", sha256="281b4c6152fbda11a4b313a0a0ca18565ee049a86f35f672f1383967fef8f501")
variant( @run_before("cmake")
"build_type", def fetch_additional_sources(self):
default="RelWithDebInfo", """Starting from 1.4:, the test suite requires both the virtest framework
description="The build type to build", and some test data. Both are intended to be set up as git submodules,
values=("Debug", "Release", "RelWithDebug", "RelWithDebInfo", "MinSizeRel"), but due to the size of the test data (around 300MB), it is more efficient
) to set those up only as needed.
"""
# Build fails without it when --test is used, can't be type='test': if self.run_tests and self.spec.satisfies("@1.4.0:"):
depends_on("virtest") git = which("git")
with working_dir(join_path(self.stage.source_path, "tests/testdata")):
def patch(self): git("clone", "--filter=tree:0", "https://github.com/VcDevel/vc-testdata", ".")
tests = FileFilter("tests/CMakeLists.txt") # NOTE to maintainers: when adding new versions,
tests.filter(";AVX2", "") # check if the commit hash changed:
tests.filter(".*logarithm.*", "") # https://github.com/VcDevel/Vc/tree/1.4/tests
tests.filter(".*trigonometric.*", "") git("fetch", "origin", "9ada1f34d6a41f1b5553d6223f277eae72c039d3")
git("checkout", "9ada1f34d6a41f1b5553d6223f277eae72c039d3")
def cmake_args(self): with working_dir(join_path(self.stage.source_path, "tests/virtest")):
if self.run_tests: git("clone", "https://github.com/mattkretz/virtest/", ".")
return ["-DBUILD_TESTING=ON"] # NOTE to maintainers: when adding new versions,
else: # check if the commit hash changed:
return ["-DBUILD_TESTING=OFF"] # https://github.com/VcDevel/Vc/tree/1.4/tests
git("checkout", "f7d03ef39fceba168745bd29e1b20af6e7971e04")

View File

@ -1,33 +0,0 @@
# Copyright 2013-2023 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)
import os
from spack.package import *
class Virtest(CMakePackage):
"""Header-only unit test framework, as easy as possible to use"""
homepage = "https://github.com/mattkretz/virtest"
git = "https://github.com/mattkretz/virtest.git"
maintainers("bernhardkaindl")
version("master", branch="master")
def patch(self):
script = FileFilter("tests/CMakeLists.txt")
script.filter(
r" *\${CMAKE_CTEST_COMMAND} -V -R \${target}",
'${CMAKE_CTEST_COMMAND} -V -R "^${target}$"',
)
def setup_run_environment(self, env):
env.prepend_path("CPATH", self.prefix.include.vir)
@run_after("install")
def rename_include_for_vc_package(self):
with working_dir(self.prefix.include):
os.rename("vir", "virtest")