Skip to contentSkip to conversation

test: replace gtester with a TAP driver

PATCH In review Paolo Bonzini 4 participants 13 messages Dec 6, 2018 – Jul 3, 2019

lore
Share & tools
lore
#0 lore raw

v2 cover test: replace gtester with a TAP driver

gtester is deprecated by upstream glib[1] and it does not support tests that call g_test_skip in some glib stable releases.

glib suggests instead using Automake's TAP support. We do not support Automake, but we can copy the code that beautifies the TAP output and use it. I chose to use the Perl copy rather than the shell/awk one in order to reuse Perl's TAP parsing package.

Thanks,

Paolo

[1] https://blog.gtk.org/2018/07/11/news-from-glib-2-58/

Paolo Bonzini (2):
test: execute g_test_run when tests are skipped
test: replace gtester with a TAP driver

 scripts/gtester-cat                          |  26 --
 scripts/tap-driver.pl                        | 377 +++++++++++++++++++
 scripts/tap-merge.pl                         | 110 ++++++
 tests/Makefile.include                       |  54 +--
 tests/cdrom-test.c                           |   2 +-
 tests/docker/dockerfiles/centos7.docker      |   1 +
 tests/docker/dockerfiles/debian-amd64.docker |   1 +
 tests/docker/dockerfiles/debian-ports.docker |   1 +
 tests/docker/dockerfiles/debian-sid.docker   |   1 +
 tests/docker/dockerfiles/debian8.docker      |   1 +
 tests/docker/dockerfiles/debian9.docker      |   1 +
 tests/docker/dockerfiles/fedora.docker       |   1 +
 tests/docker/dockerfiles/ubuntu.docker       |   1 +
 tests/migration-test.c                       |   8 +-
 14 files changed, 533 insertions(+), 52 deletions(-)
 delete mode 100755 scripts/gtester-cat
 create mode 100755 scripts/tap-driver.pl
 create mode 100755 scripts/tap-merge.pl
Signature · 1 line
2.19.2
#1 lore raw

PATCH v2 1/2 test: execute g_test_run when tests are skipped

Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped.

---
 tests/cdrom-test.c     | 2 +-
 tests/migration-test.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
tests/cdrom-test.c +1 -1
index 9b43dc9ab4..14bd981336 100644
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
 
     if (exec_genisoimg(genisocheck)) {
         /* genisoimage not available - so can't run tests */
-        return 0;
+        return g_test_run();
     }
 
     ret = prepare_image(arch, isoimage);
tests/migration-test.c +4 -4
index 06ca5068d8..8352612364 100644
@@ -789,7 +789,7 @@ int main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
 
     if (!ufd_version_check()) {
-        return 0;
+        return g_test_run();
     }
 
     /*
@@ -800,7 +800,7 @@ int main(int argc, char **argv)
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         access("/sys/module/kvm_hv", F_OK)) {
         g_test_message("Skipping test: kvm_hv not available");
-        return 0;
+        return g_test_run();
     }
 
     /*
@@ -811,11 +811,11 @@ int main(int argc, char **argv)
 #if defined(HOST_S390X)
         if (access("/dev/kvm", R_OK | W_OK)) {
             g_test_message("Skipping test: kvm not available");
-            return 0;
+            return g_test_run();
         }
 #else
         g_test_message("Skipping test: Need s390x host to work properly");
-        return 0;
+        return g_test_run();
 #endif
     }
 
Signature · 1 line
2.19.2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] test: execute g_test_run when tests are skipped

Quoted 50 lines · Paolo Bonzini

Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped.

---
 tests/cdrom-test.c     | 2 +-
 tests/migration-test.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
tests/cdrom-test.c +1 -1
index 9b43dc9ab4..14bd981336 100644
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
 
     if (exec_genisoimg(genisocheck)) {
         /* genisoimage not available - so can't run tests */
-        return 0;
+        return g_test_run();
     }
 
     ret = prepare_image(arch, isoimage);
tests/migration-test.c +2 -2
index 06ca5068d8..8352612364 100644
@@ -789,7 +789,7 @@ int main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
 
     if (!ufd_version_check()) {
-        return 0;
+        return g_test_run();
     }
 
     /*
@@ -800,7 +800,7 @@ int main(int argc, char **argv)
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
         access("/sys/module/kvm_hv", F_OK)) {
         g_test_message("Skipping test: kvm_hv not available");
-        return 0;
+        return g_test_run();
     }
 
     /*

tests/migration-test.c int main(int argc, char **argv) · line 817

Quoted 8 lines
tests/migration-test.c +1 -1
@@ -811,11 +811,11 @@ int main(int argc, char **argv)
 #if defined(HOST_S390X)
         if (access("/dev/kvm", R_OK | W_OK)) {
             g_test_message("Skipping test: kvm not available");
-            return 0;
+            return g_test_run();
         }
 #else
         g_test_message("Skipping test: Need s390x host to work properly");

TODO: Switch these skip messages to g_test_skip() now that we do not have to deal with broken gtester binaries anymore... (could be done in a future patch, though)

Thomas

#3 lore raw

PATCH v2 2/2 test: replace gtester with a TAP driver

In reply to Paolo Bonzini

gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases.

glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl.

---
v1->v2: show failures even in non-verbose mode
show executable name next to PASS/FAIL
tweak colored output
improved support for "make -k check"
switch license blurb to https
support TAP version line
removed Eamcs epilogs

 scripts/gtester-cat                          |  26 --
 scripts/tap-driver.pl                        | 378 +++++++++++++++++++
 scripts/tap-merge.pl                         | 110 ++++++
 tests/Makefile.include                       |  54 +--
 tests/docker/dockerfiles/centos7.docker      |   1 +
 tests/docker/dockerfiles/debian-amd64.docker |   1 +
 tests/docker/dockerfiles/debian-ports.docker |   1 +
 tests/docker/dockerfiles/debian-sid.docker   |   1 +
 tests/docker/dockerfiles/debian8.docker      |   1 +
 tests/docker/dockerfiles/debian9.docker      |   1 +
 tests/docker/dockerfiles/fedora.docker       |   1 +
 tests/docker/dockerfiles/ubuntu.docker       |   1 +
 12 files changed, 529 insertions(+), 47 deletions(-)
 delete mode 100755 scripts/gtester-cat
 create mode 100755 scripts/tap-driver.pl
 create mode 100755 scripts/tap-merge.pl
scripts/gtester-cat deleted +0 -26
deleted file mode 100755
index 061a952cad..0000000000
@@ -1,26 +0,0 @@
-#!/bin/sh
-#
-# Copyright IBM, Corp. 2012
-#
-# Authors:
-#  Anthony Liguori <[email protected]>
-#
-# 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>
- <info>
-  <package>qemu</package>
-  <version>0.0</version>
-  <revision>rev</revision>
- </info>
-EOF
-
-sed \
-  -e '/<?xml/d' \
-  -e '/^<gtester>$/d' \
-  -e '/<info>/,/<\/info>/d' \
-  -e '$b' \
-  -e '/^<\/gtester>$/d' "$@"
scripts/tap-driver.pl new file +378 -0

378 lines not on this page · raw message

scripts/tap-merge.pl new file +110 -0

110 lines not on this page · raw message

tests/Makefile.include +33 -21

74 lines not on this page · raw message

tests/docker/dockerfiles/centos7.docker +1 -0
index 0a04bfbed8..e0f18f5a41 100644
@@ -22,6 +22,7 @@ ENV PACKAGES \
     mesa-libEGL-devel \
     mesa-libgbm-devel \
     nettle-devel \
+    perl-Test-Harness \
     pixman-devel \
     SDL-devel \
     spice-glib-devel \
tests/docker/dockerfiles/debian-amd64.docker +1 -0
index 24b113b76f..c66e341e5f 100644
@@ -16,6 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         liblzo2-dev \
         librdmacm-dev \
         libsnappy-dev \
+        libtest-harness-perl \
         libvte-dev
 
 # virgl
tests/docker/dockerfiles/debian-ports.docker +1 -0
index e05a9a9802..514ab53b80 100644
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         flex \
         gettext \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/debian-sid.docker +1 -0
index 9a3d168705..b30cbe7fc0 100644
@@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         ca-certificates \
         flex \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/debian8.docker +1 -0
index 52945631cd..cdc3f11e06 100644
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         gettext \
         git \
         gnupg \
+        libtest-harness-perl \
         pkg-config \
         python-minimal
 
tests/docker/dockerfiles/debian9.docker +1 -0
index 154ae2a455..9561d4f225 100644
@@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         flex \
         gettext \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/fedora.docker +1 -0
index 0c4eb9e49c..1d0e3dc4ec 100644
@@ -70,6 +70,7 @@ ENV PACKAGES \
     nss-devel \
     numactl-devel \
     perl \
+    perl-Test-Harness \
     pixman-devel \
     python3 \
     PyYAML \
tests/docker/dockerfiles/ubuntu.docker +1 -0
index 36e2b17de5..229add533c 100644
@@ -45,6 +45,7 @@ ENV PACKAGES flex bison \
     libspice-protocol-dev \
     libspice-server-dev \
     libssh2-1-dev \
+    libtest-harness-perl \
     libusb-1.0-0-dev \
     libusbredirhost-dev \
     libvdeplug-dev \
Signature · 1 line
2.19.2
Acked-by Tested-by on v2 2/2
#4 lore raw
Quoted 13 lines · Paolo Bonzini

gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases.

glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl.

Quoted 8 lines

---
v1->v2: show failures even in non-verbose mode
show executable name next to PASS/FAIL
tweak colored output
improved support for "make -k check"
switch license blurb to https
support TAP version line
removed Eamcs epilogs

I gave it a quick try, and it seems to work fine. And I guess it's also the best self-contained option that we currently have, so:

#5 lore raw
In reply to Paolo Bonzini

Am 06.12.2018 um 22:50 hat Paolo Bonzini geschrieben:

Quoted 12 lines

gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases.

glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl.

Quoted 1 line

I just wanted to work on a unit test and found that a simple 'make check-tests/test-bdrv-drain' (which used to build and run the test with a single command) doesn't work any more.

git bisect points to this commit.

Kevin

#6 lore raw
Quoted 5 lines · Kevin Wolf

I just wanted to work on a unit test and found that a simple 'make check-tests/test-bdrv-drain' (which used to build and run the test with a single command) doesn't work any more.

git bisect points to this commit.

What's wrong with "tests/test-bdrv-drain"? (Before there were some differences in test environment, but not now).

Paolo

#7 lore raw

Am 08.02.2019 um 14:46 hat Paolo Bonzini geschrieben:

Quoted 9 lines · Kevin Wolf
Quoted 5 lines

I just wanted to work on a unit test and found that a simple 'make check-tests/test-bdrv-drain' (which used to build and run the test with a single command) doesn't work any more.

git bisect points to this commit.

What's wrong with "tests/test-bdrv-drain"? (Before there were some differences in test environment, but not now).

It runs the old version without building the source I just modified.

Kevin

#8 lore raw
Quoted 6 lines · Kevin Wolf

Am 08.02.2019 um 14:46 hat Paolo Bonzini geschrieben:

Quoted 5 lines · Kevin Wolf
Quoted 4 lines

I just wanted to work on a unit test and found that a simple 'make check-tests/test-bdrv-drain' (which used to build and run the test with a single command) doesn't work any more.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

git bisect points to this commit.

What's wrong with "tests/test-bdrv-drain"? (Before there were some differences in test environment, but not now).

It runs the old version without building the source I just modified.

Oh. Since it wasn't documented, it seemed to be just an implementation detail rather than something that would be used by people... So basically something like this?

tests/Makefile.include +3 -0
index 048cf5639c..6ac3f2c7eb 100644
@@ -861,6 +861,9 @@ check-unit: $(check-unit-y)
 check-speed: $(check-speed-y)
 	$(call do_test_human, $^)
 
+$(patsubst %, check-%, $(check-unit-y) $(check-speed-y): check-%: %
+        $<
+
 # gtester tests with TAP output
 
 $(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)):

check-report-qtest-%.tap: $(check-qtest-y)

Paolo

#9 lore raw

Am 08.02.2019 um 18:16 hat Paolo Bonzini geschrieben:

Quoted 23 lines · Kevin Wolf
Quoted 6 lines

Am 08.02.2019 um 14:46 hat Paolo Bonzini geschrieben:

Quoted 5 lines · Kevin Wolf
Quoted 4 lines

I just wanted to work on a unit test and found that a simple 'make check-tests/test-bdrv-drain' (which used to build and run the test with a single command) doesn't work any more.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

git bisect points to this commit.

What's wrong with "tests/test-bdrv-drain"? (Before there were some differences in test environment, but not now).

It runs the old version without building the source I just modified.

Oh. Since it wasn't documented, it seemed to be just an implementation detail rather than something that would be used by people... So basically something like this?

tests/Makefile.include +0 -0
index 048cf5639c..6ac3f2c7eb 100644

tests/Makefile.include check-unit: $(check-unit-y) · line 865

Quoted 5 lines
tests/Makefile.include +2 -0
@@ -861,6 +861,9 @@ check-unit: $(check-unit-y)
 check-speed: $(check-speed-y)
 	$(call do_test_human, $^)
 
+$(patsubst %, check-%, $(check-unit-y) $(check-speed-y): check-%: %
+        $<

Apart from the missing closing bracket. :-)

The old rule seems to have been like this:

.PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)) $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: %

    $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
    $(call quiet-command, \
        MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
        gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*")
    $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y) $(gcov-files-generic-y); do \
      echo Gcov report for $$f:;\
      $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
    done,)

So it used quiet-command (but I'm okay with changing this) and it set MALLOC_PERTURB_ (I think this would still be nice to have). Not sure how relevant the gcov stuff is, I never used this.

I think the minimal change for this commit would have been to just remove 'gtester $(GTESTER_OPTIONS) -m=$(SPEED)' and leave everything else in place.

Kevin

#10 lore raw
Quoted 10 lines · Kevin Wolf

$(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: %

    $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
    $(call quiet-command, \
        MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
        gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*")
    $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y) $(gcov-files-generic-y); do \
      echo Gcov report for $$f:;\
      $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
    done,)
Quoted 2 lines

So it used quiet-command (but I'm okay with changing this) and it set MALLOC_PERTURB_ (I think this would still be nice to have).

Yes, of course. I'll send a real patch.

Paolo

#11 lore raw
In reply to Paolo Bonzini

Hi Paolo,

Quoted 22 lines · Paolo Bonzini

gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases.

glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl.

---
v1->v2: show failures even in non-verbose mode
show executable name next to PASS/FAIL
tweak colored output
improved support for "make -k check"
switch license blurb to https
support TAP version line
removed Eamcs epilogs

[...]

Quoted 32 lines
tests/Makefile.include +20 -2
index fb0b449c02..1dda5e2596 100644
@@ -799,41 +799,53 @@ tests/test-qga$(EXESUF): qemu-ga$(EXESUF)
 tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
 
 SPEED = quick
-GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
-GCOV_OPTIONS = -n $(if $(V),-f,)
 
 # gtester tests, possibly with verbose output
+# do_test_tap runs all tests, even if some of them fail, while do_test_human
+# stops at the first failure unless -k is given on the command line
+
+do_test_human = \
+	$(call quiet-command, rc=0; \
+	  { $(foreach COMMAND, $1, \
+	    MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
+	      $2 $(COMMAND) -m=$(SPEED) -k --tap \
+	      | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" --color=always $(if $(V),, --show-failures-only) \
+	      || $(if $(findstring k, $(MAKEFLAGS)), rc=$$?, exit $$?); ) }; exit $$rc, \
+	  "TEST", "$*")
+
+do_test_tap = \
+	$(call quiet-command, \
+	  { $(foreach COMMAND, $1, \
+	    MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
+	      $2 $(COMMAND) -m=$(SPEED) -k --tap | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
+	      | ./scripts/tap-merge.pl | tee "$@" \
+	      | ./scripts/tap-driver.pl --color=always $(if $(V),, --show-failures-only), \
+	  "TAP","$@")

tests/Makefile.include tests/test-qga$(EXESUF): qemu-ga$(EXESUF) · line 829

Quoted 10 lines
tests/Makefile.include +3 -4
 
 .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
 $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y)
-	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
-		QTEST_QEMU_IMG=qemu-img$(EXESUF) \
-		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
-		gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@")
+	$(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \
+	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
+	  QTEST_QEMU_IMG=qemu-img$(EXESUF))

I was used to gtester filter/skip 'testpath' param:

$ gtester -h
[...]
Utility Options:
  -k, --keep-going              Continue running after tests failed
  -l                            List paths of available test cases
  -m {perf|slow|thorough|quick} Run test cases according to mode
  -m {undefined|no-undefined}   Run test cases according to mode
  -p=TESTPATH                   Only start test cases matching TESTPATH
  -s=TESTPATH                   Skip test cases matching TESTPATH

Using:

$ make check-qtest-x86_64 GTESTER_OPTIONS="-p /x86_64/acpi"

But this commit removed the use of $GTESTER_OPTIONS, however it is still documented:

$ make check-help
[...]
The variable SPEED can be set to control the gtester speed setting.
Default options are -k and (for make V=1) --verbose; they can be
changed with variable GTESTER_OPTIONS.

Is it possible to filter the tests to run with the TAP driver?

Quoted 133 lines
tests/Makefile.include +10 -15
 .PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y))
 $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: %
-	$(call quiet-command, \
-		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
-		gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*")
+	$(call do_test_human, $*)
 
-# gtester tests with XML output
+# gtester tests with TAP output
 
-$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
-	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
-		QTEST_QEMU_IMG=qemu-img$(EXESUF) \
-	  gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@")
+$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: $(check-qtest-y)
+	$(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \
+	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
+	  QTEST_QEMU_IMG=qemu-img$(EXESUF))
 
-check-report-unit.xml: $(check-unit-y)
-	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^,"GTESTER","$@")
+check-report-unit.tap: $(check-unit-y)
+	$(call do_test_tap,$^)
 
 # Reports and overall runs
 
-check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
-	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@,"GEN","$@")
-
-check-report.html: check-report.xml
-	$(call quiet-command,gtester-report $< > $@,"GEN","$@")
+check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
+	$(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@")
 
 # Per guest TCG tests
 
tests/docker/dockerfiles/centos7.docker +1 -0
index 0a04bfbed8..e0f18f5a41 100644
@@ -22,6 +22,7 @@ ENV PACKAGES \
     mesa-libEGL-devel \
     mesa-libgbm-devel \
     nettle-devel \
+    perl-Test-Harness \
     pixman-devel \
     SDL-devel \
     spice-glib-devel \
tests/docker/dockerfiles/debian-amd64.docker +1 -0
index 24b113b76f..c66e341e5f 100644
@@ -16,6 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         liblzo2-dev \
         librdmacm-dev \
         libsnappy-dev \
+        libtest-harness-perl \
         libvte-dev
 
 # virgl
tests/docker/dockerfiles/debian-ports.docker +1 -0
index e05a9a9802..514ab53b80 100644
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         flex \
         gettext \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/debian-sid.docker +1 -0
index 9a3d168705..b30cbe7fc0 100644
@@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         ca-certificates \
         flex \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/debian8.docker +1 -0
index 52945631cd..cdc3f11e06 100644
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         gettext \
         git \
         gnupg \
+        libtest-harness-perl \
         pkg-config \
         python-minimal
 
tests/docker/dockerfiles/debian9.docker +1 -0
index 154ae2a455..9561d4f225 100644
@@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         flex \
         gettext \
         git \
+        libtest-harness-perl \
         pkg-config \
         psmisc \
         python \
tests/docker/dockerfiles/fedora.docker +1 -0
index 0c4eb9e49c..1d0e3dc4ec 100644
@@ -70,6 +70,7 @@ ENV PACKAGES \
     nss-devel \
     numactl-devel \
     perl \
+    perl-Test-Harness \
     pixman-devel \
     python3 \
     PyYAML \
tests/docker/dockerfiles/ubuntu.docker +1 -0
index 36e2b17de5..229add533c 100644
@@ -45,6 +45,7 @@ ENV PACKAGES flex bison \
     libspice-protocol-dev \
     libspice-server-dev \
     libssh2-1-dev \
+    libtest-harness-perl \
     libusb-1.0-0-dev \
     libusbredirhost-dev \
     libvdeplug-dev \
#12 lore raw
Quoted 5 lines · Philippe Mathieu-Daudé
$ make check-qtest-x86_64 GTESTER_OPTIONS="-p /x86_64/acpi"

But this commit removed the use of $GTESTER_OPTIONS, however it is still documented:

Quoted 7 lines
$ make check-help
[...]
The variable SPEED can be set to control the gtester speed setting.
Default options are -k and (for make V=1) --verbose; they can be
changed with variable GTESTER_OPTIONS.

Is it possible to filter the tests to run with the TAP driver?

Yes, we can just add $GTESTER_OPTIONS to the invocation of the test executables.

Paolo