From ae4b01b3497934849278b49f3dfd28420f75e300 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 28 Feb 2023 19:06:45 +0000 Subject: [PATCH] tests: Ensure TAP version is printed before other messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These two tests were failing with this error: stderr: TAP parsing error: version number must be on the first line [...] Unknown TAP version. The first line MUST be `TAP version `. Assuming version 12. This can be fixed by ensuring we always call g_test_init first in the body of main. Thanks: Daniel Berrange, for diagnosing the problem Signed-off-by: Richard W.M. Jones Reviewed-by: Daniel P. Berrangé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Alexander Bulekov Reviewed-by: Darren Kenny Message-Id: <20230227174019.1164205-1-rjones@redhat.com> Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20230228190653.1602033-17-alex.bennee@linaro.org> --- tests/qtest/fuzz-lsi53c895a-test.c | 4 ++-- tests/qtest/rtl8139-test.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/qtest/fuzz-lsi53c895a-test.c b/tests/qtest/fuzz-lsi53c895a-test.c index a9254b455d..2012bd54b7 100644 --- a/tests/qtest/fuzz-lsi53c895a-test.c +++ b/tests/qtest/fuzz-lsi53c895a-test.c @@ -112,12 +112,12 @@ static void test_lsi_do_dma_empty_queue(void) int main(int argc, char **argv) { + g_test_init(&argc, &argv, NULL); + if (!qtest_has_device("lsi53c895a")) { return 0; } - g_test_init(&argc, &argv, NULL); - qtest_add_func("fuzz/lsi53c895a/lsi_do_dma_empty_queue", test_lsi_do_dma_empty_queue); diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c index 1beb83805c..4bd240e9ee 100644 --- a/tests/qtest/rtl8139-test.c +++ b/tests/qtest/rtl8139-test.c @@ -207,9 +207,10 @@ int main(int argc, char **argv) verbosity_level = atoi(v_env); } + g_test_init(&argc, &argv, NULL); + qtest_start("-device rtl8139"); - g_test_init(&argc, &argv, NULL); qtest_add_func("/rtl8139/nop", nop); qtest_add_func("/rtl8139/timer", test_init); -- 2.11.0