Add test case for CDash reporting

This commit is contained in:
Zack Galbreath 2018-04-19 15:22:26 -04:00 committed by Todd Gamblin
parent 218331552c
commit 49e37a5ecf

View File

@ -37,6 +37,8 @@
from spack.spec import Spec
from spack.main import SpackCommand
from six.moves.urllib.error import HTTPError, URLError
install = SpackCommand('install')
@ -395,3 +397,43 @@ def test_extra_files_are_archived():
errors_txt = os.path.join(archive_dir, 'errors.txt')
assert os.path.exists(errors_txt)
@pytest.mark.disable_clean_stage_check
def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery,
capfd, conflict_spec):
# capfd interferes with Spack's capturing
with capfd.disabled():
with tmpdir.as_cwd():
with pytest.raises(SpackError):
install(
'--log-format=cdash',
'--log-file=cdash_reports',
conflict_spec)
report_dir = tmpdir.join('cdash_reports')
assert report_dir in tmpdir.listdir()
report_file = report_dir.join('Update.xml')
assert report_file in report_dir.listdir()
content = report_file.open().read()
assert '<UpdateReturnStatus>Conflicts in concretized spec' \
in content
@pytest.mark.disable_clean_stage_check
def test_cdash_upload_build_error(tmpdir, mock_fetch, install_mockery,
capfd):
# capfd interferes with Spack's capturing
with capfd.disabled():
with tmpdir.as_cwd():
with pytest.raises((HTTPError, URLError)):
install(
'--log-format=cdash',
'--log-file=cdash_reports',
'--cdash-upload-url=http://localhost/fakeurl/submit.php?project=Spack',
'build-error')
report_dir = tmpdir.join('cdash_reports')
assert report_dir in tmpdir.listdir()
report_file = report_dir.join('Build.xml')
assert report_file in report_dir.listdir()
content = report_file.open().read()
assert '<Text>configure: error: in /path/to/some/file:</Text>' in content