aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-08-22 13:13:35 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-08-22 13:13:35 +0100
commit810923480863c43ecb22ae124156298385439339 (patch)
tree786989fcc3da6a00bcabd53b9289bffcc2c0f55b /tests
parentf3b8f18ebf344ab359e8f79f6ed777e740dae77c (diff)
parent78d01598aea85841f0e4f8baf62c42b76230a81c (diff)
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* Longstanding chardev race condition fix (Berto) * Cleanups and tests from the Meson POC (Marc-André, myself) * Coalesced range cleanup (Peter) # gpg: Signature made Wed 21 Aug 2019 18:27:43 BST # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: char-socket: Lock tcp_chr_disconnect() and socket_reconnect_timeout() main-loop: Fix GSource leak in qio_task_thread_worker() memory: Fix up memory_region_{add|del}_coalescing memory: Remove has_coalesced_range counter memory: Split zones when do coalesced_io_del() memory: Refactor memory_region_clear_coalescing minikconf: don't print CONFIG_FOO=n lines configure: remove AUTOCONF_HOST tests: add module loading test module: return success on module load module: use g_hash_table_add() configure: define CONFIG_TOOLS here qemu-ga: clean up TOOLS variable Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.include1
-rw-r--r--tests/libqtest.c6
-rw-r--r--tests/libqtest.h2
-rw-r--r--tests/modules-test.c71
4 files changed, 80 insertions, 0 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 6f02dfcc01..39bed753b3 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -149,6 +149,7 @@ check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.
check-qtest-generic-y += tests/qmp-test$(EXESUF)
check-qtest-generic-y += tests/qmp-cmd-test$(EXESUF)
+check-qtest-generic-$(CONFIG_MODULES) += tests/modules-test$(EXESUF)
check-qtest-generic-y += tests/device-introspect-test$(EXESUF)
check-qtest-generic-y += tests/cdrom-test$(EXESUF)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index eb971d0d11..2713b86cf7 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -811,6 +811,12 @@ bool qtest_get_irq(QTestState *s, int num)
return s->irq_level[num];
}
+void qtest_module_load(QTestState *s, const char *prefix, const char *libname)
+{
+ qtest_sendf(s, "module_load %s %s\n", prefix, libname);
+ qtest_rsp(s, 0);
+}
+
static int64_t qtest_clock_rsp(QTestState *s)
{
gchar **words;
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 7833148358..07ea35867c 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -262,6 +262,8 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
GCC_FMT_ATTR(2, 0);
+void qtest_module_load(QTestState *s, const char *prefix, const char *libname);
+
/**
* qtest_get_irq:
* @s: #QTestState instance to operate on.
diff --git a/tests/modules-test.c b/tests/modules-test.c
new file mode 100644
index 0000000000..3aef0e5a19
--- /dev/null
+++ b/tests/modules-test.c
@@ -0,0 +1,71 @@
+#include "qemu/osdep.h"
+#include "libqtest.h"
+
+static void test_modules_load(const void *data)
+{
+ QTestState *qts;
+ const char **args = data;
+
+ qts = qtest_init(NULL);
+ qtest_module_load(qts, args[0], args[1]);
+ qtest_quit(qts);
+}
+
+int main(int argc, char *argv[])
+{
+ const char *modules[] = {
+#ifdef CONFIG_CURL
+ "block-", "curl",
+#endif
+#ifdef CONFIG_GLUSTERFS
+ "block-", "gluster",
+#endif
+#ifdef CONFIG_LIBISCSI
+ "block-", "iscsi",
+#endif
+#ifdef CONFIG_LIBNFS
+ "block-", "nfs",
+#endif
+#ifdef CONFIG_LIBSSH
+ "block-", "ssh",
+#endif
+#ifdef CONFIG_RBD
+ "block-", "rbd",
+#endif
+#ifdef CONFIG_AUDIO_ALSA
+ "audio-", "alsa",
+#endif
+#ifdef CONFIG_AUDIO_OSS
+ "audio-", "oss",
+#endif
+#ifdef CONFIG_AUDIO_PA
+ "audio-", "pa",
+#endif
+#ifdef CONFIG_AUDIO_SDL
+ "audio-", "sdl",
+#endif
+#ifdef CONFIG_CURSES
+ "ui-", "curses",
+#endif
+#if defined(CONFIG_GTK) && defined(CONFIG_VTE)
+ "ui-", "gtk",
+#endif
+#ifdef CONFIG_SDL
+ "ui-", "sdl",
+#endif
+#if defined(CONFIG_SPICE) && defined(CONFIG_GIO)
+ "ui-", "spice-app",
+#endif
+ };
+ int i;
+
+ g_test_init(&argc, &argv, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS(modules); i += 2) {
+ char *testname = g_strdup_printf("/module/load/%s", modules[i + 1]);
+ qtest_add_data_func(testname, modules + i, test_modules_load);
+ g_free(testname);
+ }
+
+ return g_test_run();
+}