summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Le Marre <dev@wismill.eu>2023-04-27 14:59:30 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2023-04-27 23:42:20 +0000
commit4669e788a42664e84e12ce1c8e12fbda6d947814 (patch)
treec347456758d177079d8cbf380e25f73a9400025a
parent59fbdb519b0c2e0dfc53bb8a2edb8855f7ccb4c3 (diff)
downloadxkeyboard-config-4669e788a42664e84e12ce1c8e12fbda6d947814.tar.gz
CI: fix yaml-to-junit-xml script
Additionally, report successful tests count.
-rw-r--r--.gitlab-ci.yml7
-rwxr-xr-x.gitlab-ci/yaml-to-junit-xml.py14
2 files changed, 18 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fb520f3..6a944dd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -226,7 +226,12 @@ layout_tests:
after_script:
- echo "Failed keymap compilations:"
- yq -c ".[] | select(.status != 0) | .cmd, .error" $INSTDIR/keymaps-failed.yaml
- - .gitlab-ci/yaml-to-junit-xml.py $INSTDIR/keymaps-failed.yaml > junit-results.xml
+ - successful_tests=$(yq ". | length" "$INSTDIR/keymaps-success.yaml")
+ - >
+ .gitlab-ci/yaml-to-junit-xml.py \
+ --additional-successful-tests $successful_tests \
+ "$INSTDIR/keymaps-failed.yaml" \
+ > junit-results.xml
- xz -z "$INSTDIR/keymaps-success.yaml"
- xz -z "$INSTDIR/keymaps-failed.yaml"
variables:
diff --git a/.gitlab-ci/yaml-to-junit-xml.py b/.gitlab-ci/yaml-to-junit-xml.py
index 4e1f8a4..d215299 100755
--- a/.gitlab-ci/yaml-to-junit-xml.py
+++ b/.gitlab-ci/yaml-to-junit-xml.py
@@ -16,14 +16,24 @@ parser.add_argument(
type=pathlib.Path,
help="The YAML output file from the keyboard layout tester",
)
+parser.add_argument(
+ "--additional-successful-tests",
+ type=int,
+ default=0,
+ help="Number of successful tests from another source",
+)
args = parser.parse_args()
if not args.inputfile.exists():
print(f"No such file: {args.inputfile}")
sys.exit(0)
-with open(args.inputfile) as fd:
+with args.inputfile.open() as fd:
yml = yaml.safe_load(fd)
+ # Ensure there is a yaml document
+ if yml is None:
+ yml = yaml.safe_load("[]")
+
doc = minidom.Document()
suite = doc.createElement("testsuite")
suite.setAttribute("name", "XKB layout compilation tests")
@@ -33,7 +43,7 @@ with open(args.inputfile) as fd:
# and errors (something else blew up)
# We use failures for unrecognized keysyms and errors
# for everything else (i.e. keymap compilation errors)
- ntests, nfailures, nerrors = 0, 0, 0
+ ntests, nfailures, nerrors = args.additional_successful_tests, 0, 0
for testcase in yml:
ntests += 1