aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-09-03 14:23:36 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-09-03 14:23:36 +0100
commit9c03aa87e52567f6c9a7bf456e5dd94dc84088de (patch)
treed3c63b25ddaf5a1f6268bc40c81c9abff8df611e /tests
parent8880cc4362fde4ecdac0b2092318893118206fcf (diff)
parenta35af836d103f781d2fea437129732c16ba64b25 (diff)
Merge remote-tracking branch 'remotes/stsquad/tags/pull-for-6.2-020921-1' into staging
Testing and plugin updates: - fix typo in execlog plugin - clean-up and document gitlab FOO_RUNNER_AVAILABLE vars - fix plugin build issue on OSX and modules - add multi-core support to cache modelling plugin - clean-ups for plugin arg=FOO handling # gpg: Signature made Thu 02 Sep 2021 11:33:02 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-for-6.2-020921-1: (22 commits) docs/devel: be consistent about example plugin names docs/deprecated: deprecate passing plugin args through `arg=` tests/plugins/syscalls: adhere to new arg-passing scheme tests/plugins/mem: introduce "track" arg and make args not positional tests/plugins/insn: made arg inline not positional and parse it as bool tests/plugins/bb: adapt to the new arg passing scheme docs/tcg-plugins: new passing parameters scheme for cache docs plugins/howvec: adapting to the new argument passing scheme plugins/hwprofile: adapt to the new plugin arguments scheme plugins/lockstep: make socket path not positional & parse bool arg plugins/hotblocks: Added correct boolean argument parsing plugins/hotpages: introduce sortby arg and parsed bool args correctly plugins/api: added a boolean parsing plugin api plugins: allow plugin arguments to be passed directly docs/devel/tcg-plugins: added cores arg to cache plugin plugins: sort exported symbol list plugins/cache: supported multicore cache modelling plugins: do not limit exported symbols if modules are active gitlab-ci: Fix ..._RUNNER_AVAILABLE variables and document them gitlab-ci: Remove superfluous "dnf install" statement ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/plugin/bb.c15
-rw-r--r--tests/plugin/insn.c14
-rw-r--r--tests/plugin/mem.c47
-rw-r--r--tests/plugin/syscall.c23
-rw-r--r--tests/tcg/i386/Makefile.softmmu-target2
-rw-r--r--tests/tcg/i386/Makefile.target2
-rw-r--r--tests/tcg/x86_64/Makefile.softmmu-target2
7 files changed, 71 insertions, 34 deletions
diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
index de09bdde4e..7d470a1011 100644
--- a/tests/plugin/bb.c
+++ b/tests/plugin/bb.c
@@ -104,10 +104,17 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
for (i = 0; i < argc; i++) {
char *opt = argv[i];
- if (g_strcmp0(opt, "inline") == 0) {
- do_inline = true;
- } else if (g_strcmp0(opt, "idle") == 0) {
- idle_report = true;
+ g_autofree char **tokens = g_strsplit(opt, "=", 2);
+ if (g_strcmp0(tokens[0], "inline") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_inline)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
+ }
+ } else if (g_strcmp0(tokens[0], "idle") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &idle_report)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
+ }
} else {
fprintf(stderr, "option parsing failed: %s\n", opt);
return -1;
diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c
index c253980ec8..0f6a1938c1 100644
--- a/tests/plugin/insn.c
+++ b/tests/plugin/insn.c
@@ -62,8 +62,18 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info,
int argc, char **argv)
{
- if (argc && !strcmp(argv[0], "inline")) {
- do_inline = true;
+ for (int i = 0; i < argc; i++) {
+ char *opt = argv[i];
+ g_autofree char **tokens = g_strsplit(opt, "=", 2);
+ if (g_strcmp0(tokens[0], "inline") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_inline)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
+ }
+ } else {
+ fprintf(stderr, "option parsing failed: %s\n", opt);
+ return -1;
+ }
}
qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c
index afd1d27e5c..4570f7d815 100644
--- a/tests/plugin/mem.c
+++ b/tests/plugin/mem.c
@@ -80,29 +80,40 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info,
int argc, char **argv)
{
- if (argc) {
- if (argc >= 3) {
- if (!strcmp(argv[2], "haddr")) {
- do_haddr = true;
- }
- }
- if (argc >= 2) {
- const char *str = argv[1];
- if (!strcmp(str, "r")) {
+ for (int i = 0; i < argc; i++) {
+ char *opt = argv[i];
+ g_autofree char **tokens = g_strsplit(opt, "=", 2);
+
+ if (g_strcmp0(tokens[0], "haddr") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_haddr)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
+ }
+ } else if (g_strcmp0(tokens[0], "track") == 0) {
+ if (g_strcmp0(tokens[1], "r") == 0) {
rw = QEMU_PLUGIN_MEM_R;
- } else if (!strcmp(str, "w")) {
+ } else if (g_strcmp0(tokens[1], "w") == 0) {
rw = QEMU_PLUGIN_MEM_W;
+ } else if (g_strcmp0(tokens[1], "rw") == 0) {
+ rw = QEMU_PLUGIN_MEM_RW;
+ } else {
+ fprintf(stderr, "invaild value for argument track: %s\n", opt);
+ return -1;
+ }
+ } else if (g_strcmp0(tokens[0], "inline") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_inline)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
+ }
+ } else if (g_strcmp0(tokens[0], "callback") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_callback)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
+ return -1;
}
- }
- if (!strcmp(argv[0], "inline")) {
- do_inline = true;
- do_callback = false;
- } else if (!strcmp(argv[0], "both")) {
- do_inline = true;
- do_callback = true;
} else {
- do_callback = true;
+ fprintf(stderr, "option parsing failed: %s\n", opt);
+ return -1;
}
}
diff --git a/tests/plugin/syscall.c b/tests/plugin/syscall.c
index 6dd71092e1..484b48de49 100644
--- a/tests/plugin/syscall.c
+++ b/tests/plugin/syscall.c
@@ -119,17 +119,26 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info,
int argc, char **argv)
{
- if (argc == 0) {
- statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free);
- } else {
- for (int i = 0; i < argc; i++) {
- if (g_strcmp0(argv[i], "print") != 0) {
- fprintf(stderr, "unsupported argument: %s\n", argv[i]);
- return -1;
+ bool do_print = false;
+
+ for (int i = 0; i < argc; i++) {
+ char *opt = argv[i];
+ g_autofree char **tokens = g_strsplit(opt, "=", 2);
+
+ if (g_strcmp0(tokens[0], "print") == 0) {
+ if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_print)) {
+ fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
}
+ } else {
+ fprintf(stderr, "unsupported argument: %s\n", argv[i]);
+ return -1;
}
}
+ if (!do_print) {
+ statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free);
+ }
+
qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall);
qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target
index fa9b1b9f90..9b9038d0be 100644
--- a/tests/tcg/i386/Makefile.softmmu-target
+++ b/tests/tcg/i386/Makefile.softmmu-target
@@ -38,7 +38,7 @@ run-plugin-%-with-libinsn.so:
$(call run-test, $@, \
$(QEMU) -monitor none -display none \
-chardev file$(COMMA)path=$@.out$(COMMA)id=output \
- -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \
+ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
-d plugin -D $*-with-libinsn.so.pout \
$(QEMU_OPTS) $*, \
"$* on $(TARGET_NAME)")
diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target
index b0a2128980..a053ca3f15 100644
--- a/tests/tcg/i386/Makefile.target
+++ b/tests/tcg/i386/Makefile.target
@@ -61,7 +61,7 @@ endif
# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so
run-plugin-%-with-libinsn.so:
$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
- -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \
+ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
-d plugin -D $*-with-libinsn.so.pout $*, \
"$* (inline) on $(TARGET_NAME)")
diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.softmmu-target
index 9896319f0e..2afa3298bf 100644
--- a/tests/tcg/x86_64/Makefile.softmmu-target
+++ b/tests/tcg/x86_64/Makefile.softmmu-target
@@ -38,7 +38,7 @@ run-plugin-%-with-libinsn.so:
$(call run-test, $@, \
$(QEMU) -monitor none -display none \
-chardev file$(COMMA)path=$@.out$(COMMA)id=output \
- -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \
+ -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
-d plugin -D $*-with-libinsn.so.pout \
$(QEMU_OPTS) $*, \
"$* on $(TARGET_NAME)")