From e06e7bbf5967f7908445d067a767f1908725d641 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 18 Aug 2018 14:19:41 -0400 Subject: convert integration test log to TAP --- integration2tap | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ runtests | 15 ++++++++------ 2 files changed, 70 insertions(+), 6 deletions(-) create mode 100755 integration2tap diff --git a/integration2tap b/integration2tap new file mode 100755 index 0000000..bea8123 --- /dev/null +++ b/integration2tap @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# 2018 Luke Shumaker + +test='' +output='' +is_tap=maybe +while read -r line; do + if [[ $line = '--x-- '*' --x--' ]]; then + is_tap=false + msg=${line#'--x-- '} + msg=${msg%' --x--'} + case "$msg" in + 'Running '*) + test=${msg#'Running '} + output="$line"$'\n' + ;; + 'Result of '*) + output+="$line"$'\n' + result=${msg##*:} + n=${test#TEST-} + n=${n%%-*} + if (( result == 0 )); then + printf 'ok %d %s\n' "${n#0}" "$test" + else + printf 'not ok %d %s\n' "${n#0}" "$test" + fi + printf '%s' "$output" | sed 's/^/# /' + test='' + output='' + ;; + esac + else + if [[ $is_tap = maybe && ( $line = TAP* || $line = 1..* ) ]]; then + # Maybe I'll convince upstream to emit TAP... + printf '%s\n' "$line" + sed '$d' + exit 0 + fi + if [[ -n $test ]]; then + output+="$line"$'\n' + else + case "$line" in + 'ALL '*' TESTS PASSED') + m=${line#'ALL '} + m=${m%%' '*} + printf '1..%d\n' "${m#0}" + exit 0 + :;; + 'TOTAL FAILURES: '*' OF '*) + m=${line##*' '} + printf '1..%d\n' "${m#0}" + exit 0 + :;; + *) + : # discard + ;; + esac + fi + fi +done < <(sed 's/\r$//' | cat -v) +echo 'Bail out!' diff --git a/runtests b/runtests index c648e6d..839b670 100755 --- a/runtests +++ b/runtests @@ -25,7 +25,7 @@ SHELL = bash .PHONY: FORCE -# git ########################################################################## +# git and phony targets ######################################################## ${WORKDIR}/systemd.git: FORCE mkdir -p -- '$(@D)' gitget bare https://git.parabola.nu/~lukeshu/systemd.git '$@' @@ -36,11 +36,12 @@ ${WORKDIR}/.COMMIT.mk: ${WORKDIR}/systemd.git ( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@' -include ${WORKDIR}/.COMMIT.mk -check: ${WORKDIR}/build-232/pkgdest -check: ${WORKDIR}/build-$(COMMIT)/pkgdest -check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.log +build: ${WORKDIR}/build-$(COMMIT)/pkgdest +check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.tap check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.tap -.PHONY: check +.PHONY: build check + +check: ${WORKDIR}/build-232/pkgdest # osi-mk base images ########################################################### ${WORKDIR}/base.raw: osi-mk.d/systemd-osi-shell.sh @@ -174,10 +175,12 @@ ${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw export INITRD=/boot/initramfs-linux-libre-fallback.img sed -i /SKIP_INITRD=yes/d /build/systemd/src/systemd/test/TEST-*/test.sh # Parabola (& Debian) kernels don't support SKIP_INITRD cd /build/systemd/src/systemd - ./test/run-integration-tests.sh setup run clean '$@' %/sd-tests-unit.raw: %/sd-tests.raw rm -f -- '$@' '$@.tmp' -- cgit v1.2.2