aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Kostiuk <kkostiuk@redhat.com>2025-03-24 15:17:29 +0200
committerKonstantin Kostiuk <kkostiuk@redhat.com>2025-06-12 17:02:05 +0300
commit1ebbc8b774d8b44697740b108ad060612828b58f (patch)
tree4f5ad1cd7d658a13a6a8b1d501940b6a0d4cdc89
parent6f0273d6ae21bb2e4222789af0e6d480aa9430b1 (diff)
downloadqemu-1ebbc8b774d8b44697740b108ad060612828b58f.zip
qemu-1ebbc8b774d8b44697740b108ad060612828b58f.tar.gz
qemu-1ebbc8b774d8b44697740b108ad060612828b58f.tar.bz2
qga: Add tests for guest-get-load command
Tested-by: Dehan Meng <demeng@redhat.com> Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
-rw-r--r--tests/unit/test-qga.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index 541b08a..587e30c 100644
--- a/tests/unit/test-qga.c
+++ b/tests/unit/test-qga.c
@@ -332,6 +332,22 @@ static void test_qga_get_fsinfo(gconstpointer fix)
}
}
+static void test_qga_get_load(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ g_autoptr(QDict) ret = NULL;
+ QDict *load;
+
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-load'}");
+ g_assert_nonnull(ret);
+ qmp_assert_no_error(ret);
+
+ load = qdict_get_qdict(ret, "return");
+ g_assert(qdict_haskey(load, "load1m"));
+ g_assert(qdict_haskey(load, "load5m"));
+ g_assert(qdict_haskey(load, "load15m"));
+}
+
static void test_qga_get_memory_block_info(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -1105,6 +1121,7 @@ int main(int argc, char **argv)
g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
}
g_test_add_data_func("/qga/get-fsinfo", &fix, test_qga_get_fsinfo);
+ g_test_add_data_func("/qga/get-load", &fix, test_qga_get_load);
g_test_add_data_func("/qga/get-memory-block-info", &fix,
test_qga_get_memory_block_info);
g_test_add_data_func("/qga/get-memory-blocks", &fix,