All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] meson: convert unit tests in tests/Makefile.include
@ 2020-08-28 11:07 marcandre.lureau
  2020-08-28 11:07 ` [PATCH 01/16] meson: build qapi tests library marcandre.lureau
                   ` (16 more replies)
  0 siblings, 17 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

This series convert the unit tests from tests/Makefile.include to meson.

Based-on: <20200823111757.72002-2-thuth@redhat.com>

Marc-André Lureau (16):
  meson: build qapi tests library
  meson: declare tasn1 dependency
  meson: declare keyutils dependency
  meson: convert qht-bench
  tests: qga has virtio-serial by default when host has it
  meson: convert the unit tests
  meson: move keyutils dependency check
  meson: remove old socket_scm_helper rule
  meson: convert vhost-user-bridge
  meson: convert atomic*-bench
  tests/Makefile.include: update check-build
  tests: do not print benchmark output to stdout
  meson: convert the speed tests
  tests/migration/stress: remove unused exit_success
  meson: fix migration/stress compilation with glib>=2.30
  meson: convert migration/initrd-stress

 Makefile                         |   2 +-
 configure                        |  25 ---
 meson.build                      |  10 +
 scripts/mtest2make.py            |   3 +-
 tests/Makefile.include           | 368 +------------------------------
 tests/benchmark-crypto-cipher.c  |   8 +-
 tests/benchmark-crypto-hash.c    |   2 +-
 tests/benchmark-crypto-hmac.c    |   8 +-
 tests/include/meson.build        |  13 ++
 tests/meson.build                | 253 +++++++++++++++++++++
 tests/migration/initrd-stress.sh |  10 +
 tests/migration/meson.build      |  14 ++
 tests/migration/stress.c         |  15 +-
 tests/test-crypto-secret.c       |  10 +-
 tests/test-qga.c                 |   4 +-
 15 files changed, 325 insertions(+), 420 deletions(-)
 create mode 100644 tests/include/meson.build
 create mode 100755 tests/migration/initrd-stress.sh
 create mode 100644 tests/migration/meson.build

-- 
2.26.2




^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 01/16] meson: build qapi tests library
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 02/16] meson: declare tasn1 dependency marcandre.lureau
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

- builds QAPI builtins types/visitor to fix a linking issue with
  unresolved symbols in the static library.

- work around a meson limitation on generated file output directories.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include    | 79 +--------------------------------------
 tests/include/meson.build | 13 +++++++
 tests/meson.build         | 44 ++++++++++++++++++++++
 3 files changed, 58 insertions(+), 78 deletions(-)
 create mode 100644 tests/include/meson.build

diff --git a/tests/Makefile.include b/tests/Makefile.include
index a9746c2ecb..9e72cfefbe 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -34,23 +34,6 @@ endif
 ifneq ($(wildcard config-host.mak),)
 export SRC_PATH
 
-# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
-qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
-$(SRC_PATH)/scripts/qapi/commands.py \
-$(SRC_PATH)/scripts/qapi/common.py \
-$(SRC_PATH)/scripts/qapi/doc.py \
-$(SRC_PATH)/scripts/qapi/error.py \
-$(SRC_PATH)/scripts/qapi/events.py \
-$(SRC_PATH)/scripts/qapi/expr.py \
-$(SRC_PATH)/scripts/qapi/gen.py \
-$(SRC_PATH)/scripts/qapi/introspect.py \
-$(SRC_PATH)/scripts/qapi/parser.py \
-$(SRC_PATH)/scripts/qapi/schema.py \
-$(SRC_PATH)/scripts/qapi/source.py \
-$(SRC_PATH)/scripts/qapi/types.py \
-$(SRC_PATH)/scripts/qapi/visit.py \
-$(SRC_PATH)/scripts/qapi-gen.py
-
 # Get the list of all supported sysemu targets
 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
@@ -164,36 +147,13 @@ ifeq ($(CONFIG_BLOCK)$(CONFIG_REPLICATION)$(CONFIG_POSIX),yyy)
 check-unit-y += tests/test-replication$(EXESUF)
 endif
 
-generated-files-y += tests/test-qapi-types.h
-generated-files-y += tests/include/test-qapi-types-sub-module.h
-generated-files-y += tests/test-qapi-types-sub-sub-module.h
-generated-files-y += tests/test-qapi-visit.h
-generated-files-y += tests/include/test-qapi-visit-sub-module.h
-generated-files-y += tests/test-qapi-visit-sub-sub-module.h
-generated-files-y += tests/test-qapi-commands.h
-generated-files-y += tests/test-qapi-init-commands.h
-generated-files-y += tests/include/test-qapi-commands-sub-module.h
-generated-files-y += tests/test-qapi-commands-sub-sub-module.h
-generated-files-y += tests/test-qapi-emit-events.h
-generated-files-y += tests/test-qapi-events.h
-generated-files-y += tests/include/test-qapi-events-sub-module.h
-generated-files-y += tests/test-qapi-events-sub-sub-module.h
-generated-files-y += tests/test-qapi-introspect.h
-
 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
 
 
 # Deps that are common to various different sets of tests below
 test-util-obj-y = libqemuutil.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
-test-qapi-obj-y = tests/test-qapi-types.o \
-	tests/include/test-qapi-types-sub-module.o \
-	tests/test-qapi-types-sub-sub-module.o \
-	tests/test-qapi-visit.o \
-	tests/include/test-qapi-visit-sub-module.o \
-	tests/test-qapi-visit-sub-sub-module.o \
-	tests/test-qapi-introspect.o \
-	$(test-qom-obj-y)
+test-qapi-obj-y = $(test-qom-obj-y) tests/libtestqapi.a
 benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
 test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
 test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
@@ -264,42 +224,6 @@ tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
 tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
 	$(test-block-obj-y)
 
-tests/test-qapi-types.c tests/test-qapi-types.h \
-tests/include/test-qapi-types-sub-module.c \
-tests/include/test-qapi-types-sub-module.h \
-tests/test-qapi-types-sub-sub-module.c \
-tests/test-qapi-types-sub-sub-module.h \
-tests/test-qapi-visit.c tests/test-qapi-visit.h \
-tests/include/test-qapi-visit-sub-module.c \
-tests/include/test-qapi-visit-sub-module.h \
-tests/test-qapi-visit-sub-sub-module.c \
-tests/test-qapi-visit-sub-sub-module.h \
-tests/test-qapi-commands.h tests/test-qapi-commands.c \
-tests/include/test-qapi-commands-sub-module.h \
-tests/include/test-qapi-commands-sub-module.c \
-tests/test-qapi-commands-sub-sub-module.h \
-tests/test-qapi-commands-sub-sub-module.c \
-tests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
-tests/test-qapi-events.c tests/test-qapi-events.h \
-tests/test-qapi-init-commands.c \
-tests/test-qapi-init-commands.h \
-tests/include/test-qapi-events-sub-module.c \
-tests/include/test-qapi-events-sub-module.h \
-tests/test-qapi-events-sub-sub-module.c \
-tests/test-qapi-events-sub-sub-module.h \
-tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
-tests/test-qapi-gen-timestamp ;
-tests/test-qapi-gen-timestamp: \
-		$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
-		$(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
-		$(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
-		$(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
-		-o tests -p "test-" $<, \
-		"GEN","$(@:%-timestamp=%)")
-	@rm -f tests/test-qapi-doc.texi
-	@>$@
-
 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
 tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
@@ -532,7 +456,6 @@ check-build: build-unit
 
 check-clean:
 	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
-	rm -f tests/test-qapi-gen-timestamp
 	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
 
 check: check-unit
diff --git a/tests/include/meson.build b/tests/include/meson.build
new file mode 100644
index 0000000000..835872643e
--- /dev/null
+++ b/tests/include/meson.build
@@ -0,0 +1,13 @@
+# an extra target to workaround meson limitation on output files location
+test_qapi_outputs_extra = [
+  'test-qapi-commands-sub-module.c',
+  'test-qapi-commands-sub-module.h',
+  'test-qapi-events-sub-module.c',
+  'test-qapi-events-sub-module.h',
+  'test-qapi-types-sub-module.c',
+  'test-qapi-types-sub-module.h',
+  'test-qapi-visit-sub-module.c',
+  'test-qapi-visit-sub-module.h',
+]
+
+test_qapi_outputs_extra = custom_target('QAPI test include', output: test_qapi_outputs_extra, command: 'true')
diff --git a/tests/meson.build b/tests/meson.build
index fe2c6d8e6b..3c1586f110 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,47 @@
+test_qapi_outputs = [
+  'qapi-builtin-types.c',
+  'qapi-builtin-types.h',
+  'qapi-builtin-visit.c',
+  'qapi-builtin-visit.h',
+  'test-qapi-commands-sub-sub-module.c',
+  'test-qapi-commands-sub-sub-module.h',
+  'test-qapi-commands.c',
+  'test-qapi-commands.h',
+  'test-qapi-emit-events.c',
+  'test-qapi-emit-events.h',
+  'test-qapi-events-sub-sub-module.c',
+  'test-qapi-events-sub-sub-module.h',
+  'test-qapi-events.c',
+  'test-qapi-events.h',
+  'test-qapi-init-commands.c',
+  'test-qapi-init-commands.h',
+  'test-qapi-introspect.c',
+  'test-qapi-introspect.h',
+  'test-qapi-types-sub-sub-module.c',
+  'test-qapi-types-sub-sub-module.h',
+  'test-qapi-types.c',
+  'test-qapi-types.h',
+  'test-qapi-visit-sub-sub-module.c',
+  'test-qapi-visit-sub-sub-module.h',
+  'test-qapi-visit.c',
+  'test-qapi-visit.h',
+]
+
+# meson doesn't like generated output in other directories:
+subdir('include')
+
+test_qapi_files = custom_target('Test QAPI files',
+                                output: test_qapi_outputs,
+                                input: files('qapi-schema/qapi-schema-test.json',
+                                             'qapi-schema/include/sub-module.json',
+                                             'qapi-schema/sub-sub-module.json'),
+                                command: [ qapi_gen, '-o', meson.current_build_dir(),
+                                           '-b', '-p', 'test-', '@INPUT0@' ],
+                                depend_files: qapi_gen_depends)
+
+libtestqapi = static_library('testqapi', sources: [test_qapi_files, test_qapi_outputs_extra])
+testqapi = declare_dependency(link_with: libtestqapi)
+
 if have_system and 'CONFIG_POSIX' in config_host
   subdir('qemu-iotests')
 endif
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 02/16] meson: declare tasn1 dependency
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
  2020-08-28 11:07 ` [PATCH 01/16] meson: build qapi tests library marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 03/16] meson: declare keyutils dependency marcandre.lureau
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 meson.build | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meson.build b/meson.build
index 74f8ea0c2e..2002728487 100644
--- a/meson.build
+++ b/meson.build
@@ -401,6 +401,11 @@ libdaxctl = not_found
 if 'CONFIG_LIBDAXCTL' in config_host
   libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
 endif
+tasn1 = not_found
+if 'CONFIG_TASN1' in config_host
+  tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
+                             link_args: config_host['TASN1_LIBS'].split())
+endif
 
 # Create config-host.h
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 03/16] meson: declare keyutils dependency
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
  2020-08-28 11:07 ` [PATCH 01/16] meson: build qapi tests library marcandre.lureau
  2020-08-28 11:07 ` [PATCH 02/16] meson: declare tasn1 dependency marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 04/16] meson: convert qht-bench marcandre.lureau
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Rename the variable to be more explicit. A further clean-up patch will
move the actual to dependency check to meson entirely.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 configure                  |  2 +-
 meson.build                |  4 ++++
 tests/Makefile.include     |  2 +-
 tests/test-crypto-secret.c | 10 +++++-----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 12636369d1..2471483bec 100755
--- a/configure
+++ b/configure
@@ -7536,7 +7536,7 @@ fi
 if test "$secret_keyring" = "yes" ; then
   echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
   if test "$have_keyutils" = "yes" ; then
-    echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak
+    echo "CONFIG_KEYUTILS=y" >> $config_host_mak
   fi
 fi
 
diff --git a/meson.build b/meson.build
index 2002728487..d69dd846d1 100644
--- a/meson.build
+++ b/meson.build
@@ -406,6 +406,10 @@ if 'CONFIG_TASN1' in config_host
   tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
                              link_args: config_host['TASN1_LIBS'].split())
 endif
+keyutils = not_found
+if 'CONFIG_KEYUTILS' in config_host
+  keyutils = declare_dependency(link_args: '-lkeyutils')
+endif
 
 # Create config-host.h
 
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9e72cfefbe..9599990a83 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -248,7 +248,7 @@ tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-c
 tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
 tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
 
-ifeq ($(CONFIG_TEST_SECRET_KEYRING),y)
+ifeq ($(CONFIG_KEYUTILS),y)
 tests/test-crypto-secret.o-libs := -lkeyutils
 endif
 
diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c
index 603a093f10..9d06176663 100644
--- a/tests/test-crypto-secret.c
+++ b/tests/test-crypto-secret.c
@@ -24,7 +24,7 @@
 #include "crypto/secret.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
-#ifdef CONFIG_TEST_SECRET_KEYRING
+#ifdef CONFIG_KEYUTILS
 #include "crypto/secret_keyring.h"
 #include <keyutils.h>
 #endif
@@ -128,7 +128,7 @@ static void test_secret_indirect_emptyfile(void)
     g_free(fname);
 }
 
-#ifdef CONFIG_TEST_SECRET_KEYRING
+#ifdef CONFIG_KEYUTILS
 
 #define DESCRIPTION "qemu_test_secret"
 #define PAYLOAD "Test Payload"
@@ -268,7 +268,7 @@ static void test_secret_keyring_bad_key_access_right(void)
     keyctl_unlink(key, KEY_SPEC_PROCESS_KEYRING);
 }
 
-#endif /* CONFIG_TEST_SECRET_KEYRING */
+#endif /* CONFIG_KEYUTILS */
 
 static void test_secret_noconv_base64_good(void)
 {
@@ -571,7 +571,7 @@ int main(int argc, char **argv)
     g_test_add_func("/crypto/secret/indirect/emptyfile",
                     test_secret_indirect_emptyfile);
 
-#ifdef CONFIG_TEST_SECRET_KEYRING
+#ifdef CONFIG_KEYUTILS
     g_test_add_func("/crypto/secret/keyring/good",
                     test_secret_keyring_good);
     g_test_add_func("/crypto/secret/keyring/revoked_key",
@@ -582,7 +582,7 @@ int main(int argc, char **argv)
                     test_secret_keyring_bad_serial_key);
     g_test_add_func("/crypto/secret/keyring/bad_key_access_right",
                     test_secret_keyring_bad_key_access_right);
-#endif /* CONFIG_TEST_SECRET_KEYRING */
+#endif /* CONFIG_KEYUTILS */
 
     g_test_add_func("/crypto/secret/noconv/base64/good",
                     test_secret_noconv_base64_good);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 04/16] meson: convert qht-bench
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (2 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 03/16] meson: declare keyutils dependency marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 05/16] tests: qga has virtio-serial by default when host has it marcandre.lureau
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

This is required by test-qht-par unit test.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include | 1 -
 tests/meson.build      | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9599990a83..9751a86b4c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -201,7 +201,6 @@ tests/test-rcu-slist$(EXESUF): tests/test-rcu-slist.o $(test-util-obj-y)
 tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
 tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
 tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
-tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
 tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
diff --git a/tests/meson.build b/tests/meson.build
index 3c1586f110..c45ade551c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,7 @@
+qht_bench = executable('qht-bench',
+                       sources: files('qht-bench.c'),
+                       dependencies: [qemuutil])
+
 test_qapi_outputs = [
   'qapi-builtin-types.c',
   'qapi-builtin-types.h',
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 05/16] tests: qga has virtio-serial by default when host has it
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (3 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 04/16] meson: convert qht-bench marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 12:54   ` Thomas Huth
  2020-08-28 11:07 ` [PATCH 06/16] meson: convert the unit tests marcandre.lureau
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

When dumping the default configuration, don't expect virtio-serial as
the configured method, unless the host has CONFIG_VIRTIO_SERIAL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/test-qga.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/test-qga.c b/tests/test-qga.c
index 4ac4c22109..122730d326 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -728,10 +728,12 @@ static void test_qga_config(gconstpointer data)
     g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
     g_assert_no_error(error);
 
+#ifdef CONFIG_VIRTIO_SERIAL
     str = g_key_file_get_string(kf, "general", "method", &error);
     g_assert_no_error(error);
     g_assert_cmpstr(str, ==, "virtio-serial");
     g_free(str);
+#endif
 
     str = g_key_file_get_string(kf, "general", "path", &error);
     g_assert_no_error(error);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 06/16] meson: convert the unit tests
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (4 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 05/16] tests: qga has virtio-serial by default when host has it marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 07/16] meson: move keyutils dependency check marcandre.lureau
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include | 256 +----------------------------------------
 tests/meson.build      | 169 +++++++++++++++++++++++++++
 tests/test-qga.c       |   2 +-
 3 files changed, 173 insertions(+), 254 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9751a86b4c..eea91772fa 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -38,256 +38,20 @@ export SRC_PATH
 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
 
-check-unit-y += tests/check-qdict$(EXESUF)
-check-unit-y += tests/check-block-qdict$(EXESUF)
-check-unit-y += tests/check-qnum$(EXESUF)
-check-unit-y += tests/check-qstring$(EXESUF)
-check-unit-y += tests/check-qlist$(EXESUF)
-check-unit-y += tests/check-qnull$(EXESUF)
-check-unit-y += tests/check-qobject$(EXESUF)
-check-unit-y += tests/check-qjson$(EXESUF)
-check-unit-y += tests/check-qlit$(EXESUF)
-check-unit-y += tests/test-qobject-output-visitor$(EXESUF)
-check-unit-y += tests/test-clone-visitor$(EXESUF)
-check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-qmp-cmds$(EXESUF)
-check-unit-y += tests/test-string-input-visitor$(EXESUF)
-check-unit-y += tests/test-string-output-visitor$(EXESUF)
-check-unit-y += tests/test-qmp-event$(EXESUF)
-check-unit-y += tests/test-opts-visitor$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
-check-unit-y += tests/test-visitor-serialization$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-iov$(EXESUF)
-check-unit-y += tests/test-bitmap$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
-ifeq ($(CONFIG_POSIX),y)
-check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
-endif
-check-unit-y += tests/test-x86-cpuid$(EXESUF)
-# all code tested by test-x86-cpuid is inside topology.h
-ifeq ($(CONFIG_SOFTMMU),y)
-check-unit-y += tests/test-xbzrle$(EXESUF)
-check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
-endif
-check-unit-y += tests/test-cutils$(EXESUF)
-check-unit-y += tests/test-shift128$(EXESUF)
-check-unit-y += tests/test-mul64$(EXESUF)
-check-unit-y += tests/test-int128$(EXESUF)
-# all code tested by test-int128 is inside int128.h
-check-unit-y += tests/rcutorture$(EXESUF)
-check-unit-y += tests/test-rcu-list$(EXESUF)
-check-unit-y += tests/test-rcu-simpleq$(EXESUF)
-check-unit-y += tests/test-rcu-tailq$(EXESUF)
-check-unit-y += tests/test-rcu-slist$(EXESUF)
-check-unit-y += tests/test-qdist$(EXESUF)
-check-unit-y += tests/test-qht$(EXESUF)
-check-unit-y += tests/test-qht-par$(EXESUF)
-check-unit-y += tests/test-bitops$(EXESUF)
-check-unit-y += tests/test-bitcnt$(EXESUF)
-check-unit-y += tests/test-qgraph$(EXESUF)
-check-unit-y += tests/check-qom-interface$(EXESUF)
-check-unit-y += tests/check-qom-proplist$(EXESUF)
-check-unit-y += tests/test-qemu-opts$(EXESUF)
-check-unit-y += tests/test-keyval$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
-ifndef CONFIG_TSAN
-# Some tests: test-char, test-qdev-global-props, and test-qga,
-# are not runnable under TSan due to a known issue.
-# https://github.com/google/sanitizers/issues/1116
-check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-qdev-global-props$(EXESUF)
-ifeq ($(CONFIG_GUEST_AGENT),y)
-check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
-endif
-endif
-check-unit-$(CONFIG_SOFTMMU) += tests/test-timed-average$(EXESUF)
-check-unit-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_INOTIFY1)) += tests/test-util-filemonitor$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-util-sockets$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-base64$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
-check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
-check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
-check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test-crypto-xts$(EXESUF)
-check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
-check-unit-y += tests/test-logging$(EXESUF)
-check-unit-$(CONFIG_SOFTMMU) += tests/test-bufferiszero$(EXESUF)
-check-unit-y += tests/test-uuid$(EXESUF)
-check-unit-y += tests/ptimer-test$(EXESUF)
-check-unit-y += tests/test-qapi-util$(EXESUF)
-ifeq ($(CONFIG_BLOCK)$(CONFIG_REPLICATION)$(CONFIG_POSIX),yyy)
-check-unit-y += tests/test-replication$(EXESUF)
-endif
 
 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
 
-
 # Deps that are common to various different sets of tests below
 test-util-obj-y = libqemuutil.a
-test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
-test-qapi-obj-y = $(test-qom-obj-y) tests/libtestqapi.a
-benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
-test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
-test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
-test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
-test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
-
-tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
-tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
-tests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
-tests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
-tests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
-tests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
-tests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
-tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
-tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
-tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
-tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
-
-tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
-tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
-tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
-tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
-tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
-tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
-tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
-tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
-tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
-tests/test-bitmap$(EXESUF): tests/test-bitmap.o $(test-util-obj-y)
-tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
-tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/libmigration.fa $(test-util-obj-y) \
-	$(test-io-obj-y)
-tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
-tests/test-int128$(EXESUF): tests/test-int128.o
-tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
-tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
-tests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
-tests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
-tests/test-rcu-slist$(EXESUF): tests/test-rcu-slist.o $(test-util-obj-y)
-tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
-tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
-tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
-tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
 
-tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o hw/core/libhwcore.fa \
-	$(test-qapi-obj-y)
-tests/test-vmstate$(EXESUF): tests/test-vmstate.o migration/libmigration.fa \
-	$(test-io-obj-y)
-tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
-tests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
-tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
-tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
-tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
-tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
-tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
-tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
-
-tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
-
-tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
-	$(test-block-obj-y)
-
-tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
-tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
-tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
-tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
-tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o tests/test-qapi-init-commands.o $(test-qapi-obj-y)
-tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
-tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
-
-tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
-tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
-tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
-tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
-tests/test-qgraph$(EXESUF): tests/test-qgraph.o tests/qtest/libqos/qgraph.o $(test-util-obj-y)
-tests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
 tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
-tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
 tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
-tests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
 tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
-tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
-tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
-
-ifeq ($(CONFIG_KEYUTILS),y)
-tests/test-crypto-secret.o-libs := -lkeyutils
-endif
-
-tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
-tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
-tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
-
-tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
-tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
-	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
-
-tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
-tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
-	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
-	tests/crypto-tls-psk-helpers.o \
-        $(test-crypto-obj-y)
-tests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
-	$(test-util-obj-y)
-tests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
-	tests/socket-helpers.o $(test-util-obj-y)
-tests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
-tests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
-tests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
-tests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
-tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
-tests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
-        tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
-tests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
-        tests/io-channel-helpers.o $(test-io-obj-y)
-tests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
-	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
-	tests/io-channel-helpers.o $(test-io-obj-y)
-tests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
-        tests/io-channel-helpers.o $(test-io-obj-y)
-tests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
-        tests/io-channel-helpers.o $(test-io-obj-y)
-tests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
-tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
-tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
-tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
 
 tests/migration/stress$(EXESUF): tests/migration/stress.o
 	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
@@ -301,8 +65,6 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
 	rm $(INITRD_WORK_DIR)/init
 	rmdir $(INITRD_WORK_DIR)
 
-tests/test-qga$(EXESUF): qga/qemu-ga$(EXESUF)
-tests/test-qga$(EXESUF): tests/test-qga.o tests/qtest/libqtest.o $(test-util-obj-y)
 tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
@@ -343,19 +105,9 @@ define do_test_tap
 	  "TAP","$@")
 endef
 
-build-unit: $(check-unit-y)
-
-check-unit: $(check-unit-y)
-	$(call do_test_human, $^)
-
 check-speed: $(check-speed-y)
 	$(call do_test_human, $^)
 
-# gtester tests with TAP output
-
-check-report-unit.tap: $(check-unit-y)
-	$(call do_test_tap,$^)
-
 # Per guest TCG tests
 
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
@@ -449,16 +201,14 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
 
 # Consolidated targets
 
-.PHONY: check-block check-unit check check-clean get-vm-images
+.PHONY: check-block check check-clean get-vm-images
 check-block:
-check-build: build-unit
+check-build:
 
 check-clean:
-	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
+	rm -rf tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
 	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
 
-check: check-unit
-
 clean: check-clean
 
 # Build the help program automatically
diff --git a/tests/meson.build b/tests/meson.build
index c45ade551c..6b04171c17 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,5 @@
+py3 = import('python').find_installation()
+
 qht_bench = executable('qht-bench',
                        sources: files('qht-bench.c'),
                        dependencies: [qemuutil])
@@ -46,6 +48,173 @@ test_qapi_files = custom_target('Test QAPI files',
 libtestqapi = static_library('testqapi', sources: [test_qapi_files, test_qapi_outputs_extra])
 testqapi = declare_dependency(link_with: libtestqapi)
 
+testblock = declare_dependency(dependencies: [block], sources: files('iothread.c'))
+
+tests = {
+  'check-block-qdict': {},
+  'check-qdict': {},
+  'check-qnum': {},
+  'check-qstring': {},
+  'check-qlist': {},
+  'check-qnull': {},
+  'check-qobject': {},
+  'check-qjson': {},
+  'check-qlit': {},
+  'test-qobject-output-visitor': {'deps': [testqapi]},
+  'test-clone-visitor': {'deps': [testqapi]},
+  'test-qobject-input-visitor': {'deps': [testqapi]},
+  'test-string-input-visitor': {'deps': [testqapi]},
+  'test-string-output-visitor': {'deps': [testqapi]},
+  'test-qmp-event': {'deps': [testqapi]},
+  'test-opts-visitor': {'deps': [testqapi]},
+  'test-visitor-serialization': {'deps': [testqapi]},
+  'test-bitmap': {},
+  # all code tested by test-x86-cpuid is inside topology.h
+  'test-x86-cpuid': {},
+  'test-cutils': {},
+  'test-shift128': {},
+  'test-mul64': {},
+  # all code tested by test-int128 is inside int128.h
+  'test-int128': {},
+  'rcutorture': {},
+  'test-rcu-list': {},
+  'test-rcu-simpleq': {},
+  'test-rcu-tailq': {},
+  'test-rcu-slist': {},
+  'test-qdist': {},
+  'test-qht': {},
+  'test-qht-par': {'test_deps': [qht_bench]},
+  'test-bitops': {},
+  'test-bitcnt': {},
+  'test-qgraph': {'extra_src': files('qtest/libqos/qgraph.c')},
+  'check-qom-interface': {'deps': [qom]},
+  'check-qom-proplist': {'deps': [qom]},
+  'test-qemu-opts': {},
+  'test-keyval': {'deps': [testqapi]},
+  'test-logging': {},
+  'test-uuid': {},
+  'ptimer-test': {
+    'extra_src': files('ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c')},
+  'test-qapi-util': {},
+}
+
+if have_block
+  tests += {
+    'test-coroutine': {'deps': [testblock]},
+    'test-aio': {'deps': [testblock]},
+    'test-aio-multithread': {'deps': [testblock]},
+    'test-throttle': {'deps': [testblock]},
+    'test-thread-pool': {'deps': [testblock]},
+    'test-hbitmap': {'deps': [testblock]},
+    'test-bdrv-drain': {'deps': [testblock]},
+    'test-bdrv-graph-mod': {'deps': [testblock]},
+    'test-blockjob': {'deps': [testblock]},
+    'test-blockjob-txn': {'deps': [testblock]},
+    'test-block-backend': {'deps': [testblock]},
+    'test-block-iothread': {'deps': [testblock]},
+    'test-image-locking': {'deps': [testblock], 'if': ['CONFIG_POSIX']},
+    'test-write-threshold': {'deps': [testblock]},
+    'test-crypto-hash': {'deps': [crypto]},
+    'test-crypto-hmac': {'deps': [crypto]},
+    'test-crypto-cipher': {'deps': [crypto]},
+    'test-crypto-secret': {'deps': [crypto, keyutils]},
+    'test-crypto-tlscredsx509': {
+      'extra_src': files('crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c'),
+      'deps': [tasn1, crypto],
+      'if': ['CONFIG_GNUTLS', 'CONFIG_TASN1']},
+    'test-crypto-tlssession': {
+      'extra_src': files('crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c'),
+      'deps': [tasn1, crypto],
+      'if': ['CONFIG_GNUTLS', 'CONFIG_TASN1']},
+    'test-authz-simple': {'deps': [authz]},
+    'test-authz-list': {'deps': [authz]},
+    'test-authz-listfile': {'deps': [authz]},
+    'test-authz-pam': {'deps': [authz], 'if': ['CONFIG_AUTH_PAM']},
+    'test-io-task': {'deps': [testblock]},
+    'test-io-channel-socket': {
+      'extra_src': files('socket-helpers.c', 'io-channel-helpers.c'),
+      'deps': [io]},
+    'test-io-channel-file': {
+      'extra_src': files('io-channel-helpers.c'),
+      'deps': [io]},
+    'test-io-channel-tls': {
+      'extra_src': files('io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c'),
+      'deps': [tasn1, io, crypto],
+      'if': ['CONFIG_GNUTLS', 'CONFIG_TASN1']},
+    'test-io-channel-command': {
+      'extra_src': files('io-channel-helpers.c'),
+      'deps': [io]},
+    'test-io-channel-buffer': {
+      'extra_src': files('io-channel-helpers.c'),
+      'deps': [io]},
+    'test-crypto-ivgen': {'deps': [io]},
+    'test-crypto-afsplit': {'deps': [io]},
+    'test-crypto-xts': {'deps': [crypto, io], 'if': ['CONFIG_QEMU_PRIVATE_XTS']},
+    'test-crypto-block': {'deps': [io]},
+    'test-replication': {'deps': [testblock], 'if': ['CONFIG_REPLICATION', 'CONFIG_POSIX']},
+  }
+  if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
+    tests += {'test-crypto-pbkdf': {'deps': [io]}}
+  endif
+endif
+
+if have_system
+  tests += {
+    'test-iov': {},
+    'test-qmp-cmds': {'deps': [testqapi]},
+    'test-xbzrle': {'deps': [migration]},
+    'test-vmstate': {'deps': [migration, io], 'if': ['CONFIG_POSIX']},
+    'test-timed-average': {},
+    'test-util-filemonitor': {'if': ['CONFIG_INOTIFY1']},
+    'test-util-sockets': {'extra_src': files('socket-helpers.c')},
+    'test-base64': {},
+    'test-bufferiszero': {},
+  }
+  # Some tests: test-char, test-qdev-global-props, and test-qga,
+  # are not runnable under TSan due to a known issue.
+  # https://github.com/google/sanitizers/issues/1116
+  if 'CONFIG_TSAN' not in config_host
+    tests += {
+      'test-char': {'extra_src': files('socket-helpers.c'), 'deps': [qom, io, chardev]},
+      'test-qdev-global-props': {'deps': [qom, hwcore, testqapi]}
+    }
+  endif
+endif
+
+if 'CONFIG_TSAN' not in config_host and 'CONFIG_GUEST_AGENT' in config_host
+  tests += {'test-qga': {'extra_src': files('qtest/libqtest.c'), 'test_deps': [qga], 'if': ['CONFIG_GUEST_AGENT', 'CONFIG_LINUX']}}
+endif
+
+test_env = environment()
+test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+
+foreach test_name, extra_args: tests
+  check_if = true
+  foreach t: extra_args.get('if', [])
+    if t not in config_host
+      check_if = false
+      break
+    endif
+  endforeach
+  if not check_if
+    continue
+  endif
+
+  src = extra_args.get('src', [test_name + '.c'])
+  extra_src = extra_args.get('extra_src', [])
+  exe = executable(test_name, src + extra_src,
+                   dependencies: [qemuutil] + extra_args.get('deps', []))
+
+  suite = ['unit'] + extra_args.get('suite', [])
+  test(test_name, exe,
+       depends: extra_args.get('test_deps', []),
+       env: test_env,
+       args: ['--tap', '-k'],
+       protocol: 'tap',
+       suite: suite)
+endforeach
+
 if have_system and 'CONFIG_POSIX' in config_host
   subdir('qemu-iotests')
 endif
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 122730d326..1e223e992c 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -4,7 +4,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
-#include "libqos/libqtest.h"
+#include "qtest/libqos/libqtest.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qlist.h"
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/16] meson: move keyutils dependency check
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (5 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 06/16] meson: convert the unit tests marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 08/16] meson: remove old socket_scm_helper rule marcandre.lureau
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Since there is not minimum version specified, and it's a test-only
dependency, it's fair to depend on a version that ships with a .pc I
suppose.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 configure   | 25 -------------------------
 meson.build |  6 ++----
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index 2471483bec..cb81fbc9b3 100755
--- a/configure
+++ b/configure
@@ -6324,28 +6324,6 @@ but not implemented on your system"
     fi
 fi
 
-##########################################
-# check for usable keyutils.h
-
-if test "$linux" = "yes" ; then
-
-    have_keyutils=no
-    cat > $TMPC << EOF
-#include <errno.h>
-#include <asm/unistd.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <keyutils.h>
-int main(void) {
-    return request_key("user", NULL, NULL, 0);
-}
-EOF
-    if compile_prog "" "-lkeyutils"; then
-        have_keyutils=yes
-    fi
-fi
-
-
 ##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
@@ -7535,9 +7513,6 @@ fi
 
 if test "$secret_keyring" = "yes" ; then
   echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
-  if test "$have_keyutils" = "yes" ; then
-    echo "CONFIG_KEYUTILS=y" >> $config_host_mak
-  fi
 fi
 
 if test "$tcg_interpreter" = "yes"; then
diff --git a/meson.build b/meson.build
index d69dd846d1..421f53083e 100644
--- a/meson.build
+++ b/meson.build
@@ -406,10 +406,7 @@ if 'CONFIG_TASN1' in config_host
   tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
                              link_args: config_host['TASN1_LIBS'].split())
 endif
-keyutils = not_found
-if 'CONFIG_KEYUTILS' in config_host
-  keyutils = declare_dependency(link_args: '-lkeyutils')
-endif
+keyutils = dependency('keyutils', required: false)
 
 # Create config-host.h
 
@@ -420,6 +417,7 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
 config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
+config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/16] meson: remove old socket_scm_helper rule
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (6 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 07/16] meson: move keyutils dependency check marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 09/16] meson: convert vhost-user-bridge marcandre.lureau
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

It was covered already in commit d3ca592b3c10 ("meson: convert check-block")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index eea91772fa..2a6f29d1b5 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -66,7 +66,6 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
 	rmdir $(INITRD_WORK_DIR)
 
 tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
-tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 SPEED = quick
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/16] meson: convert vhost-user-bridge
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (7 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 08/16] meson: remove old socket_scm_helper rule marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 10/16] meson: convert atomic*-bench marcandre.lureau
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include | 2 --
 tests/meson.build      | 9 +++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 2a6f29d1b5..d4635f9b5b 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -65,8 +65,6 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
 	rm $(INITRD_WORK_DIR)/init
 	rmdir $(INITRD_WORK_DIR)
 
-tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
-
 SPEED = quick
 
 # gtester tests, possibly with verbose output
diff --git a/tests/meson.build b/tests/meson.build
index 6b04171c17..180011445d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -215,6 +215,15 @@ foreach test_name, extra_args: tests
        suite: suite)
 endforeach
 
+
+if have_tools and 'CONFIG_VHOST_USER' in config_host
+  executable('vhost-user-bridge',
+             sources: files('vhost-user-bridge.c'),
+             link_with: [libvhost_user],
+             dependencies: [qemuutil],
+             build_by_default: false)
+endif
+
 if have_system and 'CONFIG_POSIX' in config_host
   subdir('qemu-iotests')
 endif
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/16] meson: convert atomic*-bench
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (8 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 09/16] meson: convert vhost-user-bridge marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 11/16] tests/Makefile.include: update check-build marcandre.lureau
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include |  5 -----
 tests/meson.build      | 10 ++++++++++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index d4635f9b5b..30de192567 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -44,11 +44,6 @@ check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
 
 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
 
-# Deps that are common to various different sets of tests below
-test-util-obj-y = libqemuutil.a
-tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
-tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
-
 tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
 tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
 tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
diff --git a/tests/meson.build b/tests/meson.build
index 180011445d..a2902bde45 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -4,6 +4,16 @@ qht_bench = executable('qht-bench',
                        sources: files('qht-bench.c'),
                        dependencies: [qemuutil])
 
+executable('atomic_add-bench',
+           sources: files('atomic_add-bench.c'),
+           dependencies: [qemuutil],
+           build_by_default: false)
+
+executable('atomic64-bench',
+           sources: files('atomic64-bench.c'),
+           dependencies: [qemuutil],
+           build_by_default: false)
+
 test_qapi_outputs = [
   'qapi-builtin-types.c',
   'qapi-builtin-types.h',
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/16] tests/Makefile.include: update check-build
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (9 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 10/16] meson: convert atomic*-bench marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 12/16] tests: do not print benchmark output to stdout marcandre.lureau
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 30de192567..9fb61ff900 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -23,7 +23,7 @@ endif
 	@echo " $(MAKE) check-clean          Clean the tests and related data"
 	@echo
 	@echo "The following are useful for CI builds"
-	@echo " $(MAKE) check-build          Build most test binaris"
+	@echo " $(MAKE) check-build          Build most test binaries"
 	@echo " $(MAKE) get-vm-images        Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)"
 	@echo
 	@echo
@@ -195,7 +195,6 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
 
 .PHONY: check-block check check-clean get-vm-images
 check-block:
-check-build:
 
 check-clean:
 	rm -rf tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/16] tests: do not print benchmark output to stdout
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (10 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 11/16] tests/Makefile.include: update check-build marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-31 17:43   ` Philippe Mathieu-Daudé
  2020-08-28 11:07 ` [PATCH 13/16] meson: convert the speed tests marcandre.lureau
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

As this makes the TAP output invalid. Use g_test_message().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/benchmark-crypto-cipher.c | 8 ++++----
 tests/benchmark-crypto-hash.c   | 2 +-
 tests/benchmark-crypto-hmac.c   | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c
index 53032334ec..1936aa4ae0 100644
--- a/tests/benchmark-crypto-cipher.c
+++ b/tests/benchmark-crypto-cipher.c
@@ -70,8 +70,8 @@ static void test_cipher_speed(size_t chunk_size,
     }
     g_test_timer_elapsed();
 
-    g_print("Enc chunk %zu bytes ", chunk_size);
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("Enc chunk %zu bytes ", chunk_size);
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     g_test_timer_start();
     remain = total;
@@ -85,8 +85,8 @@ static void test_cipher_speed(size_t chunk_size,
     }
     g_test_timer_elapsed();
 
-    g_print("Dec chunk %zu bytes ", chunk_size);
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("Dec chunk %zu bytes ", chunk_size);
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     qcrypto_cipher_free(cipher);
     g_free(plaintext);
diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
index d16837d00a..598111e75a 100644
--- a/tests/benchmark-crypto-hash.c
+++ b/tests/benchmark-crypto-hash.c
@@ -48,7 +48,7 @@ static void test_hash_speed(const void *opaque)
     }
     g_test_timer_elapsed();
 
-    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+    g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
 
     g_free(out);
     g_free(in);
diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
index f1dfa240cb..f9fa22df95 100644
--- a/tests/benchmark-crypto-hmac.c
+++ b/tests/benchmark-crypto-hmac.c
@@ -55,10 +55,10 @@ static void test_hmac_speed(const void *opaque)
     } while (g_test_timer_elapsed() < 5.0);
 
     total /= MiB;
-    g_print("hmac(sha256): ");
-    g_print("Testing chunk_size %zu bytes ", chunk_size);
-    g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
-    g_print("%.2f MB/sec\n", total / g_test_timer_last());
+    g_test_message("hmac(sha256): ");
+    g_test_message("Testing chunk_size %zu bytes ", chunk_size);
+    g_test_message("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
+    g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
 
     g_free(out);
     g_free(in);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/16] meson: convert the speed tests
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (11 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 12/16] tests: do not print benchmark output to stdout marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 14/16] tests/migration/stress: remove unused exit_success marcandre.lureau
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Use meson benchmark() for them, adjust mtest2make.py for that.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 Makefile               |  2 +-
 scripts/mtest2make.py  |  3 ++-
 tests/Makefile.include | 11 -----------
 tests/meson.build      | 16 ++++++++++++++++
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 81794d5c34..a2d068ca37 100644
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@ ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
 # reread (and MESON won't be empty anymore).
 ifneq ($(MESON),)
 Makefile.mtest: build.ninja scripts/mtest2make.py
-	$(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
+	$(MESON) introspect --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
 -include Makefile.mtest
 endif
 
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index d7a51bf97e..06d017154c 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -50,7 +50,8 @@ endef
 
 suites = defaultdict(Suite)
 i = 0
-for test in json.load(sys.stdin):
+introspect = json.load(sys.stdin)
+for test in introspect['tests'] + introspect['benchmarks']:
     env = ' '.join(('%s=%s' % (shlex.quote(k), shlex.quote(v))
                     for k, v in test['env'].items()))
     executable = test['cmd'][0]
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9fb61ff900..30d4c6f932 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -38,16 +38,8 @@ export SRC_PATH
 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
 
-check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
-check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
-check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
-
 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
 
-tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
-tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
-tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
-
 tests/migration/stress$(EXESUF): tests/migration/stress.o
 	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
 
@@ -97,9 +89,6 @@ define do_test_tap
 	  "TAP","$@")
 endef
 
-check-speed: $(check-speed-y)
-	$(call do_test_human, $^)
-
 # Per guest TCG tests
 
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
diff --git a/tests/meson.build b/tests/meson.build
index a2902bde45..4d6bcf06b3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -108,6 +108,8 @@ tests = {
   'test-qapi-util': {},
 }
 
+benchs = {}
+
 if have_block
   tests += {
     'test-coroutine': {'deps': [testblock]},
@@ -166,6 +168,11 @@ if have_block
   if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
     tests += {'test-crypto-pbkdf': {'deps': [io]}}
   endif
+  benchs += {
+     'benchmark-crypto-hash': {'deps': [crypto]},
+     'benchmark-crypto-hmac': {'deps': [crypto]},
+     'benchmark-crypto-cipher': {'deps': [crypto]},
+  }
 endif
 
 if have_system
@@ -225,6 +232,15 @@ foreach test_name, extra_args: tests
        suite: suite)
 endforeach
 
+foreach bench_name, extra_args: benchs
+  src = extra_args.get('src', [bench_name + '.c'])
+  exe = executable(bench_name, src,
+                   dependencies: [qemuutil] + extra_args.get('deps', []))
+  benchmark(bench_name, exe,
+            args: ['--tap', '-k'],
+            protocol: 'tap',
+            suite: ['speed'])
+endforeach
 
 if have_tools and 'CONFIG_VHOST_USER' in config_host
   executable('vhost-user-bridge',
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 14/16] tests/migration/stress: remove unused exit_success
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (12 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 13/16] meson: convert the speed tests marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 15/16] meson: fix migration/stress compilation with glib>=2.30 marcandre.lureau
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/migration/stress.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index a062ef6b55..05d85051e3 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -47,19 +47,6 @@ static __attribute__((noreturn)) void exit_failure(void)
     }
 }
 
-static __attribute__((noreturn)) void exit_success(void)
-{
-    if (getpid() == 1) {
-        sync();
-        reboot(RB_POWER_OFF);
-        fprintf(stderr, "%s (%05d): ERROR: cannot reboot: %s\n",
-                argv0, gettid(), strerror(errno));
-        abort();
-    } else {
-        exit(0);
-    }
-}
-
 static int get_command_arg_str(const char *name,
                                char **val)
 {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 15/16] meson: fix migration/stress compilation with glib>=2.30
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (13 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 14/16] tests/migration/stress: remove unused exit_success marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 11:07 ` [PATCH 16/16] meson: convert migration/initrd-stress marcandre.lureau
  2020-08-28 12:56 ` [PATCH 00/16] meson: convert unit tests in tests/Makefile.include Thomas Huth
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

gettid() was introduced with glibc 2.30.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 meson.build              | 3 +++
 tests/migration/stress.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/meson.build b/meson.build
index 421f53083e..a8e074f4fa 100644
--- a/meson.build
+++ b/meson.build
@@ -408,6 +408,8 @@ if 'CONFIG_TASN1' in config_host
 endif
 keyutils = dependency('keyutils', required: false)
 
+has_gettid = cc.has_function('gettid')
+
 # Create config-host.h
 
 config_host_data.set('CONFIG_SDL', sdl.found())
@@ -418,6 +420,7 @@ config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
+config_host_data.set('CONFIG_GETTID', has_gettid)
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index 05d85051e3..0c72a420be 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -29,10 +29,12 @@ const char *argv0;
 
 #define PAGE_SIZE 4096
 
+#ifndef CONFIG_GETTID
 static int gettid(void)
 {
     return syscall(SYS_gettid);
 }
+#endif
 
 static __attribute__((noreturn)) void exit_failure(void)
 {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 16/16] meson: convert migration/initrd-stress
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (14 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 15/16] meson: fix migration/stress compilation with glib>=2.30 marcandre.lureau
@ 2020-08-28 11:07 ` marcandre.lureau
  2020-08-28 12:56 ` [PATCH 00/16] meson: convert unit tests in tests/Makefile.include Thomas Huth
  16 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2020-08-28 11:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/Makefile.include           | 14 --------------
 tests/meson.build                |  1 +
 tests/migration/initrd-stress.sh | 10 ++++++++++
 tests/migration/meson.build      | 14 ++++++++++++++
 4 files changed, 25 insertions(+), 14 deletions(-)
 create mode 100755 tests/migration/initrd-stress.sh
 create mode 100644 tests/migration/meson.build

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 30d4c6f932..0d36bd11d4 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -38,20 +38,6 @@ export SRC_PATH
 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
 
-QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
-
-tests/migration/stress$(EXESUF): tests/migration/stress.o
-	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
-
-INITRD_WORK_DIR=tests/migration/initrd
-
-tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
-	mkdir -p $(INITRD_WORK_DIR)
-	cp $< $(INITRD_WORK_DIR)/init
-	(cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
-	rm $(INITRD_WORK_DIR)/init
-	rmdir $(INITRD_WORK_DIR)
-
 SPEED = quick
 
 # gtester tests, possibly with verbose output
diff --git a/tests/meson.build b/tests/meson.build
index 4d6bcf06b3..257a474daa 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -268,3 +268,4 @@ endif
 
 subdir('qapi-schema')
 subdir('qtest')
+subdir('migration')
diff --git a/tests/migration/initrd-stress.sh b/tests/migration/initrd-stress.sh
new file mode 100755
index 0000000000..0f20ac29a6
--- /dev/null
+++ b/tests/migration/initrd-stress.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+INITRD="$1"
+STRESS="$2"
+
+INITRD_DIR=$(mktemp -d -p '' "initrd-stress.XXXXXX")
+trap 'rm -rf $INITRD_DIR' EXIT
+
+cp "$STRESS" "$INITRD_DIR/init"
+(cd "$INITRD_DIR" && (find | cpio --quiet -o -H newc | gzip -9)) > "$INITRD"
diff --git a/tests/migration/meson.build b/tests/migration/meson.build
new file mode 100644
index 0000000000..f215ee7d3a
--- /dev/null
+++ b/tests/migration/meson.build
@@ -0,0 +1,14 @@
+stress = executable(
+  'stress',
+  files('stress.c'),
+  dependencies: [glib],
+  link_args: ['-static'],
+  build_by_default: false,
+)
+
+custom_target(
+  'initrd-stress.img',
+  output: 'initrd-stress.img',
+  input: stress,
+  command: [find_program('initrd-stress.sh'), '@OUTPUT@', '@INPUT@']
+)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 05/16] tests: qga has virtio-serial by default when host has it
  2020-08-28 11:07 ` [PATCH 05/16] tests: qga has virtio-serial by default when host has it marcandre.lureau
@ 2020-08-28 12:54   ` Thomas Huth
  2020-08-28 13:47     ` Marc-André Lureau
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2020-08-28 12:54 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel; +Cc: pbonzini

On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> When dumping the default configuration, don't expect virtio-serial as
> the configured method, unless the host has CONFIG_VIRTIO_SERIAL.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/test-qga.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/test-qga.c b/tests/test-qga.c
> index 4ac4c22109..122730d326 100644
> --- a/tests/test-qga.c
> +++ b/tests/test-qga.c
> @@ -728,10 +728,12 @@ static void test_qga_config(gconstpointer data)
>      g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
>      g_assert_no_error(error);
>  
> +#ifdef CONFIG_VIRTIO_SERIAL
>      str = g_key_file_get_string(kf, "general", "method", &error);
>      g_assert_no_error(error);
>      g_assert_cmpstr(str, ==, "virtio-serial");
>      g_free(str);
> +#endif
>  
>      str = g_key_file_get_string(kf, "general", "path", &error);
>      g_assert_no_error(error);

Does this work as expected? I thought that CONFIG_VIRTIO_SERIAL is a
*target* specific config switch, not a host specific one ?

 Thomas



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] meson: convert unit tests in tests/Makefile.include
  2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
                   ` (15 preceding siblings ...)
  2020-08-28 11:07 ` [PATCH 16/16] meson: convert migration/initrd-stress marcandre.lureau
@ 2020-08-28 12:56 ` Thomas Huth
  2020-08-28 12:59   ` Marc-André Lureau
  16 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2020-08-28 12:56 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel; +Cc: pbonzini

On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Hi,
> 
> This series convert the unit tests from tests/Makefile.include to meson.

Just an optional idea: What about moving the unit tests to a separate
subdirectory a la tests/unit/ , too?

 Thomas



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] meson: convert unit tests in tests/Makefile.include
  2020-08-28 12:56 ` [PATCH 00/16] meson: convert unit tests in tests/Makefile.include Thomas Huth
@ 2020-08-28 12:59   ` Marc-André Lureau
  2020-08-28 13:25     ` Thomas Huth
  0 siblings, 1 reply; 23+ messages in thread
From: Marc-André Lureau @ 2020-08-28 12:59 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Paolo Bonzini, QEMU

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Hi

On Fri, Aug 28, 2020 at 4:56 PM Thomas Huth <thuth@redhat.com> wrote:

> On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Hi,
> >
> > This series convert the unit tests from tests/Makefile.include to meson.
>
> Just an optional idea: What about moving the unit tests to a separate
> subdirectory a la tests/unit/ , too?
>
>
Sounds like a good idea to me, but there is already quite a lot going on in
this series :) Let's add that to the todo list, shall we?

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1139 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] meson: convert unit tests in tests/Makefile.include
  2020-08-28 12:59   ` Marc-André Lureau
@ 2020-08-28 13:25     ` Thomas Huth
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2020-08-28 13:25 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Paolo Bonzini, QEMU

On 28/08/2020 14.59, Marc-André Lureau wrote:
> Hi
> 
> On Fri, Aug 28, 2020 at 4:56 PM Thomas Huth <thuth@redhat.com
> <mailto:thuth@redhat.com>> wrote:
> 
>     On 28/08/2020 13.07, marcandre.lureau@redhat.com
>     <mailto:marcandre.lureau@redhat.com> wrote:
>     > From: Marc-André Lureau <marcandre.lureau@redhat.com
>     <mailto:marcandre.lureau@redhat.com>>
>     >
>     > Hi,
>     >
>     > This series convert the unit tests from tests/Makefile.include to
>     meson.
> 
>     Just an optional idea: What about moving the unit tests to a separate
>     subdirectory a la tests/unit/ , too?
> 
> 
> Sounds like a good idea to me, but there is already quite a lot going on
> in this series :) Let's add that to the todo list, shall we?

Sure, that's why I wrote "optional" :-)

 Thomas



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 05/16] tests: qga has virtio-serial by default when host has it
  2020-08-28 12:54   ` Thomas Huth
@ 2020-08-28 13:47     ` Marc-André Lureau
  0 siblings, 0 replies; 23+ messages in thread
From: Marc-André Lureau @ 2020-08-28 13:47 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Bonzini, Paolo, qemu-devel

Hi

On Fri, Aug 28, 2020 at 4:55 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > When dumping the default configuration, don't expect virtio-serial as
> > the configured method, unless the host has CONFIG_VIRTIO_SERIAL.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  tests/test-qga.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tests/test-qga.c b/tests/test-qga.c
> > index 4ac4c22109..122730d326 100644
> > --- a/tests/test-qga.c
> > +++ b/tests/test-qga.c
> > @@ -728,10 +728,12 @@ static void test_qga_config(gconstpointer data)
> >      g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
> >      g_assert_no_error(error);
> >
> > +#ifdef CONFIG_VIRTIO_SERIAL
> >      str = g_key_file_get_string(kf, "general", "method", &error);
> >      g_assert_no_error(error);
> >      g_assert_cmpstr(str, ==, "virtio-serial");
> >      g_free(str);
> > +#endif
> >
> >      str = g_key_file_get_string(kf, "general", "path", &error);
> >      g_assert_no_error(error);
>
> Does this work as expected? I thought that CONFIG_VIRTIO_SERIAL is a
> *target* specific config switch, not a host specific one ?

You are right, it's basically dead code then. I'll drop this patch for
now, or come up with something better. It was from an earlier attempt
where test-qga was running under !linux. I will try that again.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 12/16] tests: do not print benchmark output to stdout
  2020-08-28 11:07 ` [PATCH 12/16] tests: do not print benchmark output to stdout marcandre.lureau
@ 2020-08-31 17:43   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-08-31 17:43 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers

[-- Attachment #1: Type: text/plain, Size: 3070 bytes --]

Le ven. 28 août 2020 13:11, <marcandre.lureau@redhat.com> a écrit :

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> As this makes the TAP output invalid. Use g_test_message().
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

---
>  tests/benchmark-crypto-cipher.c | 8 ++++----
>  tests/benchmark-crypto-hash.c   | 2 +-
>  tests/benchmark-crypto-hmac.c   | 8 ++++----
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tests/benchmark-crypto-cipher.c
> b/tests/benchmark-crypto-cipher.c
> index 53032334ec..1936aa4ae0 100644
> --- a/tests/benchmark-crypto-cipher.c
> +++ b/tests/benchmark-crypto-cipher.c
> @@ -70,8 +70,8 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>
> -    g_print("Enc chunk %zu bytes ", chunk_size);
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("Enc chunk %zu bytes ", chunk_size);
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      g_test_timer_start();
>      remain = total;
> @@ -85,8 +85,8 @@ static void test_cipher_speed(size_t chunk_size,
>      }
>      g_test_timer_elapsed();
>
> -    g_print("Dec chunk %zu bytes ", chunk_size);
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("Dec chunk %zu bytes ", chunk_size);
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      qcrypto_cipher_free(cipher);
>      g_free(plaintext);
> diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
> index d16837d00a..598111e75a 100644
> --- a/tests/benchmark-crypto-hash.c
> +++ b/tests/benchmark-crypto-hash.c
> @@ -48,7 +48,7 @@ static void test_hash_speed(const void *opaque)
>      }
>      g_test_timer_elapsed();
>
> -    g_print("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
> +    g_test_message("%.2f MB/sec ", (double)total / MiB /
> g_test_timer_last());
>
>      g_free(out);
>      g_free(in);
> diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
> index f1dfa240cb..f9fa22df95 100644
> --- a/tests/benchmark-crypto-hmac.c
> +++ b/tests/benchmark-crypto-hmac.c
> @@ -55,10 +55,10 @@ static void test_hmac_speed(const void *opaque)
>      } while (g_test_timer_elapsed() < 5.0);
>
>      total /= MiB;
> -    g_print("hmac(sha256): ");
> -    g_print("Testing chunk_size %zu bytes ", chunk_size);
> -    g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
> -    g_print("%.2f MB/sec\n", total / g_test_timer_last());
> +    g_test_message("hmac(sha256): ");
> +    g_test_message("Testing chunk_size %zu bytes ", chunk_size);
> +    g_test_message("done: %.2f MB in %.2f secs: ", total,
> g_test_timer_last());
> +    g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
>
>      g_free(out);
>      g_free(in);
> --
> 2.26.2
>
>
>

[-- Attachment #2: Type: text/html, Size: 4450 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-08-31 21:29 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 11:07 [PATCH 00/16] meson: convert unit tests in tests/Makefile.include marcandre.lureau
2020-08-28 11:07 ` [PATCH 01/16] meson: build qapi tests library marcandre.lureau
2020-08-28 11:07 ` [PATCH 02/16] meson: declare tasn1 dependency marcandre.lureau
2020-08-28 11:07 ` [PATCH 03/16] meson: declare keyutils dependency marcandre.lureau
2020-08-28 11:07 ` [PATCH 04/16] meson: convert qht-bench marcandre.lureau
2020-08-28 11:07 ` [PATCH 05/16] tests: qga has virtio-serial by default when host has it marcandre.lureau
2020-08-28 12:54   ` Thomas Huth
2020-08-28 13:47     ` Marc-André Lureau
2020-08-28 11:07 ` [PATCH 06/16] meson: convert the unit tests marcandre.lureau
2020-08-28 11:07 ` [PATCH 07/16] meson: move keyutils dependency check marcandre.lureau
2020-08-28 11:07 ` [PATCH 08/16] meson: remove old socket_scm_helper rule marcandre.lureau
2020-08-28 11:07 ` [PATCH 09/16] meson: convert vhost-user-bridge marcandre.lureau
2020-08-28 11:07 ` [PATCH 10/16] meson: convert atomic*-bench marcandre.lureau
2020-08-28 11:07 ` [PATCH 11/16] tests/Makefile.include: update check-build marcandre.lureau
2020-08-28 11:07 ` [PATCH 12/16] tests: do not print benchmark output to stdout marcandre.lureau
2020-08-31 17:43   ` Philippe Mathieu-Daudé
2020-08-28 11:07 ` [PATCH 13/16] meson: convert the speed tests marcandre.lureau
2020-08-28 11:07 ` [PATCH 14/16] tests/migration/stress: remove unused exit_success marcandre.lureau
2020-08-28 11:07 ` [PATCH 15/16] meson: fix migration/stress compilation with glib>=2.30 marcandre.lureau
2020-08-28 11:07 ` [PATCH 16/16] meson: convert migration/initrd-stress marcandre.lureau
2020-08-28 12:56 ` [PATCH 00/16] meson: convert unit tests in tests/Makefile.include Thomas Huth
2020-08-28 12:59   ` Marc-André Lureau
2020-08-28 13:25     ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.