ci: Add the backend to the reports

We want the test names in the junit xml to be
unique across all the tests in a job, so we need
to include the backend in the test name.

And we also want to see the used backend in
the html report.
This commit is contained in:
Matthias Clasen 2020-05-15 19:49:18 -04:00
parent 5870f1c90a
commit 01bd6cfd17
3 changed files with 14 additions and 4 deletions

View File

@ -138,12 +138,13 @@ ul.images li {
</head> </head>
<body> <body>
<header> <header>
<h1>{{ report.project_name }}/{{ report.branch_name }} :: Test Reports</h1> <h1>{{ report.project_name }}/{{ report.backend }}/{{ report.branch_name }} :: Test Reports</h1>
</header> </header>
<article> <article>
<section> <section>
<div class="report-meta"> <div class="report-meta">
<p><strong>Backend:</strong> {{ report.backend }}</p>
<p><strong>Branch:</strong> {{ report.branch_name }}</p> <p><strong>Branch:</strong> {{ report.branch_name }}</p>
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p> <p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %} {% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
@ -259,6 +260,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into an HT
aparser.add_argument('--project-name', metavar='NAME', aparser.add_argument('--project-name', metavar='NAME',
help='The project name', help='The project name',
default='Unknown') default='Unknown')
aparser.add_argument('--backend', metavar='NAME',
help='The used backend',
default='unknown')
aparser.add_argument('--job-id', metavar='ID', aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report', help='The job ID for the report',
default=None) default=None)
@ -319,6 +323,7 @@ report = {}
report['date'] = datetime.datetime.utcnow() report['date'] = datetime.datetime.utcnow()
report['locale_date'] = report['date'].strftime("%c") report['locale_date'] = report['date'].strftime("%c")
report['project_name'] = args.project_name report['project_name'] = args.project_name
report['backend'] = args.backend
report['job_id'] = args.job_id report['job_id'] = args.job_id
report['branch_name'] = args.branch report['branch_name'] = args.branch
report['total_successes'] = 0 report['total_successes'] = 0

View File

@ -19,6 +19,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUn
aparser.add_argument('--project-name', metavar='NAME', aparser.add_argument('--project-name', metavar='NAME',
help='The project name', help='The project name',
default='unknown') default='unknown')
aparser.add_argument('--backend', metavar='NAME',
help='The used backend',
default='unknown')
aparser.add_argument('--job-id', metavar='ID', aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report', help='The job ID for the report',
default='Unknown') default='Unknown')
@ -92,18 +95,18 @@ for name, units in suites.items():
for unit in successes: for unit in successes:
testcase = ET.SubElement(testsuite, 'testcase') testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite'])) testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name']) testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
testcase.set('time', str(unit['duration'])) testcase.set('time', str(unit['duration']))
for unit in failures: for unit in failures:
testcase = ET.SubElement(testsuite, 'testcase') testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite'])) testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name']) testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
testcase.set('time', str(unit['duration'])) testcase.set('time', str(unit['duration']))
failure = ET.SubElement(testcase, 'failure') failure = ET.SubElement(testcase, 'failure')
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite'])) failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
failure.set('name', unit['name']) testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
failure.set('type', 'error') failure.set('type', 'error')
failure.text = unit['stdout'] failure.text = unit['stdout']

View File

@ -61,11 +61,13 @@ cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \ $srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \ --project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \ --job-id="${CI_JOB_NAME}" \
--output=report-${backend}.xml \ --output=report-${backend}.xml \
meson-logs/testlog-${backend}.json meson-logs/testlog-${backend}.json
$srcdir/.gitlab-ci/meson-html-report.py \ $srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \ --project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \ --job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \ --reftest-output-dir="testsuite/reftests/output/${backend}" \
--output=report-${backend}.html \ --output=report-${backend}.html \