summaryrefslogtreecommitdiff
path: root/regtest
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2014-10-27 19:53:28 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2014-10-27 19:56:00 +0100
commit9f953e47a6ea92d806aeea61e227af54c889c6be (patch)
tree958f1446435a37539c292303fb8817f3c49d2c29 /regtest
parent3d840231bc6f0714da361493ef32913af2eb78d7 (diff)
regtest: Add an option to create the HTML report without absolute paths
It uses the paths as received from the command line attributes.
Diffstat (limited to 'regtest')
-rw-r--r--regtest/HTMLReport.py15
-rw-r--r--regtest/commands/create-report.py4
2 files changed, 15 insertions, 4 deletions
diff --git a/regtest/HTMLReport.py b/regtest/HTMLReport.py
index 0655e990..3423b915 100644
--- a/regtest/HTMLReport.py
+++ b/regtest/HTMLReport.py
@@ -161,11 +161,15 @@ class BackendTestResult:
def get_failed_html(self):
html = ""
for result in self._results:
- actual = os.path.abspath(os.path.join(self._outdir, self._test, result))
- expected = os.path.abspath(os.path.join(self._refsdir, self._test, result))
+ actual = os.path.join(self._outdir, self._test, result)
+ if self.config.abs_paths:
+ actual = os.path.abspath(actual)
+ expected = os.path.join(self._refsdir, self._test, result)
+ if self.config.abs_paths:
+ expected = os.path.abspath(expected)
html += "<li><a href='%s'>actual</a> <a href='%s'>expected</a> " % (actual, expected)
if self._backend.has_diff(actual):
- diff = os.path.abspath(actual + self._backend.get_diff_ext())
+ diff = actual + self._backend.get_diff_ext()
html += "<a href='%s'>diff</a> " % (diff)
if self.config.pretty_diff:
pretty_diff = create_pretty_diff(self._backend)
@@ -183,6 +187,7 @@ class TestResult:
def __init__(self, docsdir, refsdir, outdir, resultdir, results, backends):
self._refsdir = refsdir
self._outdir = outdir
+ self.config = Config()
self._test = resultdir[len(self._outdir):].lstrip('/')
self._doc = os.path.join(docsdir, self._test)
@@ -214,7 +219,9 @@ class TestResult:
html += "<li>%s " % (backend.get_name())
stderr = self._results[backend].get_stderr()
if os.path.exists(stderr):
- html += "<a href='%s'>stderr</a>" % (os.path.abspath(stderr))
+ if self.config.abs_paths:
+ stderr = os.path.abspath(stderr)
+ html += "<a href='%s'>stderr</a>" % (stderr)
html += "</li>\n%s" % (backend_html)
if html:
diff --git a/regtest/commands/create-report.py b/regtest/commands/create-report.py
index e356cf90..ab37d080 100644
--- a/regtest/commands/create-report.py
+++ b/regtest/commands/create-report.py
@@ -43,11 +43,15 @@ class CreateReport(Command):
parser.add_argument('-n', '--no-browser',
action = 'store_false', dest = 'launch_browser', default = True,
help = 'Do not launch a web browser with the results')
+ parser.add_argument('--no-absolute-paths',
+ action = 'store_false', dest = 'use_abs_paths', default = True,
+ help = 'Do use absolute paths in the generated HTML')
parser.add_argument('tests')
def run(self, options):
config = Config()
config.pretty_diff = options['pretty_diff']
+ config.abs_paths = options['use_abs_paths']
doc = options['tests']
if os.path.isdir(doc):