diff options
author | afzpatel <122491982+afzpatel@users.noreply.github.com> | 2024-03-18 05:13:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 10:13:08 +0100 |
commit | 3445da807eea2034fd2d59213765a7897c3d5eae (patch) | |
tree | 6ce4828c5004be2f871b26bc2cb634cc1b5b1c8e | |
parent | 429c3598af387ec05761834adcd7be97f89fe59c (diff) | |
download | spack-3445da807eea2034fd2d59213765a7897c3d5eae.tar.gz spack-3445da807eea2034fd2d59213765a7897c3d5eae.tar.bz2 spack-3445da807eea2034fd2d59213765a7897c3d5eae.tar.xz spack-3445da807eea2034fd2d59213765a7897c3d5eae.zip |
rocm-smi-lib: remove standalone test and add build time test (#43129)
-rw-r--r-- | var/spack/repos/builtin/packages/rocm-smi-lib/package.py | 72 |
1 files changed, 6 insertions, 66 deletions
diff --git a/var/spack/repos/builtin/packages/rocm-smi-lib/package.py b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py index 8b11e4c666..7d50af78db 100644 --- a/var/spack/repos/builtin/packages/rocm-smi-lib/package.py +++ b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py @@ -7,7 +7,6 @@ import os import re import shutil -import subprocess from spack.package import * @@ -57,6 +56,7 @@ class RocmSmiLib(CMakePackage): args = [ self.define_from_variant("BUILD_SHARED_LIBS", "shared"), self.define("CMAKE_INSTALL_LIBDIR", "lib"), + self.define("BUILD_TESTS", self.run_tests), ] return args @@ -78,68 +78,8 @@ class RocmSmiLib(CMakePackage): os.remove(join_path(self.prefix.bin, "rsmiBindings.py")) symlink("../bindings/rsmiBindings.py", join_path(self.prefix.bin, "rsmiBindings.py")) - test_src_dir = "tests/rocm_smi_test" - - @run_after("install") - def cache_test_sources(self): - """Copy the tests source files after the package is installed to an - install test subdirectory for use during `spack test run`.""" - if self.spec.satisfies("@:5.1.0"): - return - self.cache_extra_test_sources([self.test_src_dir]) - - def test(self): - if self.spec.satisfies("@:5.1.0"): - print("Skipping: stand-alone tests") - return - exclude = "rsmitst.exclude" - TOPOLOGY_SYSFS_DIR = "/sys/devices/virtual/kfd/kfd/topology/nodes" - test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) - with working_dir(test_dir, create=True): - cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake") - prefixes = ";".join([self.spec["rocm-smi-lib"].prefix]) - cc_options = [ - "-DCMAKE_PREFIX_PATH=" + prefixes, - "-DROCM_DIR=" + self.spec["rocm-smi-lib"].prefix, - ".", - ] - self.run_test(cmake_bin, cc_options) - make() - - # Since rsmitst internally attempts to run for every gpu the exclude test list will - # be the union of all the excludes for all the devices on the system - disabled_tests = "" - if os.path.exists(TOPOLOGY_SYSFS_DIR): - for file in os.listdir(TOPOLOGY_SYSFS_DIR): - name_file = os.path.join(TOPOLOGY_SYSFS_DIR, str(file), "name") - if os.path.exists(name_file): - with open(name_file, "r") as f: - node = f.readline().strip("\n") - if node: - cmd = "source " + exclude + ' && echo "${FILTER[' + node + ']}"' - node_tests = subprocess.check_output( - cmd, shell=True, executable="/bin/bash" - ) - node_tests = node_tests.decode("utf-8").strip("\n") - if node_tests: - disabled_tests = disabled_tests + node_tests + ":" - - # disable tests under virtualization - cmd = "source " + exclude + ' && echo "${FILTER[virtualization]}"' - virtualization_tests = subprocess.check_output(cmd, shell=True, executable="/bin/bash") - virtualization_tests = virtualization_tests.decode("utf-8").strip("\n") - disabled_tests = disabled_tests + virtualization_tests - - # disable test that requires --privileged permissions - privileged_tests = ":".join( - [ - "rsmitstReadWrite.TestPerfLevelReadWrite", - "rsmitstReadWrite.TestFrequenciesReadWrite", - "rsmitstReadWrite.TestPciReadWrite", - "rsmitstReadWrite.TestPerfCntrReadWrite", - ] - ) - disabled_tests = disabled_tests + ":" + privileged_tests - - self.run_test("rsmitst64", "--gtest_filter=-" + disabled_tests) - make("clean") + @run_after("build") + @on_package_attributes(run_tests=True) + def check_build(self): + exe = which(join_path(self.build_directory, "tests", "rocm_smi_test", "rsmitst")) + exe() |