Converted warpx from the old format to the new format for stand-alone testing (#44677)
* Converted warpx from the old format to the new format for stand-alone testing --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
		| @@ -291,23 +291,31 @@ def copy_test_sources(self): | |||||||
|         install test subdirectory for use during `spack test run`.""" |         install test subdirectory for use during `spack test run`.""" | ||||||
|         cache_extra_test_sources(self, [self.examples_src_dir]) |         cache_extra_test_sources(self, [self.examples_src_dir]) | ||||||
| 
 | 
 | ||||||
|     def test(self): |     def run_warpx(self, dim): | ||||||
|         """Perform smoke tests on the installed package.""" |  | ||||||
|         if "+app" not in self.spec: |         if "+app" not in self.spec: | ||||||
|             print("WarpX smoke tests skipped: requires variant +app") |             raise SkipTest("Package must be installed with +app") | ||||||
|             return |         if dim not in self.spec.variants["dims"].value: | ||||||
|  |             raise SkipTest(f"Package must be installed with {dim} in dims") | ||||||
|  |         dim_arg = f"{dim}d" if dim.isdigit() else dim | ||||||
|  |         if self.spec.satisfies("@:23.05") and not dim.isdigit(): | ||||||
|  |             dim_arg = dim_arg.upper() | ||||||
|  |         exe = find(self.prefix.bin, f"warpx.{dim_arg}.*", recursive=False)[0] | ||||||
|  |         cli_args = self._get_input_options(dim, True) | ||||||
|  |         warpx = which(exe) | ||||||
|  |         warpx(*cli_args) | ||||||
| 
 | 
 | ||||||
|         # our executable names are a variant-dependent and naming evolves |     def test_warpx_1d(self): | ||||||
|         for dim in self.spec.variants["dims"].value: |         """Run warpx 1d test""" | ||||||
|             exe_nD = {"1": "warpx.1d", "2": "warpx.2d", "3": "warpx.3d", "rz": "warpx.rz"} |         self.run_warpx("1") | ||||||
|             exe = find(self.prefix.bin, exe_nD[dim] + ".*", recursive=False)[0] |  | ||||||
| 
 | 
 | ||||||
|             cli_args = self._get_input_options(dim, True) |     def test_warpx_2d(self): | ||||||
|             self.run_test( |         """Run warpx 2d test""" | ||||||
|                 exe, |         self.run_warpx("2") | ||||||
|                 cli_args, | 
 | ||||||
|                 [], |     def test_warpx_3d(self): | ||||||
|                 installed=True, |         """Run warpx 3d test""" | ||||||
|                 purpose="Smoke test for WarpX", |         self.run_warpx("3") | ||||||
|                 skip_missing=False, | 
 | ||||||
|             ) |     def test_warpx_rz(self): | ||||||
|  |         """Run warpx rz test""" | ||||||
|  |         self.run_warpx("rz") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 AcriusWinter
					AcriusWinter