Add test operation to tau package (#25036)

Copy over the general purpose mm matmult testcase. On test run build, execute (with mpi as needed) and process profile output.
This commit is contained in:
wspear 2021-07-22 10:09:18 -07:00 committed by GitHub
parent 8735d0a281
commit 91b4d974f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -331,3 +331,36 @@ def setup_run_environment(self, env):
# in the latter case. # in the latter case.
if files: if files:
env.set('TAU_MAKEFILE', files[0]) env.set('TAU_MAKEFILE', files[0])
matmult_test = join_path('examples', 'mm')
@run_after('install')
def setup_build_tests(self):
"""Copy the build test files after the package is installed to an
install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.matmult_test)
def _run_matmult_test(self):
mm_dir = join_path(self.test_suite.current_test_cache_dir, self.matmult_test)
self.run_test('make', ['all'], [], 0, False,
'Instrument and build matrix multiplication test code',
False, mm_dir)
test_exe = 'matmult'
if '+mpi' in self.spec:
test_args = ['-n', '4', test_exe]
mpiexe_list = ['mpirun', 'mpiexec', 'srun']
for mpiexe in mpiexe_list:
if which(mpiexe) is not None:
self.run_test(mpiexe, test_args, [], 0, False,
'Run matmult test with mpi', False, mm_dir)
break
else:
self.run_test(test_exe, [], [], 0, False,
'Run sequential matmult test', False, mm_dir)
self.run_test('pprof', [], [], 0, False,
'Run pprof profile analysis tool on profile output',
False, mm_dir)
def test(self):
# Run mm test program pulled from the build
self._run_matmult_test()