From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH 04/10] make: add check targets based on gtester (v2)
Date: Sat, 25 Feb 2012 13:42:43 -0600 [thread overview]
Message-ID: <1330198969-27364-5-git-send-email-aliguori@us.ibm.com> (raw)
In-Reply-To: <1330198969-27364-1-git-send-email-aliguori@us.ibm.com>
This will run all tests through gtester. The main targets are:
$ make check
Which will run each unit test and:
$ make check-report.html
Which will generate a nice HTML report of the test status.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
v1 -> v2
- fix Makefile (Paolo)
---
scripts/gtester-cat | 32 ++++++++++++++++++++++++++++
tests/Makefile | 58 ++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 87 insertions(+), 3 deletions(-)
create mode 100644 scripts/gtester-cat
diff --git a/scripts/gtester-cat b/scripts/gtester-cat
new file mode 100644
index 0000000..afd8c3e
--- /dev/null
+++ b/scripts/gtester-cat
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Copyright IBM, Corp. 2012
+#
+# Authors:
+# Anthony Liguori <aliguori@us.ibm.com>
+#
+# This work is licensed under the terms of the GNU GPLv2 or later.
+# See the COPYING file in the top-level directory.
+
+cat <<EOF
+<?xml version="1.0"?>
+<gtester>
+EOF
+
+for file in "$@"; do
+ first="yes"
+ cat $file | while read LINE; do
+ if test "$first" = "yes"; then
+ first="no"
+ continue
+ fi
+ if test "$LINE" = "<gtester>" -o "$LINE" = "</gtester>"; then
+ continue
+ fi
+ echo $LINE
+ done
+done
+
+cat<<EOF
+</gtester>
+EOF
diff --git a/tests/Makefile b/tests/Makefile
index 3c554f0..f41a00b 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,6 +2,10 @@ CHECKS = check-qdict check-qfloat check-qint check-qstring check-qlist
CHECKS += check-qjson test-qmp-output-visitor test-qmp-input-visitor
CHECKS += test-string-input-visitor test-string-output-visitor test-coroutine
+HW_TESTS=
+
+TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
+
check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
check-qint: check-qint.o qint.o $(tools-obj-y)
@@ -44,6 +48,54 @@ test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob
tests/rtc-test: tests/rtc-test.o tests/libqtest.o
-.PHONY: check
-check: $(CHECKS)
- $(call quiet-command, gtester $(CHECKS), " CHECK")
+check-help:
+ @echo "Regression targets:"
+ @echo
+ @echo " make check Run all tests"
+ @echo " make check-qtest Run qtest tests"
+ @echo " make check-unit Run qobject tests"
+ @echo " make check-report.html Generates an HTML test report"
+ @echo
+ @echo "Please note that HTML reports do not regenerate if the unit tests"
+ @echo "has not changed."
+ @echo
+ @echo "The variable SPEED can be set to control the gtester speed setting"
+
+.SECONDARY:
+
+SPEED ?= quick
+
+# Reports
+check-report-qtest-%.log: $(HW_TESTS)
+ $(call quiet-command,QTEST_QEMU_BINARY=`basename $@ .log | cut -f4 -d-`-softmmu/qemu-system-`basename $@ .log | cut -f4 -d-` \
+ gtester -k -q -o $@ -m=$(SPEED) $(HW_TESTS)," TEST $^ (`basename $@ .log | cut -f4 -d-`)")
+
+check-report-unit.log: $(CHECKS)
+ $(call quiet-command,gtester -k -q -m=$(SPEED) -o $@ $^, " TEST $^")
+
+check-report.log: check-report-unit.log $(patsubst %,check-report-qtest-%.log, $(TARGETS))
+ $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, " GEN $@")
+
+check-report.html: check-report.log
+ $(call quiet-command,gtester-report $< > $@, " GEN $@")
+
+# Check tests
+
+check-qtest-%: $(HW_TESTS)
+ @for test in $^; do \
+ arch=`echo $@ | cut -f3- -d-`; \
+ echo "Running '$$test' with qemu-system-$$arch..."; \
+ $(SRC_PATH)/scripts/qtest $$arch-softmmu/qemu-system-$$arch $$test || exit $$?; \
+ done
+
+check-qtest: $(patsubst %,check-qtest-%, $(TARGETS))
+
+check-unit: $(CHECKS)
+ @for test in $^; do \
+ echo "Running '$$test'..."; \
+ ./$$test || exit $?; \
+ done
+
+check: check-unit check-qtest
+
+.PHONY: check-help check-qtest check-unit check
--
1.7.4.1
next prev parent reply other threads:[~2012-02-25 19:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 19:42 [Qemu-devel] [PATCH 00/10] qtest: a testing framework for devices (v2) Anthony Liguori
2012-02-25 19:42 ` [Qemu-devel] [PATCH 01/10] qtest: add test framework (v2) Anthony Liguori
2012-02-25 20:19 ` Paolo Bonzini
2012-02-25 19:42 ` [Qemu-devel] [PATCH 02/10] qtest: add support for -M pc Anthony Liguori
2012-02-25 20:19 ` Paolo Bonzini
2012-02-25 21:12 ` Anthony Liguori
2012-02-25 21:21 ` Andreas Färber
2012-02-25 21:29 ` Anthony Liguori
2012-02-25 21:39 ` Paolo Bonzini
2012-02-25 19:42 ` [Qemu-devel] [PATCH 03/10] qtest: add C version of test infrastructure Anthony Liguori
2012-03-02 22:17 ` Eduardo Habkost
2012-02-25 19:42 ` Anthony Liguori [this message]
2012-02-25 19:42 ` [Qemu-devel] [PATCH 05/10] rtc: split out macros into a header file and use in test case Anthony Liguori
2012-02-25 19:42 ` [Qemu-devel] [PATCH 06/10] qtest: add rtc-test test-case (v2) Anthony Liguori
2012-02-25 20:20 ` Paolo Bonzini
2012-02-25 20:41 ` Stefan Weil
2012-02-25 19:42 ` [Qemu-devel] [PATCH 07/10] qtest: IRQ interception infrastructure (v2) Anthony Liguori
2012-02-25 20:20 ` Paolo Bonzini
2012-02-25 21:16 ` Anthony Liguori
2012-02-26 1:31 ` Andreas Färber
2012-02-26 1:34 ` Anthony Liguori
2012-02-25 19:42 ` [Qemu-devel] [PATCH 08/10] libqtest: add IRQ intercept commands Anthony Liguori
2012-02-25 19:42 ` [Qemu-devel] [PATCH 09/10] rtc-test: add IRQ intercept Anthony Liguori
2012-02-25 19:42 ` [Qemu-devel] [PATCH 10/10] qtest: add clock management Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330198969-27364-5-git-send-email-aliguori@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).