From bc8bb9dfaf2aab90665f39a56af942e13a9a58bc Mon Sep 17 00:00:00 2001
From: Zack Galbreath <zack.galbreath@kitware.com>
Date: Thu, 11 Oct 2018 01:29:14 -0400
Subject: [PATCH] Make CDash reporting easier to use (#9357)

* Better default CLI arguments for CDash reporting

--log-format=cdash is now implied if you specify the --cdash-upload-url
option to spack install.

We also now default to writing CTest XML files to cdash_report/ when using
the CDash reporter if no --log-file argument was specified.

* Improved documentation on how to use the CDash reporter
---
 lib/spack/spack/report.py          |  6 +++++-
 lib/spack/spack/reporters/cdash.py | 12 +++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/spack/spack/report.py b/lib/spack/spack/report.py
index dc68b5e583..fca15b126a 100644
--- a/lib/spack/spack/report.py
+++ b/lib/spack/spack/report.py
@@ -254,7 +254,11 @@ class collect_info(object):
     """
     def __init__(self, format_name, install_command, cdash_upload_url):
         self.filename = None
-        self.format_name = format_name
+        if cdash_upload_url:
+            self.format_name = 'cdash'
+            self.filename = 'cdash_report'
+        else:
+            self.format_name = format_name
         # Check that the format is valid.
         if self.format_name not in valid_formats:
             raise ValueError('invalid report type: {0}'
diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py
index eeb1224fc7..9d00e60b20 100644
--- a/lib/spack/spack/reporters/cdash.py
+++ b/lib/spack/spack/reporters/cdash.py
@@ -58,7 +58,17 @@
 
 
 class CDash(Reporter):
-    """Generate reports of spec installations for CDash."""
+    """Generate reports of spec installations for CDash.
+
+    To use this reporter, pass the ``--cdash-upload-url`` argument to
+    ``spack install``::
+
+        spack install --cdash-upload-url=\\
+            https://mydomain.com/cdash/submit.php?project=Spack <spec>
+
+    In this example, results will be uploaded to the *Spack* project on the
+    CDash instance hosted at https://mydomain.com/cdash.
+    """
 
     def __init__(self, install_command, cdash_upload_url):
         Reporter.__init__(self, install_command, cdash_upload_url)
-- 
GitLab