@@ -465,20 +465,20 @@ static inline void qtest_end(void)
QDict *qmp_raw(const char *msg);
/**
- * qmp_cmd:
+ * qmp:
* @cmd: QMP command, with no arguments.
*
* Sends a QMP message to QEMU and returns the response.
*/
-QDict *qmp_cmd(const char *cmd);
+QDict *qmp(const char *cmd);
/**
- * qmp_cmd_async:
+ * qmp_async:
* @cmd: QMP command, with no arguments.
*
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
-void qmp_cmd_async(const char *cmd);
+void qmp_async(const char *cmd);
/**
* qmp_args_dict:
@@ -512,7 +512,7 @@ void qmp_args_async(const char *cmd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
/**
* qmp_discard_response:
*
- * Read and discard a QMP response, typically after qmp_cmd_async().
+ * Read and discard a QMP response, typically after qmp_async().
*/
void qmp_discard_response(void);
@@ -834,13 +834,13 @@ QDict *qmp_raw(const char *msg)
return qtest_qmp_receive(global_qtest);
}
-QDict *qmp_cmd(const char *cmd)
+QDict *qmp(const char *cmd)
{
- qmp_cmd_async(cmd);
+ qmp_async(cmd);
return qtest_qmp_receive(global_qtest);
}
-void qmp_cmd_async(const char *cmd)
+void qmp_async(const char *cmd)
{
qtest_qmp_send(global_qtest, "{'execute':%s}", cmd);
}
@@ -912,7 +912,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine))
const char *mname;
qtest_start("-machine none");
- response = qmp_cmd("query-machines");
+ response = qmp("query-machines");
g_assert(response);
list = qdict_get_qlist(response, "return");
g_assert(list);
@@ -1385,7 +1385,7 @@ static void test_flush_migrate(void)
ahci_migrate(src, dst, uri);
/* Complete the command */
- qmp_cmd_async("cont");
+ qmp_async("cont");
qmp_eventwait("RESUME");
ahci_command_wait(dst, cmd);
ahci_command_verify(dst, cmd);
@@ -38,7 +38,7 @@ static void test_a_boot_order(const char *machine,
qtest_start(args);
actual = read_boot_order();
g_assert_cmphex(actual, ==, expected_boot);
- qmp_cmd_async("system_reset");
+ qmp_async("system_reset");
/*
* system_reset only requests reset. We get a RESET event after
* the actual reset completes. Need to wait for that.
@@ -651,7 +651,7 @@ static void test_retry_flush(const char *machine)
qmp_eventwait("STOP");
/* Complete the command */
- qmp_cmd_async("cont");
+ qmp_async("cont");
qmp_discard_response();
/* Check registers */
@@ -668,7 +668,7 @@ void ahci_exec(AHCIQState *ahci, uint8_t port,
g_assert_cmpint(rc, ==, 0);
}
if (opts->error) {
- qmp_cmd_async("cont");
+ qmp_async("cont");
qmp_eventwait("RESUME");
}
@@ -706,7 +706,7 @@ AHCICommand *ahci_guest_io_halt(AHCIQState *ahci, uint8_t port,
void ahci_guest_io_resume(AHCIQState *ahci, AHCICommand *cmd)
{
/* Complete the command */
- qmp_cmd_async("cont");
+ qmp_async("cont");
qmp_eventwait("RESUME");
ahci_command_wait(ahci, cmd);
ahci_command_verify(ahci, cmd);
@@ -93,7 +93,7 @@ void migrate(QOSState *from, QOSState *to, const char *uri)
set_context(from);
/* Is the machine currently running? */
- rsp = qmp_cmd("query-status");
+ rsp = qmp("query-status");
g_assert(qdict_haskey(rsp, "return"));
sub = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(sub, "running"));
@@ -120,7 +120,7 @@ void migrate(QOSState *from, QOSState *to, const char *uri)
/* Otherwise, we need to wait: poll until migration is completed. */
while (1) {
- rsp = qmp_cmd("query-migrate");
+ rsp = qmp("query-migrate");
g_assert(qdict_haskey(rsp, "return"));
sub = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(sub, "status"));
@@ -74,7 +74,7 @@ static void test_mon_partial(const void *data)
static QList *get_cpus(QDict **resp)
{
- *resp = qmp_cmd("query-cpus");
+ *resp = qmp("query-cpus");
g_assert(*resp);
g_assert(qdict_haskey(*resp, "return"));
return qdict_get_qlist(*resp, "return");
@@ -252,7 +252,7 @@ static uint64_t get_migration_pass(void)
QDict *rsp, *rsp_return, *rsp_ram;
uint64_t result;
- rsp = return_or_event(qmp_cmd("query-migrate"));
+ rsp = return_or_event(qmp("query-migrate"));
rsp_return = qdict_get_qdict(rsp, "return");
if (!qdict_haskey(rsp_return, "ram")) {
/* Still in setup */
@@ -273,7 +273,7 @@ static void wait_for_migration_complete(void)
do {
const char *status;
- rsp = return_or_event(qmp_cmd("query-migrate"));
+ rsp = return_or_event(qmp("query-migrate"));
rsp_return = qdict_get_qdict(rsp, "return");
status = qdict_get_str(rsp_return, "status");
completed = strcmp(status, "completed") == 0;
@@ -445,7 +445,7 @@ static void test_migrate(void)
wait_for_migration_pass();
- rsp = return_or_event(qmp_cmd("migrate-start-postcopy"));
+ rsp = return_or_event(qmp("migrate-start-postcopy"));
g_assert(qdict_haskey(rsp, "return"));
QDECREF(rsp);
@@ -472,7 +472,7 @@ static void test_migrate(void)
usleep(10 * 1000);
} while (dest_byte_a == dest_byte_b);
- qmp_cmd_async("stop");
+ qmp_async("stop");
qmp_discard_response();
/* With it stopped, check nothing changes */
qtest_memread(to, start_address, &dest_byte_c, 1);
@@ -105,7 +105,7 @@ static void test_smram_lock(void)
g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false);
/* reset */
- response = qmp_cmd("system_reset");
+ response = qmp("system_reset");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
QDECREF(response);
@@ -92,7 +92,7 @@ static void test_qmp_protocol(void)
QDECREF(resp);
/* Test valid command before handshake */
- resp = qmp_cmd("query-version");
+ resp = qmp("query-version");
g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound");
QDECREF(resp);
@@ -100,18 +100,18 @@ static void test_qmp_protocol(void)
test_malformed();
/* Test handshake */
- resp = qmp_cmd("qmp_capabilities");
+ resp = qmp("qmp_capabilities");
ret = qdict_get_qdict(resp, "return");
g_assert(ret && !qdict_size(ret));
QDECREF(resp);
/* Test repeated handshake */
- resp = qmp_cmd("qmp_capabilities");
+ resp = qmp("qmp_capabilities");
g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound");
QDECREF(resp);
/* Test valid command */
- resp = qmp_cmd("query-version");
+ resp = qmp("query-version");
test_version(qdict_get(resp, "return"));
QDECREF(resp);
@@ -95,7 +95,7 @@ static void test_machine(gconstpointer data)
test_properties("/machine", true);
- response = qmp_cmd("quit");
+ response = qmp("quit");
g_assert(qdict_haskey(response, "return"));
QDECREF(response);
@@ -57,7 +57,7 @@ static void test_mirror(void)
};
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp_cmd_async("query-status");
+ qmp_async("query-status");
qmp_discard_response();
ret = iov_send(send_sock[0], iov, 2, 0, sizeof(size) + sizeof(send_buf));
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
@@ -99,7 +99,7 @@ static void test_redirector_tx(void)
g_assert_cmpint(recv_sock, !=, -1);
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp_cmd_async("query-status");
+ qmp_async("query-status");
qmp_discard_response();
struct iovec iov[] = {
@@ -185,7 +185,7 @@ static void test_redirector_rx(void)
send_sock = unix_connect(sock_path1, NULL);
g_assert_cmpint(send_sock, !=, -1);
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp_cmd_async("query-status");
+ qmp_async("query-status");
qmp_discard_response();
ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf));
@@ -13,7 +13,7 @@ static char *get_cpu0_qom_path(void)
QDict *cpu0;
char *path;
- resp = qmp_cmd("query-cpus");
+ resp = qmp("query-cpus");
g_assert(qdict_haskey(resp, "return"));
ret = qdict_get_qlist(resp, "return");
@@ -167,7 +167,7 @@ static void rx_stop_cont_test(QVirtioDevice *dev,
free_head = qvirtqueue_add(vq, req_addr, 64, true, false);
qvirtqueue_kick(dev, vq, free_head);
- qmp_cmd_async("stop");
+ qmp_async("stop");
qmp_discard_response();
ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));
@@ -176,9 +176,9 @@ static void rx_stop_cont_test(QVirtioDevice *dev,
/* We could check the status, but this command is more importantly to
* ensure the packet data gets queued in QEMU, before we do 'cont'.
*/
- qmp_cmd_async("query-status");
+ qmp_async("query-status");
qmp_discard_response();
- qmp_cmd_async("cont");
+ qmp_async("cont");
qmp_discard_response();
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US);
@@ -118,7 +118,7 @@ static void read_guid_from_monitor(QemuUUID *guid)
QDict *rsp, *rsp_ret;
const char *guid_str;
- rsp = qmp_cmd("query-vm-generation-id");
+ rsp = qmp("query-vm-generation-id");
if (qdict_haskey(rsp, "return")) {
rsp_ret = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(rsp_ret, "guid"));
@@ -13,7 +13,7 @@
static void qmp_check_no_event(void)
{
- QDict *resp = qmp_cmd("query-status");
+ QDict *resp = qmp("query-status");
g_assert(qdict_haskey(resp, "return"));
QDECREF(resp);
}
Now that the previous patch got rid of the old signature of qmp(), we can go back to using the shortest possible name for the common action. Performed mechanically with: for f in $(git grep -l qmp_cmd tests/); do case $f in *qemu-iotests*) continue;; esac sed -i s/qmp_cmd/qmp/ $f; done Signed-off-by: Eric Blake <eblake@redhat.com> --- tests/libqtest.h | 10 +++++----- tests/libqtest.c | 8 ++++---- tests/ahci-test.c | 2 +- tests/boot-order-test.c | 2 +- tests/ide-test.c | 2 +- tests/libqos/ahci.c | 4 ++-- tests/libqos/libqos.c | 4 ++-- tests/numa-test.c | 2 +- tests/postcopy-test.c | 8 ++++---- tests/q35-test.c | 2 +- tests/qmp-test.c | 8 ++++---- tests/qom-test.c | 2 +- tests/test-filter-mirror.c | 2 +- tests/test-filter-redirector.c | 4 ++-- tests/test-x86-cpuid-compat.c | 2 +- tests/virtio-net-test.c | 6 +++--- tests/vmgenid-test.c | 2 +- tests/wdt_ib700-test.c | 2 +- 18 files changed, 36 insertions(+), 36 deletions(-)