[libvirt] [PATCH v3 4/7] qemumonitorjsontest: add test for getting multithread compress params

Maxim Nestratov mnestratov at virtuozzo.com
Sat Jan 30 16:30:37 UTC 2016


28.01.2016 10:04, Nikolay Shirokovskiy пишет:
> From: Eli Qiao <liyong.qiao at intel.com>
>
> Signed-off-by: Eli Qiao <liyong.qiao at intel.com>
> Signed-off-by: ShaoHe Feng <shaohe.feng at intel.com>
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>   tests/qemumonitorjsontest.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 53 insertions(+)
>
> diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
> index 1be0bee..8f5e826 100644
> --- a/tests/qemumonitorjsontest.c
> +++ b/tests/qemumonitorjsontest.c
> @@ -1593,6 +1593,58 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data)
>   }
>   
>   static int
> +testQemuMonitorJSONqemuMonitorJSONGetMigrationCompressParametersMT(const void *data)
> +{
> +    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
> +    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
> +    qemuMonitorMigrationMTParameters compression;
> +    int ret = -1;
> +
> +    if (!test)
> +        return -1;
> +
> +    if (qemuMonitorTestAddItem(test, "query-migrate-parameters",
> +                               "{"
> +                               "    \"return\": {"
> +                               "        \"decompress-threads\": 2,"
> +                               "        \"compress-threads\": 8,"
> +                               "        \"compress-level\": 1"
> +                               "    }"
> +                               "}") < 0) {
> +        goto cleanup;
> +    }
> +
> +    if (qemuMonitorJSONGetMigrationCompressParametersMT(
> +                        qemuMonitorTestGetMonitor(test), &compression) < 0)
> +        goto cleanup;
> +
> +    if (compression.level != 1) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "Invalid decompress-threads: %d, expected 1",
> +                       compression.level);
> +        goto cleanup;
> +    }
> +    if (compression.threads != 8) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "Invalid decompress-threads: %d, expected 8",
> +                       compression.threads);
> +        goto cleanup;
> +    }
> +    if (compression.dthreads != 2) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "Invalid decompress-threads: %d, expected 2",
> +                       compression.dthreads);
> +        goto cleanup;
> +    }
> +    ret = 0;
> +
> + cleanup:
> +    qemuMonitorTestFree(test);
> +    return ret;
> +}
> +
> +
> +static int
>   testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *data)
>   {
>       virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
> @@ -2333,6 +2385,7 @@ mymain(void)
>       DO_TEST(qemuMonitorJSONGetBlockInfo);
>       DO_TEST(qemuMonitorJSONGetBlockStatsInfo);
>       DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
> +    DO_TEST(qemuMonitorJSONGetMigrationCompressParametersMT);
>       DO_TEST(qemuMonitorJSONGetMigrationStats);
>       DO_TEST(qemuMonitorJSONGetChardevInfo);
>       DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
ACK




More information about the libvir-list mailing list