aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/libqtest.h8
-rw-r--r--tests/test-hmp.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 44803d772e..86b3a3bb0d 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -134,14 +134,14 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
/**
* qtest_hmp:
* @s: #QTestState instance to operate on.
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
*
* Send HMP command to QEMU via QMP's human-monitor-command.
* QMP events are discarded.
*
* Returns: the command's output. The caller should g_free() it.
*/
-char *qtest_hmp(QTestState *s, const char *fmt, ...);
+char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
/**
* qtest_hmpv:
@@ -592,13 +592,13 @@ static inline QDict *qmp_eventwait_ref(const char *event)
/**
* hmp:
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
*
* Send HMP command to QEMU via QMP's human-monitor-command.
*
* Returns: the command's output. The caller should g_free() it.
*/
-char *hmp(const char *fmt, ...);
+char *hmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
/**
* get_irq:
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 4156d6111b..5677fbf775 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -81,7 +81,7 @@ static void test_commands(void)
if (verbose) {
fprintf(stderr, "\t%s\n", hmp_cmds[i]);
}
- response = hmp(hmp_cmds[i]);
+ response = hmp("%s", hmp_cmds[i]);
g_free(response);
}
@@ -104,7 +104,7 @@ static void test_info_commands(void)
if (verbose) {
fprintf(stderr, "\t%s\n", info);
}
- resp = hmp(info);
+ resp = hmp("%s", info);
g_free(resp);
/* And move forward to the next line */
info = strchr(endp + 1, '\n');