diff options
author | AcriusWinter <152348900+AcriusWinter@users.noreply.github.com> | 2024-07-25 17:47:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-25 17:47:44 -0700 |
commit | f371b6f06cb69bc9ec58cae0c8214eca81303f0d (patch) | |
tree | 8710108ddfbb693a16f84a6ef7239c93fac5321d /var | |
parent | 0f9434fca4db198409e76276e3463ae752052920 (diff) | |
download | spack-f371b6f06cb69bc9ec58cae0c8214eca81303f0d.tar.gz spack-f371b6f06cb69bc9ec58cae0c8214eca81303f0d.tar.bz2 spack-f371b6f06cb69bc9ec58cae0c8214eca81303f0d.tar.xz spack-f371b6f06cb69bc9ec58cae0c8214eca81303f0d.zip |
umpire: old to new test API and refactor (#44957)
* umpire: old to new test format
* umpire: old to new test method and refactor
* indentation
* black reformat
* last minute syntax
* docstring and checks
* black format
* change test name
* method call correction
* Resolve problem with stand-alone tests (or examples) not loading library (Fixes #44960)
---------
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/umpire/package.py | 88 |
1 files changed, 53 insertions, 35 deletions
diff --git a/var/spack/repos/builtin/packages/umpire/package.py b/var/spack/repos/builtin/packages/umpire/package.py index 75d638dddc..6348d943d3 100644 --- a/var/spack/repos/builtin/packages/umpire/package.py +++ b/var/spack/repos/builtin/packages/umpire/package.py @@ -6,8 +6,6 @@ import os import socket -import llnl.util.tty as tty - from spack.package import * from .blt import llnl_link_helpers @@ -462,37 +460,57 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): def cmake_args(self): return [] - def test(self): + def setup_run_environment(self, env): + for library in ["lib", "lib64"]: + lib_path = join_path(self.prefix, library) + if os.path.exists(lib_path): + env.append_path("LD_LIBRARY_PATH", lib_path) + + def run_example(self, exe, expected): """Perform stand-alone checks on the installed package.""" - if self.spec.satisfies("@:1") or not os.path.isdir(self.prefix.bin): - tty.info("Skipping: checks not installed in bin for v{0}".format(self.version)) - return - - # Run a subset of examples PROVIDED installed - # tutorials with readily checkable outputs. - checks = { - "malloc": ["99 should be 99"], - "recipe_dynamic_pool_heuristic": ["in the pool", "releas"], - "recipe_no_introspection": ["has allocated", "used"], - "strategy_example": ["Available allocators", "HOST"], - "tut_copy": ["Copied source data"], - "tut_introspection": ["Allocator used is HOST", "size of the allocation"], - "tut_memset": ["Set data from HOST"], - "tut_move": ["Moved source data", "HOST"], - "tut_reallocate": ["Reallocated data"], - "vector_allocator": [""], - } - - for exe in checks: - expected = checks[exe] - reason = "test: checking output from {0}".format(exe) - self.run_test( - exe, - [], - expected, - 0, - installed=False, - purpose=reason, - skip_missing=True, - work_dir=self.prefix.bin, - ) + + exe_run = which(join_path(self.prefix.bin, exe)) + if exe_run is None: + raise SkipTest(f"{exe} is not installed for version {self.version}") + out = exe_run(output=str.split, error=str.split) + check_outputs(expected, out) + + def test_malloc(self): + """Run Malloc""" + self.run_example("malloc", ["99 should be 99"]) + + def test_recipe_dynamic_pool_heuristic(self): + """Multiple use allocator test""" + self.run_example("recipe_dynamic_pool_heuristic", ["in the pool", "releas"]) + + def test_recipe_no_introspection(self): + """Test without introspection""" + self.run_example("recipe_no_introspection", ["has allocated", "used"]) + + def test_strategy_example(self): + """Memory allocation strategy test""" + self.run_example("strategy_example", ["Available allocators", "HOST"]) + + def test_tut_copy(self): + """Copy data test""" + self.run_example("tut_copy", ["Copied source data"]) + + def test_tut_introspection(self): + """Keep track of pointer allocation test""" + self.run_example("tut_introspection", ["Allocator used is HOST", "size of the allocation"]) + + def test_tut_memset(self): + """Set entire block of memory to one value test""" + self.run_example("tut_memset", ["Set data from HOST"]) + + def test_tut_move(self): + """Move memory test""" + self.run_example("tut_move", ["Moved source data", "HOST"]) + + def test_tut_reallocate(self): + """Reallocate memory test""" + self.run_example("tut_reallocate", ["Reallocated data"]) + + def test_vector_allocator(self): + """Allocate vector memory test""" + self.run_example("vector_allocator", [""]) |