[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [XTF PATCH v2] xtf-runner: use xl create -Fc directly



Now that xl create -c is fixed in xen-unstable, there is no need to keep
the hack to get guest console output anymore.

Use xl create -Fc directly, then wait for the xl process to exit.  Print
any error as it occurs.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Rebased on top of master
---
 xtf-runner | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/xtf-runner b/xtf-runner
index c063699..a87bde6 100755
--- a/xtf-runner
+++ b/xtf-runner
@@ -425,30 +425,22 @@ def list_tests(opts):
     for sel in opts.selection:
         print sel
 
+create_list = []
 
 def run_test(test):
     """ Run a specific test """
 
-    cmd = ['xl', 'create', '-p', test.cfg_path()]
+    cmd = ['xl', 'create', '-Fc', test.cfg_path()]
     print "Executing '%s'" % (" ".join(cmd), )
-    rc = subproc_call(cmd)
-    if rc:
-        raise RunnerError("Failed to create VM")
+    guest = Popen(cmd, stdout = PIPE, stderr = PIPE)
+    create_list.append(guest)
 
-    cmd = ['xl', 'console', test.vm_name()]
-    print "Executing '%s'" % (" ".join(cmd), )
-    console = Popen(cmd, stdout = PIPE)
-
-    cmd = ['xl', 'unpause', test.vm_name()]
-    print "Executing '%s'" % (" ".join(cmd), )
-    rc = subproc_call(cmd)
-    if rc:
-        raise RunnerError("Failed to unpause VM")
+    # stdout is console output, stderr is xl output
+    stdout, stderr = guest.communicate()
 
-    stdout, _ = console.communicate()
-
-    if console.returncode:
-        raise RunnerError("Failed to obtain VM console")
+    if guest.returncode:
+        print stderr
+        raise RunnerError("Failed to communicate with guest")
 
     lines = stdout.splitlines()
 
@@ -603,10 +595,14 @@ def main():
     opts.selection = interpret_selection(opts)
 
     if opts.list_tests:
-        return list_tests(opts)
+        ret = list_tests(opts)
     else:
-        return run_tests(opts)
+        ret = run_tests(opts)
+
+    for child in create_list:
+        child.wait()
 
+    return ret
 
 if __name__ == "__main__":
     try:
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.