From: Peter Krempa Date: Mon, 29 Jul 2013 09:02:19 +0000 (+0200) Subject: qemuagenttest: Test the filesystem trimming X-Git-Tag: CVE-2013-4239~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725ee3b1d540ef18422b4bd2682f94d6bc6bd7e7;p=thirdparty%2Flibvirt.git qemuagenttest: Test the filesystem trimming --- diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 7f22ff04fc..a3b8834d78 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -131,6 +131,36 @@ cleanup: } +static int +testQemuAgentFSTrim(const void *data) +{ + virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; + qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt); + int ret = -1; + + if (!test) + return -1; + + if (qemuMonitorTestAddAgentSyncResponse(test) < 0) + goto cleanup; + + if (qemuMonitorTestAddItemParams(test, "guest-fstrim", + "{ \"return\" : {} }", + "minimum", "1337", + NULL) < 0) + goto cleanup; + + if (qemuAgentFSTrim(qemuMonitorTestGetAgent(test), 1337) < 0) + goto cleanup; + + ret = 0; + +cleanup: + qemuMonitorTestFree(test); + return ret; +} + + static int mymain(void) { @@ -154,6 +184,7 @@ mymain(void) DO_TEST(FSFreeze); DO_TEST(FSThaw); + DO_TEST(FSTrim); virObjectUnref(xmlopt);