summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2018-04-19 15:22:26 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2018-05-15 05:43:07 -0700
commit49e37a5ecf11cdfa32ce3add099a77453ee6387e (patch)
treec7f5862bafd463bf896ade2685d05fcfb800e4a2 /lib
parent218331552cd4693246059aa25fbb285091037886 (diff)
downloadspack-49e37a5ecf11cdfa32ce3add099a77453ee6387e.tar.gz
spack-49e37a5ecf11cdfa32ce3add099a77453ee6387e.tar.bz2
spack-49e37a5ecf11cdfa32ce3add099a77453ee6387e.tar.xz
spack-49e37a5ecf11cdfa32ce3add099a77453ee6387e.zip
Add test case for CDash reporting
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/cmd/install.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py
index 12e933a842..5b81e37e8a 100644
--- a/lib/spack/spack/test/cmd/install.py
+++ b/lib/spack/spack/test/cmd/install.py
@@ -37,6 +37,8 @@ from spack.error import SpackError
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