← Back to team overview

ubuntu-bugcontrol team mailing list archive

[Merge] ~federicoquattrin/ubuntu-qa-tools:make_vm-qrt_execute_tests into ubuntu-qa-tools:master

 

Federico Quattrin has proposed merging ~federicoquattrin/ubuntu-qa-tools:make_vm-qrt_execute_tests into ubuntu-qa-tools:master.

Commit message:
added an option to execute the test

Requested reviews:
  Ubuntu Bug Control (ubuntu-bugcontrol)

For more details, see:
https://code.launchpad.net/~federicoquattrin/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/465509

added an option to execute the test
-- 
Your team Ubuntu Bug Control is requested to review the proposed merge of ~federicoquattrin/ubuntu-qa-tools:make_vm-qrt_execute_tests into ubuntu-qa-tools:master.
diff --git a/vm-tools/vm-qrt b/vm-tools/vm-qrt
index b2593d4..a5d5151 100755
--- a/vm-tools/vm-qrt
+++ b/vm-tools/vm-qrt
@@ -29,6 +29,7 @@ Usage: vm-qrt -p PREFIX [-s] [-a ARCH] [-v] <script> [<dir>]
  -a ARCH        use ARCH as the suffix to construct hostname list
  -s             start the VM
  -v             Do not launch VNC viewer on started VMs
+ -e             Execute test.
 Eg:
 $ vm-qrt -p sec test-foo.py
 
@@ -53,6 +54,9 @@ start_vms() {
     if [ -n "$no_viewer" ]; then
          start_args="$start_args -v"
     fi
+    echo "Running:"
+    echo "uvt start $start_args $args"
+    echo ""
     uvt start $start_args $args
 }
 
@@ -139,6 +143,20 @@ $ sudo ./`basename $test_script` -v # script should run as root
 EOM
 }
 
+execute_test(){
+    echo "== Executing test =="
+    script_name="$1"
+    if [ "$s" = "test-browser.py" ]; then
+        s="testlib_browser.py"
+    fi
+    args="-c -p $prefix"
+    topdir=`echo "$test_directory/$test_tarball" | sed 's/.tar.gz$//'`
+    echo "Running:"
+    echo "$ uvt cmd --user=$(whoami) $args \"cd '$topdir'; ./$s\""
+    echo ""
+    uvt cmd --user=$(whoami) $args "cd '$topdir'; ./$s"
+}
+
 #
 # start main script
 #
@@ -147,13 +165,15 @@ prefix=
 start=
 arch=
 no_viewer=
-while getopts "hsva:p:" opt
+execute=
+while getopts "hseva:p:" opt
 do
     case "$opt" in
         a) arch="$OPTARG";;
         p) prefix="$OPTARG";;
         s) start=1;;
         v) no_viewer=1;;
+        e) execute=1;;
         h) help
            exit 0
            ;;
@@ -215,3 +235,9 @@ fi
 echo ""
 
 give_instructions $add_install_msg
+echo ""
+
+if [ -n "$execute" ]; then
+    execute_test
+    echo ""
+fi
\ No newline at end of file

Follow ups