aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2014-08-04 17:11:20 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2014-08-15 18:03:12 +0100
commit86298845e127365e8a5b7419a5ee9039bbd1837f (patch)
tree2fee7ce1c46470666349d3f5166660016e7174d0 /tests/libqtest.c
parent552b48f44df99e095f04245a48d3b839bbe9912c (diff)
downloadqemu-86298845e127365e8a5b7419a5ee9039bbd1837f.zip
qemu-86298845e127365e8a5b7419a5ee9039bbd1837f.tar.gz
qemu-86298845e127365e8a5b7419a5ee9039bbd1837f.tar.bz2
qtest: Adding qtest_memset and qmemset.
Currently, libqtest allows for memread and memwrite, but does not offer a simple way to zero out regions of memory. This patch adds a simple function to do so. Signed-off-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r--tests/libqtest.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 4a75cd3..e525e6f 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -659,6 +659,18 @@ void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size)
qtest_rsp(s, 0);
}
+void qtest_memset(QTestState *s, uint64_t addr, uint8_t pattern, size_t size)
+{
+ size_t i;
+
+ qtest_sendf(s, "write 0x%" PRIx64 " 0x%zx 0x", addr, size);
+ for (i = 0; i < size; i++) {
+ qtest_sendf(s, "%02x", pattern);
+ }
+ qtest_sendf(s, "\n");
+ qtest_rsp(s, 0);
+}
+
QDict *qmp(const char *fmt, ...)
{
va_list ap;