Re: [libvirt] [PATCH 10/11] tests: Integrate startup checks to qemuxml2argvtest

2016-02-06 Thread Ján Tomko
On Thu, Feb 04, 2016 at 03:49:47PM +0100, Peter Krempa wrote:
> Some of the tests that are not a part of qemuBuildCommandLine were not
> executed in the test suite. We can now reuse qemuProcessStartValidate to
> integrate these tests.
> ---
>  tests/qemuxml2argvtest.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index a5d4722..af6f9a5 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -18,6 +18,7 @@
>  # include "qemu/qemu_command.h"
>  # include "qemu/qemu_domain.h"
>  # include "qemu/qemu_migration.h"
> +# include "qemu/qemu_process.h"
>  # include "datatypes.h"
>  # include "conf/storage_conf.h"
>  # include "cpu/cpu_map.h"
> @@ -262,6 +263,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
>  virCommandPtr cmd = NULL;
>  size_t i;
>  virBitmapPtr nodeset = NULL;
> +bool buildFailed = false;
> 
>  if (!(conn = virGetConnect()))
>  goto out;
> @@ -339,13 +341,20 @@ static int testCompareXMLToArgvFiles(const char *xml,
>  goto out;
>  }
> 
> -if (!(cmd = qemuBuildCommandLine(conn, , vmdef, _chr,
> +if (qemuProcessStartValidate(vmdef, extraFlags, !!migrateURI, false) < 0)
> +buildFailed = true;

The variable is called 'buildFailed' even though we did not get to the
Build part yet. How about testFailed?

> +
> +if (!buildFailed &&
> +!(cmd = qemuBuildCommandLine(conn, , vmdef, _chr,
>   (flags & FLAG_JSON), extraFlags,
>   migrateURI, NULL,
>   VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
>   , false,
>   (flags & FLAG_FIPS),
> - nodeset, NULL, NULL))) {
> + nodeset, NULL, NULL)))
> +buildFailed = true;
> +
> +if (buildFailed) {
>  if (!virtTestOOMActive() &&
>  (flags & FLAG_EXPECT_FAILURE)) {
>  ret = 0;

This message:
VIR_TEST_DEBUG("qemuBuildCommandLine should have failed\n");
also needs to be rewritten.

ACK with that fixed.

Jan


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 10/11] tests: Integrate startup checks to qemuxml2argvtest

2016-02-04 Thread Peter Krempa
Some of the tests that are not a part of qemuBuildCommandLine were not
executed in the test suite. We can now reuse qemuProcessStartValidate to
integrate these tests.
---
 tests/qemuxml2argvtest.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a5d4722..af6f9a5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -18,6 +18,7 @@
 # include "qemu/qemu_command.h"
 # include "qemu/qemu_domain.h"
 # include "qemu/qemu_migration.h"
+# include "qemu/qemu_process.h"
 # include "datatypes.h"
 # include "conf/storage_conf.h"
 # include "cpu/cpu_map.h"
@@ -262,6 +263,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
 virCommandPtr cmd = NULL;
 size_t i;
 virBitmapPtr nodeset = NULL;
+bool buildFailed = false;

 if (!(conn = virGetConnect()))
 goto out;
@@ -339,13 +341,20 @@ static int testCompareXMLToArgvFiles(const char *xml,
 goto out;
 }

-if (!(cmd = qemuBuildCommandLine(conn, , vmdef, _chr,
+if (qemuProcessStartValidate(vmdef, extraFlags, !!migrateURI, false) < 0)
+buildFailed = true;
+
+if (!buildFailed &&
+!(cmd = qemuBuildCommandLine(conn, , vmdef, _chr,
  (flags & FLAG_JSON), extraFlags,
  migrateURI, NULL,
  VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
  , false,
  (flags & FLAG_FIPS),
- nodeset, NULL, NULL))) {
+ nodeset, NULL, NULL)))
+buildFailed = true;
+
+if (buildFailed) {
 if (!virtTestOOMActive() &&
 (flags & FLAG_EXPECT_FAILURE)) {
 ret = 0;
-- 
2.6.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list