From 0b4b49387cce8358783a493004b77c1603b34b5c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 9 Feb 2016 14:27:16 -0700 Subject: qga: Support enum names in guest-file-seek Magic constants are a pain to use, especially when we run the risk that our choice of '1' for QGA_SEEK_CUR might differ from the host or guest's choice of SEEK_CUR. Better is to use an enum value, via a qapi alternate type for back-compatibility. With this, {"command":"guest-file-seek", "arguments":{"handle":1, "offset":0, "whence":"cur"}} becomes a synonym for the older {"command":"guest-file-seek", "arguments":{"handle":1, "offset":0, "whence":1}} Signed-off-by: Eric Blake Reviewed-by: Michael Roth Signed-off-by: Michael Roth --- tests/test-qga.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/test-qga.c b/tests/test-qga.c index 0973b487d2..72a89dec23 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -6,7 +6,6 @@ #include #include "libqtest.h" -#include "qga/guest-agent-core.h" typedef struct { char *test_dir; @@ -450,8 +449,8 @@ static void test_qga_file_ops(gconstpointer fix) /* seek */ cmd = g_strdup_printf("{'execute': 'guest-file-seek'," " 'arguments': { 'handle': %" PRId64 ", " - " 'offset': %d, 'whence': %d } }", - id, 6, QGA_SEEK_SET); + " 'offset': %d, 'whence': '%s' } }", + id, 6, "set"); ret = qmp_fd(fixture->fd, cmd); qmp_assert_no_error(ret); val = qdict_get_qdict(ret, "return"); @@ -543,8 +542,8 @@ static void test_qga_file_write_read(gconstpointer fix) /* seek to 0 */ cmd = g_strdup_printf("{'execute': 'guest-file-seek'," " 'arguments': { 'handle': %" PRId64 ", " - " 'offset': %d, 'whence': %d } }", - id, 0, QGA_SEEK_SET); + " 'offset': %d, 'whence': '%s' } }", + id, 0, "set"); ret = qmp_fd(fixture->fd, cmd); qmp_assert_no_error(ret); val = qdict_get_qdict(ret, "return"); -- cgit v1.2.3-55-g7522