]> xenbits.xensource.com Git - people/iwj/ring3-xl-test.git/commitdiff
Don't re-create the domain configuration each time through the loop.
authorEuan Harris <euan.harris@citrix.com>
Wed, 17 Jun 2015 09:19:31 +0000 (09:19 +0000)
committerEuan Harris <euan.harris@citrix.com>
Wed, 17 Jun 2015 09:19:31 +0000 (09:19 +0000)
Signed-off-by: Euan Harris <euan.harris@citrix.com>
test_domain_create_new.c

index 43e14a3efd497b0c4d7fd963f4e0ed24faba2290..d1b488339f7c7af02627ba03ba52a61c73c027c9 100644 (file)
  *   cancellation point.
  */
 
-void teardown(struct test *tc, libxl_domain_config * dc, int domid)
-{
-    libxl_domain_config_dispose(dc);
-    libxl_domain_destroy(tc->ctx, domid, 0);
-
-}
-
 void *testcase(struct test *tc)
 {
     int count;
+    libxl_domain_config dc;
+
+    init_domain_config(&dc, "test_domain_create_new",
+                       "/root/vmlinuz-4.0.4-301.fc22.x86_64",
+                       "/root/initrd.xen-4.0.4-301.fc22.x86_64",
+                       "/root/Fedora-Cloud-Base-22-20150521.x86_64.qcow2",
+                       "/root/cloudinit.iso");
 
     for (count = 1; count < 100; count++) {
         uint32_t domid;
-        libxl_domain_config dc;
         struct event ev;
         int rc;
 
         printf("\n****** Will cancel after %d events ******\n", count);
 
-        init_domain_config(&dc, "test_domain_create_new",
-                           "/root/vmlinuz-4.0.4-301.fc22.x86_64",
-                           "/root/initrd.xen-4.0.4-301.fc22.x86_64",
-                           "/root/Fedora-Cloud-Base-22-20150521.x86_64.qcow2",
-                           "/root/init.iso");
-
         do_domain_create(tc, &dc, &domid);
 
         if (wait_until_n(tc, EV_LIBXL_CALLBACK, count, &ev)) {
@@ -65,7 +58,7 @@ void *testcase(struct test *tc)
             printf("libxl_ao_cancel returned %d\n", rc);
             assert(rc == ERROR_NOTFOUND);
 
-            teardown(tc, &dc, domid);
+            libxl_domain_destroy(tc->ctx, domid, 0);
             break;
         }
 
@@ -89,9 +82,10 @@ void *testcase(struct test *tc)
         printf("domid: %d\n", domid);
         assert(!libxl_domain_info(tc->ctx, NULL, domid));
 
-        teardown(tc, &dc, domid);
+        libxl_domain_destroy(tc->ctx, domid, 0);
     }
 
+    libxl_domain_config_dispose(&dc);
     test_exit();
     return NULL;
 }