From patchwork Tue Jan 10 19:10:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 135283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4E099B6FCB for ; Wed, 11 Jan 2012 06:12:01 +1100 (EST) Received: from localhost ([::1]:54106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh70-0000cv-6G for incoming@patchwork.ozlabs.org; Tue, 10 Jan 2012 14:11:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:60028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh6r-0000cC-8S for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkh6l-0006D8-1D for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:11:49 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:35949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh6k-0006Cx-PB for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:11:42 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Jan 2012 12:11:41 -0700 Received: from d03relay04.boulder.ibm.com (9.17.195.106) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Jan 2012 12:11:40 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0AJBOGi134924 for ; Tue, 10 Jan 2012 12:11:24 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0AJBNju012430 for ; Tue, 10 Jan 2012 12:11:23 -0700 Received: from titi.austin.rr.com ([9.57.66.237]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0AJAuFr011135; Tue, 10 Jan 2012 12:11:20 -0700 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Tue, 10 Jan 2012 13:10:55 -0600 Message-Id: <1326222656-26588-14-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1326222656-26588-1-git-send-email-aliguori@us.ibm.com> References: <1326222656-26588-1-git-send-email-aliguori@us.ibm.com> x-cbid: 12011019-4242-0000-0000-00000079B9AF X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.160 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 14/15] make: add check targets based on gtester X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- scripts/gtester-cat | 32 ++++++++++++++++++++++++++++ tests/Makefile | 58 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 87 insertions(+), 3 deletions(-) create mode 100755 scripts/gtester-cat diff --git a/scripts/gtester-cat b/scripts/gtester-cat new file mode 100755 index 0000000..afd8c3e --- /dev/null +++ b/scripts/gtester-cat @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright IBM, Corp. 2012 +# +# Authors: +# Anthony Liguori +# +# This work is licensed under the terms of the GNU GPLv2 or later. +# See the COPYING file in the top-level directory. + +cat < + +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" = "" -o "$LINE" = ""; then + continue + fi + echo $LINE + done +done + +cat< +EOF diff --git a/tests/Makefile b/tests/Makefile index 0005764..63b835d 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-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) @@ -35,6 +39,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) - gtester $(CHECKS) +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