Skip to content
Snippets Groups Projects
Commit 7607c4e3 authored by Gregory Becker's avatar Gregory Becker
Browse files

update tests to use status=0 over status=None

parent d4de364b
Branches
No related tags found
No related merge requests found
......@@ -42,5 +42,5 @@ def test(self):
for exe in exes:
reason = 'test version of {0} is {1}'.format(exe,
self.spec.version)
self.run_test(exe, ['-V'], [self.spec.version.string], None,
self.run_test(exe, ['-V'], [self.spec.version.string],
installed=True, purpose=reason, skip_missing=True)
......@@ -82,20 +82,12 @@ def configure_args(self):
def _test_check_versions(self):
"""Perform version checks on installed package binaries."""
spec_vers = str(self.spec.version)
checks = {
'ctags': ([spec_vers], None),
'ebrowse': ([spec_vers], None),
'emacs': ([spec_vers], None),
'emacsclient': ([spec_vers], None),
'etags': ([spec_vers], None),
}
checks = ['ctags', 'ebrowse', 'emacs', 'emacsclient', 'etags']
for exe in checks:
expected, status = checks[exe]
reason = 'test version of {0} is {1}'.format(exe, expected[0])
self.run_test(exe, ['--version'], expected, status, installed=True,
expected = str(self.spec.version)
reason = 'test version of {0} is {1}'.format(exe, expected)
self.run_test(exe, ['--version'], expected, installed=True,
purpose=reason, skip_missing=True)
def test(self):
......
......@@ -386,7 +386,7 @@ def _test_check_versions(self):
for exe in exes:
reason = 'test version of {0} is {1}'.format(exe, spec_vers_str)
option = '-V' if exe in use_short_opt else '--version'
self.run_test(exe, [option], spec_vers_str, None, installed=True,
self.run_test(exe, [option], spec_vers_str, installed=True,
purpose=reason, skip_missing=True)
def _test_example(self):
......@@ -398,17 +398,17 @@ def _test_example(self):
output = ''
with open(dump_file) as fd:
output == fd.read()
self.run_test('h5dump', [h5_file], output, None, installed=True,
self.run_test('h5dump', [h5_file], output, installed=True,
purpose=reason, skip_missing=True, work_dir='.')
reason = 'test: ensure h5copy runs'
options = ['-i', h5_file, '-s', 'Spack', '-o', 'test.h5', '-d', 'Spack']
self.run_test('h5copy', options, '', None, installed=True,
self.run_test('h5copy', options, installed=True,
purpose=reason, skip_missing=True, work_dir='.')
reason = 'test: ensure h5diff shows no differences in orig and copy'
options = [h5_file, 'test.h5']
self.run_test('h5diff', options, '', None, installed=True,
self.run_test('h5diff', options, installed=True,
purpose=reason, skip_missing=True, work_dir='.')
def test(self):
......
......@@ -231,7 +231,3 @@ def setup_run_environment(self, env):
for name, value in self.mpi_compiler_wrappers.items():
env.set(name, value)
def test(self):
self.test_compiler()
# TODO: test other components
......@@ -27,7 +27,7 @@ def cmake_args(self):
@run_after('install')
@on_package_attributes(run_tests=True)
def test(self):
def test_install(self):
# The help message exits with an exit code of 1
kcov = Executable(self.prefix.bin.kcov)
kcov('-h', ignore_errors=1)
......@@ -53,7 +53,7 @@ def _run_smoke_tests(self):
with open('./data/smoke_test.out', 'r') as fd:
expected = fd.read()
reason = 'test ability to use the library'
self.run_test(prog, [], expected, None, False, purpose=reason)
self.run_test(prog, [], expected, purpose=reason)
def _run_build_tests(self):
"""Build and run selected tests pulled from the build."""
......@@ -63,18 +63,16 @@ def _run_build_tests(self):
# Run the build tests to confirm the expected output
passed = 'Test passed'
checks = {
'sigsegv1': ([passed], None),
'sigsegv2': ([passed], None),
'sigsegv3': (['caught', passed], None),
'stackoverflow1': (['recursion', 'Stack overflow', passed], None),
'stackoverflow2': (['recursion', 'overflow', 'violation', passed],
None),
'sigsegv1': [passed],
'sigsegv2': [passed],
'sigsegv3': ['caught', passed],
'stackoverflow1': ['recursion', 'Stack overflow', passed],
'stackoverflow2': ['recursion', 'overflow', 'violation', passed],
}
for exe in checks:
expected, status = checks[exe]
for exe, expected in checks.items():
reason = 'test {0} output'.format(exe)
self.run_test(exe, [], expected, status, installed=False,
self.run_test(exe, [], expected, installed=True,
purpose=reason, skip_missing=True, work_dir=work_dir)
def test(self):
......
......@@ -720,10 +720,10 @@ def setup_install_tests(self):
def _test_bin_ops(self):
info = ([], ['Ident string: {0}'.format(self.spec.version), 'MCA'],
None)
0)
ls = (['-n', '1', 'ls', '..'],
['openmpi-{0}'.format(self.spec.version)], None)
['openmpi-{0}'.format(self.spec.version)], 0)
checks = {
'mpirun': ls,
......@@ -745,55 +745,55 @@ def _test_check_versions(self):
bad_option = 'unknown option'
checks = {
# Binaries available in at least versions 2.0.0 through 4.0.3
'mpiCC': ([comp_vers], None),
'mpic++': ([comp_vers], None),
'mpicc': ([comp_vers], None),
'mpicxx': ([comp_vers], None),
'mpiexec': ([spec_vers], None),
'mpif77': ([comp_vers], None),
'mpif90': ([comp_vers], None),
'mpifort': ([comp_vers], None),
'mpirun': ([spec_vers], None),
'mpiCC': ([comp_vers], 0),
'mpic++': ([comp_vers], 0),
'mpicc': ([comp_vers], 0),
'mpicxx': ([comp_vers], 0),
'mpiexec': ([spec_vers], 0),
'mpif77': ([comp_vers], 0),
'mpif90': ([comp_vers], 0),
'mpifort': ([comp_vers], 0),
'mpirun': ([spec_vers], 0),
'ompi-clean': ([bad_option], 213),
'ompi-server': ([bad_option], 1),
'ompi_info': ([spec_vers], None),
'ompi_info': ([spec_vers], 0),
'opal_wrapper': (['Cannot open configuration file'], 243),
'orte-clean': ([bad_option], 213),
'orte-info': (['did not have enough parameters'], 1),
'orte-server': ([bad_option], 1),
'ortecc': ([comp_vers], None),
'ortecc': ([comp_vers], 0),
'orted': ([bad_option], 213),
'orterun': ([spec_vers], None),
'orterun': ([spec_vers], 0),
# Binaries available in versions 2.0.0 through 2.1.6
'ompi-submit': ([spec_vers], None),
'orte-submit': ([spec_vers], None),
'ompi-submit': ([spec_vers], 0),
'orte-submit': ([spec_vers], 0),
# Binaries available in versions 2.0.0 through 3.1.5
'ompi-dvm': ([spec_vers], None),
'ompi-dvm': ([spec_vers], 0),
'ompi-ps': ([bad_option], 213),
'ompi-top': ([bad_option], 1),
'orte-dvm': ([spec_vers], None),
'orte-dvm': ([spec_vers], 0),
'orte-ps': ([bad_option], 213),
'orte-top': ([bad_option], 1),
'oshcc': ([comp_vers], None),
'oshfort': ([comp_vers], None),
'oshmem_info': ([spec_vers], None),
'oshrun': ([spec_vers], None),
'shmemcc': ([comp_vers], None),
'shmemfort': ([comp_vers], None),
'shmemrun': ([spec_vers], None),
'oshcc': ([comp_vers], 0),
'oshfort': ([comp_vers], 0),
'oshmem_info': ([spec_vers], 0),
'oshrun': ([spec_vers], 0),
'shmemcc': ([comp_vers], 0),
'shmemfort': ([comp_vers], 0),
'shmemrun': ([spec_vers], 0),
# Binary available in version 3.1.0 through 3.1.5
'prun': ([spec_vers], None),
'prun': ([spec_vers], 0),
# Binaries available in versions 3.0.0 through 3.1.5
'oshCC': ([comp_vers], None),
'oshc++': ([comp_vers], None),
'oshcxx': ([comp_vers], None),
'shmemCC': ([comp_vers], None),
'shmemc++': ([comp_vers], None),
'shmemcxx': ([comp_vers], None),
'oshCC': ([comp_vers], 0),
'oshc++': ([comp_vers], 0),
'oshcxx': ([comp_vers], 0),
'shmemCC': ([comp_vers], 0),
'shmemc++': ([comp_vers], 0),
'shmemcxx': ([comp_vers], 0),
}
for exe in checks:
......@@ -806,21 +806,21 @@ def _test_examples(self):
# First build the examples
work_dir = os.path.join(self.install_test_root,
self.extra_install_tests)
self.run_test('make', ['all'], [], None, False,
self.run_test('make', ['all'], [],
purpose='test build the examples', work_dir=work_dir)
# Now run those with known results
have_spml = self.spec.satisfies('@2.0.0:2.1.6')
hello_world = (['Hello, world', 'I am', '0 of', '1'], None)
hello_world = (['Hello, world', 'I am', '0 of', '1'], 0)
max_red = (['0/1 dst = 0 1 2'], None)
max_red = (['0/1 dst = 0 1 2'], 0)
missing_spml = (['No available spml components'], 1)
no_out = ([''], None)
no_out = ([''], 0)
ring_out = (['1 processes in ring', '0 exiting'], None)
ring_out = (['1 processes in ring', '0 exiting'], 0)
strided = (['not in valid range'], 255)
......@@ -850,7 +850,7 @@ def _test_examples(self):
for exe in checks:
expected, status = checks[exe]
reason = 'test {0} output'.format(exe)
self.run_test(exe, [], expected, status, installed=False,
self.run_test(exe, [], expected, status, installed=True,
purpose=reason, skip_missing=True, work_dir=work_dir)
def test(self):
......
......@@ -64,5 +64,5 @@ def setup_build_environment(self, env):
else:
env.prepend_path('LD_LIBRARY_PATH', libs)
def test(self):
def test_install(self):
python('-m', 'pytest')
......@@ -146,7 +146,7 @@ def _test_example(self):
# Ensure the database only contains one table
reason = 'test to ensure only table is "packages"'
opts = ['./data/packages.db', '.tables']
self.run_test('sqlite3', opts, 'packages', None, installed=True,
self.run_test('sqlite3', opts, 'packages', installed=True,
purpose=reason, skip_missing=False)
# Ensure the database dump matches expectations, where special
......@@ -155,16 +155,16 @@ def _test_example(self):
reason = 'test dump output'
opts = ['./data/packages.db', '.dump']
expected = _get_output('dump.out')
self.run_test('sqlite3', opts, expected, None, installed=True,
self.run_test('sqlite3', opts, expected, installed=True,
purpose=reason, skip_missing=False)
def _test_version(self):
"""Perform version check on the installed package."""
exe = 'sqlite3'
vers_str = str(self.spec.version)
reason = 'test version of {0} is {1}'.format(exe, vers_str)
self.run_test(exe, '-version', vers_str, None, installed=True,
self.run_test(exe, '-version', vers_str, installed=True,
purpose=reason, skip_missing=False)
def test(self):
......
......@@ -151,9 +151,9 @@ def _run_bench_checks(self):
['Malloc/malloc', 'Malloc/free', 'ns',
'Host/allocate', 'Host/deallocate',
'FixedPoolHost/allocate',
'FixedPoolHost/deallocate'], None),
'copy_benchmarks': (['benchmark_copy/host_host', 'ns'], None),
'debuglog_benchmarks': (['benchmark_DebugLogger', 'ns'], None),
'FixedPoolHost/deallocate'], 0),
'copy_benchmarks': (['benchmark_copy/host_host', 'ns'], 0),
'debuglog_benchmarks': (['benchmark_DebugLogger', 'ns'], 0),
}
self._run_checks(dirs, checks)
......@@ -175,8 +175,8 @@ def _run_cookbook_checks(self):
# Versions 2.0.0:2.1.0 (spack-build/bin)
# Versions 1.1.0 (prefix.bin/examples/cookbook)
# Versions 2.0.0:2.1.0 (prefix.bin)
'recipe_dynamic_pool_heuristic': (['in the pool', 'releas'], None),
'recipe_no_introspection': (['has allocated', 'used'], None),
'recipe_dynamic_pool_heuristic': (['in the pool', 'releas'], 0),
'recipe_no_introspection': (['has allocated', 'used'], 0),
}
self._run_checks(dirs, checks)
......@@ -202,9 +202,9 @@ def _run_example_checks(self):
# Versions 2.0.0:2.1.0 (spack-build/bin)
# Version 1.1.0 (prefix.bin/examples)
# Versions 2.0.0:2.1.0 (prefix.bin)
'malloc': (['99 should be 99'], None),
'strategy_example': (['Available allocators', 'HOST'], None),
'vector_allocator': ([''], None),
'malloc': (['99 should be 99'], 0),
'strategy_example': (['Available allocators', 'HOST'], 0),
'vector_allocator': ([''], 0),
}
self._run_checks(dirs, checks)
......@@ -215,7 +215,7 @@ def _run_plots_checks(self):
dirs = [self.prefix.bin] if self.spec.satisfies('@0.3.3:0.3.5') else []
checks = {
# Versions 0.3.3:0.3.5 (prefix.bin)
'plot_allocations': ([''], None),
'plot_allocations': ([''], 0),
}
self._run_checks(dirs, checks)
......@@ -226,7 +226,7 @@ def _run_tools_checks(self):
dirs = [self.prefix.bin] if self.spec.satisfies('@0.3.3:0.3.5') else []
checks = {
# Versions 0.3.3:0.3.5 (spack-build/bin/tools)
'replay': (['No input file'], None),
'replay': (['No input file'], 0),
}
self._run_checks(dirs, checks)
......@@ -251,12 +251,12 @@ def _run_tut_checks(self):
# Versions 2.0.0:2.1.0 (spack-build/bin)
# Version 1.1.0 (prefix.bin/examples/tutorial)
# Versions 2.0.0:2.1.0 (prefix.bin)
'tut_copy': (['Copied source data'], None),
'tut_copy': (['Copied source data'], 0),
'tut_introspection': (
['Allocator used is HOST', 'size of the allocation'], None),
'tut_memset': (['Set data from HOST'], None),
'tut_move': (['Moved source data', 'HOST'], None),
'tut_reallocate': (['Reallocated data'], None),
['Allocator used is HOST', 'size of the allocation'], 0),
'tut_memset': (['Set data from HOST'], 0),
'tut_move': (['Moved source data', 'HOST'], 0),
'tut_reallocate': (['Reallocated data'], 0),
}
self._run_checks(dirs, checks)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment