summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-18 13:31:20 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-18 13:31:20 -0400
commit1bec95dbb31f75fa5ba4e43d2ef5e0d4f0f7460d (patch)
tree1286255371f8dfa3171a9a27b2d63e7b0883e5f5
parenta804dc133f0a3ad59d85052bb702530fe4e35751 (diff)
Generate a TAP file for the unit tests
-rwxr-xr-xmeson2tap73
-rwxr-xr-xruntests7
2 files changed, 79 insertions, 1 deletions
diff --git a/meson2tap b/meson2tap
new file mode 100755
index 0000000..9f72610
--- /dev/null
+++ b/meson2tap
@@ -0,0 +1,73 @@
+#!/usr/bin/env ruby
+require 'yaml'
+
+def indent(para, depth)
+ pfix = " "*depth
+ return para.lines.map{|line|pfix+line}.join
+end
+
+def bail(reason)
+ abort("Bail out! #{reason}")
+end
+
+puts "TAP version 13"
+section = nil
+yblock = nil
+plan = nil
+head = ""
+STDIN.each_line do |line|
+ if section.nil?
+ case line.chomp
+ when /^--- (.*) ---$/
+ section = $1
+ yblock[section] = ""
+ when /^\s*$/
+ # ignore
+ when /^\s*([0-9]+)\/([0-9]+) (.*\S)\s+(OK|FAIL|SKIP)\s+(\S* \S*) (.*)$/
+ n = $1
+ m = $2
+ if plan.nil?
+ puts "1..#{m}"
+ plan = m
+ print head
+ elsif m != plan
+ bail("m:#{m} != plan:#{plan}")
+ end
+ name = $3
+ result = $4
+ duration = $5
+ comment = $6
+ case result
+ when "OK"
+ puts "ok #{n} #{name}"
+ when "FAIL"
+ puts "not ok #{n} #{name}"
+ when "SKIP"
+ puts "ok #{n} #{name} # SKIP"
+ else
+ bail("unparsable line: #{line}")
+ end
+ yblock = {}
+ yblock['_duration'] = duration
+ yblock['_exitstatus'] = comment
+ else
+ if plan.nil?
+ head += "# #{line}"
+ else
+ print "# #{line}"
+ end
+ end
+ else
+ case line.chomp
+ when "-------"
+ puts indent(YAML::dump(yblock), 4)
+ yblock = nil
+ section = nil
+ when /^--- (.*) ---$/
+ section = $1
+ yblock[section] = ""
+ else
+ yblock[section] += line
+ end
+ end
+end
diff --git a/runtests b/runtests
index 8799321..c648e6d 100755
--- a/runtests
+++ b/runtests
@@ -39,7 +39,7 @@ ${WORKDIR}/.COMMIT.mk: ${WORKDIR}/systemd.git
check: ${WORKDIR}/build-232/pkgdest
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.log
-check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.log
+check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.tap
.PHONY: check
# osi-mk base images ###########################################################
@@ -210,3 +210,8 @@ ${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw
EOF
mv -T -- '$@.tmp' '$@'
touch -- '$@'
+%/sd-tests-unit.testlog.txt: %/sd-tests-unit.raw %/sd-tests-unit.log
+ ./osi-extract '$<' /var/lib/archbuild/default/testuser/build/systemd/src/build/meson-logs/testlog.txt '$@'
+
+%.tap: %.testlog.txt
+ ./meson2tap < '$<' > '$@'