[libvirt] [PATCH] tests: Fix misplaced parenthesis in qemumonitorjsontest

Martin Kletzander mkletzan at redhat.com
Wed Dec 3 16:21:48 UTC 2014


On Wed, Dec 03, 2014 at 02:57:15PM +0100, Ján Tomko wrote:
>On 12/03/2014 02:45 PM, Martin Kletzander wrote:
>> When trying clang, it found out that we were comparing sizeof with 0
>> even though we wanted to check the return value of memcmp.
>>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>>  tests/qemumonitorjsontest.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
>> index 5bfcd20..d3ae29a 100644
>> --- a/tests/qemumonitorjsontest.c
>> +++ b/tests/qemumonitorjsontest.c
>> @@ -1879,7 +1879,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
>>                                            "drive-virtio-disk0", &info, false) < 0)
>>          goto cleanup;
>>
>> -    if (memcmp(&info, &expectedInfo, sizeof(info) != 0)) {
>> +    if (memcmp(&info, &expectedInfo, sizeof(info)) != 0) {
>>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>>                         "Invalid @info");
>>          goto cleanup;
>>
>
>The test fails after this change, because the options added by
>
>commit d506a51aeb2a7a7b0c963f760e32b94376ea7173
>    qemu: Add bps_max and friends qemu driver
>
>aren't filled in by the above qemuMonitorJSONSetBlockIoThrottle call.
>
>Jan
>

Consider this squashed in:

diff --git i/tests/qemumonitorjsontest.c w/tests/qemumonitorjsontest.c
index d3ae29a..bd92e63 100644
--- i/tests/qemumonitorjsontest.c
+++ w/tests/qemumonitorjsontest.c
@@ -60,6 +60,13 @@ const char *queryBlockReply =
 "                \"encrypted\": false,"
 "                \"bps\": 1,"
 "                \"bps_rd\": 2,"
+"                \"bps_max\": 7,"
+"                \"iops_max\": 10,"
+"                \"bps_rd_max\": 8,"
+"                \"bps_wr_max\": 9,"
+"                \"iops_rd_max\": 11,"
+"                \"iops_wr_max\": 12,"
+"                \"iops_size\": 13,"
 "                \"file\": \"/home/zippy/work/tmp/gentoo.qcow2\","
 "                \"encryption_key_missing\": false"
 "            },"
@@ -1872,11 +1879,15 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
                                      "device", "\"drive-virtio-disk1\"",
                                      "bps", "1", "bps_rd", "2", "bps_wr", "3",
                                      "iops", "4", "iops_rd", "5", "iops_wr", "6",
+                                     "bps_max", "7", "bps_rd_max", "8",
+                                     "bps_wr_max", "9",
+                                     "iops_max", "10", "iops_rd_max", "11",
+                                     "iops_wr_max", "12", "iops_size", "13",
                                      NULL, NULL) < 0)
         goto cleanup;

     if (qemuMonitorJSONGetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
-                                          "drive-virtio-disk0", &info, false) < 0)
+                                          "drive-virtio-disk0", &info, true) < 0)
         goto cleanup;

     if (memcmp(&info, &expectedInfo, sizeof(info)) != 0) {
@@ -1886,7 +1897,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
     }

     if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
-                                          "drive-virtio-disk1", &info, false) < 0)
+                                          "drive-virtio-disk1", &info, true) < 0)
         goto cleanup;

     ret = 0;

--

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141203/cb9d49dd/attachment-0001.sig>


More information about the libvir-list mailing list