aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qga.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-02-09 14:27:16 -0700
committerMichael Roth <mdroth@linux.vnet.ibm.com>2016-02-25 09:48:50 -0600
commit0b4b49387cce8358783a493004b77c1603b34b5c (patch)
treedebae516d511132c0a7155aa62148c26615666af /tests/test-qga.c
parent774ae4254d3910f1c94ad6ed44d14cbea0e6a2f2 (diff)
downloadqemu-0b4b49387cce8358783a493004b77c1603b34b5c.zip
qemu-0b4b49387cce8358783a493004b77c1603b34b5c.tar.gz
qemu-0b4b49387cce8358783a493004b77c1603b34b5c.tar.bz2
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 <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r--tests/test-qga.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 0973b48..72a89de 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -6,7 +6,6 @@
#include <sys/un.h>
#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");