From: Pino Toscano Date: Thu, 7 Sep 2017 12:19:37 +0000 (+0200) Subject: tests: qemuxml2argv: fail also on unexpected pass X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=85afb126ad235e9b22d570751fd5eb0aed1eaabe;p=libvirt.git tests: qemuxml2argv: fail also on unexpected pass If a test expects either a parse error or a failure but then there is neither a parse error nor a failure, then properly mark the test as failing, instead of failing later on (e.g. trying to open a non-existing .args file). Signed-off-by: Pino Toscano --- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 350a0ab121..c85f3a3cdb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -463,6 +463,10 @@ testCompareXMLToArgv(const void *data) goto ok; goto cleanup; } + if (flags & FLAG_EXPECT_PARSE_ERROR) { + VIR_TEST_DEBUG("passed instead of expected parse error"); + goto cleanup; + } priv = vm->privateData; if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0) @@ -502,6 +506,10 @@ testCompareXMLToArgv(const void *data) goto ok; goto cleanup; } + if (flags & FLAG_EXPECT_FAILURE) { + VIR_TEST_DEBUG("passed instead of expected failure"); + goto cleanup; + } if (!(actualargv = virCommandToString(cmd))) goto cleanup;