tests/bugfix: Fix and clean up copied example checks (#23276)
This commit is contained in:
parent
066d33b4b3
commit
00fe243e9c
1 changed files with 31 additions and 11 deletions
|
@ -949,14 +949,29 @@ def _test_check_versions(self):
|
|||
self.run_test(exe, '--version', expected, installed=True,
|
||||
purpose=purpose, skip_missing=True)
|
||||
|
||||
def _test_examples(self):
|
||||
# First build the examples
|
||||
self.run_test('make', ['all'], [],
|
||||
purpose='test: ensuring ability to build the examples',
|
||||
work_dir=join_path(self.install_test_root,
|
||||
self.extra_install_tests))
|
||||
def _test_build_examples(self):
|
||||
# Build the examples copied during installation and return "status"
|
||||
reason = 'test: ensuring ability to build the examples'
|
||||
return self.run_test('make', ['all'], [],
|
||||
purpose=reason,
|
||||
work_dir=join_path(self.install_test_root,
|
||||
self.extra_install_tests))
|
||||
|
||||
# Now run those with known results
|
||||
def _test_clean_examples(self):
|
||||
# Clean up any example build files
|
||||
reason = 'test: ensuring copied examples cleaned up'
|
||||
return self.run_test('make', ['clean'], [],
|
||||
purpose=reason,
|
||||
work_dir=join_path(self.install_test_root,
|
||||
self.extra_install_tests))
|
||||
|
||||
def _test_examples(self):
|
||||
# First ensure can build copied examples
|
||||
if not self._test_build_examples():
|
||||
self._test_clean_examples()
|
||||
return
|
||||
|
||||
# Now run examples with known, simple-to-verify results
|
||||
have_spml = self.spec.satisfies('@2.0.0:2.1.6')
|
||||
|
||||
hello_world = (['Hello, world', 'I am', '0 of', '1'], 0)
|
||||
|
@ -995,10 +1010,15 @@ def _test_examples(self):
|
|||
}
|
||||
|
||||
for exe in checks:
|
||||
expected = checks[exe]
|
||||
reason = 'test: checking example {0} output'.format(exe)
|
||||
self.run_test(exe, [], expected, 0, installed=True,
|
||||
purpose=reason, skip_missing=True)
|
||||
expected, status = checks[exe]
|
||||
reason = 'test: checking {0} example output and status ({1})' \
|
||||
.format(exe, status)
|
||||
self.run_test(exe, [], expected, status, installed=False,
|
||||
purpose=reason, skip_missing=True,
|
||||
work_dir=join_path(self.install_test_root,
|
||||
self.extra_install_tests))
|
||||
|
||||
self._test_clean_examples()
|
||||
|
||||
def test(self):
|
||||
"""Perform smoke tests on the installed package."""
|
||||
|
|
Loading…
Reference in a new issue