summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gmail.com>2022-05-25 12:22:03 +0000
committerEmmanuele Bassi <ebassi@gmail.com>2022-05-25 12:22:03 +0000
commitaff04305c4ded8e128b0bd92ccf93e5b97b54d6a (patch)
tree7c1984c991f513ffa09998348af4d6cbd8a9816b
parent587b1559aecd51a1fb9f34e62a10e4802cb3400d (diff)
parentc8ce3786d703ae5ef3f3776e7ba798296de4e192 (diff)
downloadglib-aff04305c4ded8e128b0bd92ccf93e5b97b54d6a.tar.gz
Merge branch 'junit' into 'main'
gitlab-ci: remove meson-junit-report.py conversion See merge request GNOME/glib!2686
-rw-r--r--.gitlab-ci.yml22
-rwxr-xr-x.gitlab-ci/meson-junit-report.py125
-rwxr-xr-x.gitlab-ci/run-tests.sh6
-rw-r--r--.gitlab-ci/test-msvc.bat5
-rwxr-xr-x.gitlab-ci/test-msys2.sh6
5 files changed, 11 insertions, 153 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ee731b1fb..b84ea52f8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -88,7 +88,7 @@ fedora-x86_64:
- lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -130,7 +130,7 @@ debian-stable-x86_64:
- .gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -197,7 +197,7 @@ G_DISABLE_ASSERT:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -234,7 +234,7 @@ valgrind:
allow_failure: true
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -275,7 +275,7 @@ cross-mingw64:
- ninja -C _build
artifacts:
reports:
- junit: "_build/${env:CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -303,7 +303,7 @@ msys2-mingw32:
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
artifacts:
reports:
- junit: "_build/${env:CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -327,7 +327,7 @@ vs2017-x64:
--python.purelibdir=C:\Python37\site-packages
artifacts:
reports:
- junit: "_build/${env:CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -356,7 +356,7 @@ vs2017-x64-static:
--python.purelibdir=C:\Python37\site-packages
artifacts:
reports:
- junit: "_build/${env:CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -400,7 +400,7 @@ freebsd-12-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -428,7 +428,7 @@ freebsd-13-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -466,7 +466,7 @@ macos:
- .gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/${CI_JOB_NAME}-report.xml"
+ junit: "_build/meson-logs/testlog.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
diff --git a/.gitlab-ci/meson-junit-report.py b/.gitlab-ci/meson-junit-report.py
deleted file mode 100755
index 1d57ead50..000000000
--- a/.gitlab-ci/meson-junit-report.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python3
-
-# Turns a Meson testlog.json file into a JUnit XML report
-#
-# Copyright 2019 GNOME Foundation
-#
-# SPDX-License-Identifier: LGPL-2.1-or-later
-#
-# Original author: Emmanuele Bassi
-
-import argparse
-import datetime
-import json
-import sys
-import xml.etree.ElementTree as ET
-
-aparser = argparse.ArgumentParser(
- description="Turns a Meson test log into a JUnit report"
-)
-aparser.add_argument(
- "--project-name", metavar="NAME", help="The project name", default="unknown"
-)
-aparser.add_argument(
- "--job-id", metavar="ID", help="The job ID for the report", default="Unknown"
-)
-aparser.add_argument(
- "--branch",
- metavar="NAME",
- help="Branch of the project being tested",
- default="main",
-)
-aparser.add_argument(
- "--output",
- metavar="FILE",
- help="The output file, stdout by default",
- type=argparse.FileType("w", encoding="UTF-8"),
- default=sys.stdout,
-)
-aparser.add_argument(
- "infile",
- metavar="FILE",
- help="The input testlog.json, stdin by default",
- type=argparse.FileType("r", encoding="UTF-8"),
- default=sys.stdin,
-)
-
-args = aparser.parse_args()
-
-outfile = args.output
-
-testsuites = ET.Element("testsuites")
-testsuites.set("id", "{}/{}".format(args.job_id, args.branch))
-testsuites.set("package", args.project_name)
-testsuites.set("timestamp", datetime.datetime.utcnow().isoformat())
-
-suites = {}
-for line in args.infile:
- data = json.loads(line)
- (full_suite, unit_name) = data["name"].split(" / ")
- try:
- (project_name, suite_name) = full_suite.split(":")
- except ValueError:
- project_name = full_suite
- suite_name = full_suite
-
- duration = data["duration"]
- return_code = data["returncode"]
- log = data["stdout"]
- log_stderr = data.get("stderr", "")
-
- unit = {
- "suite": suite_name,
- "name": unit_name,
- "duration": duration,
- "returncode": return_code,
- "stdout": log,
- "stderr": log_stderr,
- }
-
- units = suites.setdefault(suite_name, [])
- units.append(unit)
-
-for name, units in suites.items():
- print("Processing suite {} (units: {})".format(name, len(units)))
-
- def if_failed(unit):
- if unit["returncode"] != 0:
- return True
- return False
-
- def if_succeded(unit):
- if unit["returncode"] == 0:
- return True
- return False
-
- successes = list(filter(if_succeded, units))
- failures = list(filter(if_failed, units))
- print(" - {}: {} pass, {} fail".format(name, len(successes), len(failures)))
-
- testsuite = ET.SubElement(testsuites, "testsuite")
- testsuite.set("name", "{}/{}".format(args.project_name, name))
- testsuite.set("tests", str(len(units)))
- testsuite.set("errors", str(len(failures)))
- testsuite.set("failures", str(len(failures)))
-
- for unit in successes:
- testcase = ET.SubElement(testsuite, "testcase")
- testcase.set("classname", "{}/{}".format(args.project_name, unit["suite"]))
- testcase.set("name", unit["name"])
- testcase.set("time", str(unit["duration"]))
-
- for unit in failures:
- testcase = ET.SubElement(testsuite, "testcase")
- testcase.set("classname", "{}/{}".format(args.project_name, unit["suite"]))
- testcase.set("name", unit["name"])
- testcase.set("time", str(unit["duration"]))
-
- failure = ET.SubElement(testcase, "failure")
- failure.set("classname", "{}/{}".format(args.project_name, unit["suite"]))
- failure.set("name", unit["name"])
- failure.set("type", "error")
- failure.text = unit["stdout"] + "\n" + unit["stderr"]
-
-output = ET.tostring(testsuites, encoding="unicode")
-outfile.write(output)
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index b545a6f3c..52461ca10 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -20,10 +20,4 @@ meson test \
exit_code=$?
-python3 .gitlab-ci/meson-junit-report.py \
- --project-name=glib \
- --job-id "${CI_JOB_NAME}" \
- --output "_build/${CI_JOB_NAME}-report.xml" \
- "${log_file}"
-
exit $exit_code
diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat
index 55bc71bf2..37976d4d0 100644
--- a/.gitlab-ci/test-msvc.bat
+++ b/.gitlab-ci/test-msvc.bat
@@ -21,11 +21,6 @@ meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --no-s
:: FIXME: can we get code coverage support?
-
-python "%CD%\.gitlab-ci\meson-junit-report.py" --project-name glib ^
---job-id "%CI_JOB_NAME%" --output "%CD%/_build/%CI_JOB_NAME%-report.xml" ^
-"%CD%/_build/meson-logs/testlog.json"
-
goto :EOF
:error
exit /b 1
diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh
index fbfbbcdcf..85ed88f3f 100755
--- a/.gitlab-ci/test-msys2.sh
+++ b/.gitlab-ci/test-msys2.sh
@@ -53,12 +53,6 @@ lcov \
# FIXME: fix the test suite
meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky || true
-python3 "${DIR}"/.gitlab-ci/meson-junit-report.py \
- --project-name glib \
- --job-id "${CI_JOB_NAME}" \
- --output "${DIR}/_build/${CI_JOB_NAME}-report.xml" \
- "${DIR}/_build/meson-logs/testlog.json"
-
lcov \
--quiet \
--config-file "${DIR}"/.lcovrc \