diff mbox

[Xen-devel,OSSTEST,17/17] make-flight: refactor test_matrix_do_one

Message ID 1390384501-20552-17-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Jan. 22, 2014, 9:55 a.m. UTC
Pull some test creation out into their own subdirectories. This allows the
total level of indentation to be reduced.

It also allows us to invert the pre-condition test and simply return at the
top of the subroutine, which further reduces indentation.
---
 make-flight | 201 +++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 118 insertions(+), 83 deletions(-)
diff mbox

Patch

diff --git a/make-flight b/make-flight
index 4a144ec..092a0cf 100755
--- a/make-flight
+++ b/make-flight
@@ -95,25 +95,13 @@  test_matrix_branch_filter_callback () {
   return 0
 }
 
-test_matrix_do_one () {
-  if [ $dom0arch = armhf ]; then
-      job_create_test test-$xenarch$kern-$dom0arch-xl test-debian xl \
-            $xenarch $dom0arch                                        \
-            $debian_runvars all_hostflags=$most_hostflags
-      return
-  fi
-
-  job_create_test test-$xenarch$kern-$dom0arch-pv test-debian xend \
-            $xenarch $dom0arch                                        \
-            $debian_runvars all_hostflags=$most_hostflags
-
-  job_create_test test-$xenarch$kern-$dom0arch-xl test-debian xl \
-            $xenarch $dom0arch                                        \
-            $debian_runvars all_hostflags=$most_hostflags
+do_freebsd_tests () {
 
-  if [ $xenarch = amd64 -a $dom0arch = i386 -a "$kern" = "" ]; then
+  if [ $xenarch != amd64 -o $dom0arch != i386 -o "$kern" != "" ]; then
+    return
+  fi
 
-    for freebsdarch in amd64 i386; do
+  for freebsdarch in amd64 i386; do
 
  job_create_test test-$xenarch$kern-$dom0arch$qemuu_suffix-freebsd10-$freebsdarch \
                         test-freebsd xl $xenarch $dom0arch \
@@ -121,36 +109,20 @@  test_matrix_do_one () {
  freebsd_image=${FREEBSD_IMAGE_PREFIX-FreeBSD-10.0-BETA3-}$freebsdarch${FREEBSD_IMAGE_SUFFIX--20131103-r257580.qcow2.xz} \
                         all_hostflags=$most_hostflags
 
-    done
-
-  fi
-
-    for qemuu_suffix in '' -qemut -qemuu; do
-      case "$qemuu_suffix" in
-      '')
-            qemuu_runvar=''
-            ;;
-      -qemut)
-            qemuu_runvar=device_model_version=qemu-xen-traditional
-            ;;
-      -qemuu)
-            case $xenbranch in
-            xen-3.*-testing) continue;;
-            xen-4.0-testing) continue;;
-            xen-4.1-testing) continue;;
-            esac
-            qemuu_runvar=device_model_version=qemu-xen
-            ;;
-      esac
+  done
+}
 
-    for vcpus in '' 1; do
-        case "$vcpus" in
-        '') vcpus_runvars=''; vcpus_suffix='' ;;
-        *) vcpus_runvars=guests_vcpus=$vcpus; vcpus_suffix=-vcpus$vcpus ;;
-        esac
+do_hvm_winxp_tests () {
+  for vcpus in '' 1; do
+    case "$vcpus" in
+      '') vcpus_runvars=''; vcpus_suffix='' ;;
+      *) vcpus_runvars=guests_vcpus=$vcpus; vcpus_suffix=-vcpus$vcpus ;;
+    esac
 
-        if [ "x$vcpus" = x ] || \
-           [ "$xenarch$kern-$dom0arch" = "amd64-i386" ]; then
+    if [ "x$vcpus" != x ] && \
+       [ "$xenarch$kern-$dom0arch" != "amd64-i386" ]; then
+      continue
+    fi
 
     stripy toolstack xend xl \
             "$vcpus" 1 \
@@ -160,85 +132,148 @@  test_matrix_do_one () {
 
     toolstack_runvars="toolstack=$toolstack"
 
-  job_create_test \
+    job_create_test \
             test-$xenarch$kern-$dom0arch-$toolstack$qemuu_suffix-winxpsp3$vcpus_suffix \
             test-win $toolstack $xenarch $dom0arch $qemuu_runvar \
             win_image=winxpsp3.iso $vcpus_runvars   \
             all_hostflags=$most_hostflags,hvm
 
-        fi
-    done
+  done
+}
 
-  if [ $xenarch = amd64 ]; then
+do_hvm_win7_x64_tests () {
+  if [ $xenarch != amd64 ]; then
+    return
+  fi
 
   job_create_test test-$xenarch$kern-$dom0arch-xl$qemuu_suffix-win7-amd64 \
             test-win xl $xenarch $dom0arch $qemuu_runvar \
             win_image=win7-x64.iso \
             all_hostflags=$most_hostflags,hvm
+}
 
+do_hvm_rhel6_tests () {
+  if [ $xenarch != amd64 -o $dom0arch != i386 -o "$kern" != "" ]; then
+    return
   fi
 
-  if [ $xenarch = amd64 -a $dom0arch = i386 -a "$kern" = "" ]; then
-
-    for cpuvendor in amd intel; do
+  for cpuvendor in amd intel; do
 
     job_create_test test-$xenarch$kern-$dom0arch$qemuu_suffix-rhel6hvm-$cpuvendor \
                                             test-rhelhvm xl $xenarch $dom0arch \
-            redhat_image=rhel-server-6.1-i386-dvd.iso               \
+            redhat_image=rhel-server-6.1-i386-dvd.iso \
             all_hostflags=$most_hostflags,hvm-$cpuvendor \
             $qemuu_runvar
 
-    done
+  done
+}
 
+do_sedf_tests () {
+  if [ $xenarch != amd64 -o $dom0arch != amd64 ]; then
+    return
   fi
 
-  done # qemuu_suffix
+  for pin in '' -pin; do
+    job_create_test test-$xenarch$kern-$dom0arch-xl-sedf$pin  \
+       test-debian xl $xenarch $dom0arch                      \
+            guests_vcpus=4                                    \
+            xen_boot_append="sched=sedf loglvl=all ${pin:+dom0_vcpus_pin}" \
+            linux_boot_append='loglevel=9 debug'              \
+            $debian_runvars all_hostflags=$most_hostflags
+  done
+}
 
-  job_create_test test-$xenarch$kern-$dom0arch-pair test-pair \
-            $onetoolstack $xenarch $dom0arch \
-            !host !host_hostflags \
-            $debian_runvars \
-            all_hostflags=$most_hostflags,equiv-1
+do_credit2_tests () {
+  if [ $xenarch != amd64 -o $dom0arch != i386 ]; then
+    return
+  fi
 
-  if [ $xenarch = amd64 -a $dom0arch = amd64 ]; then
+  job_create_test test-$xenarch$kern-$dom0arch-xl-credit2             \
+       test-debian xl $xenarch $dom0arch                              \
+            guests_vcpus=4 xen_boot_append='sched=credit2'            \
+            $debian_runvars all_hostflags=$most_hostflags
+}
 
-   for pin in '' -pin; do
+do_passthrough_tests () {
+  if [ $xenarch != amd64 -o $dom0arch != amd64 -o "$kern" != "" ]; then
+    return
+  fi
 
-  job_create_test test-$xenarch$kern-$dom0arch-xl-sedf$pin  \
-       test-debian xl $xenarch $dom0arch \
-            guests_vcpus=4 xen_boot_append="sched=sedf loglvl=all ${pin:+dom0_vcpus_pin}" linux_boot_append='loglevel=9 debug' \
+  for cpuvendor in intel; do
+    job_create_test test-$xenarch$kern-$dom0arch-xl-pcipt-intel       \
+                    test-debian-nomigr xl $xenarch $dom0arch          \
+            guests_vcpus=4                                            \
+            $debian_runvars debian_pcipassthrough_nic=host            \
+            all_hostflags=$most_hostflags,hvm-$cpuvendor,pcipassthrough-nic
+
+  done
+}
+
+test_matrix_do_one () {
+
+  # Basic PV Linux test with xl
+
+  job_create_test test-$xenarch$kern-$dom0arch-xl test-debian xl \
+            $xenarch $dom0arch                                   \
             $debian_runvars all_hostflags=$most_hostflags
 
-   done
+  # No further arm tests at the moment
+  if [ $dom0arch = armhf ]; then
+      return
+  fi
 
+  # xend PV guest test on x86 only
+  if [ $dom0arch = "i386" -o $dom0arch = "amd64" ]; then
+    job_create_test test-$xenarch$kern-$dom0arch-pv test-debian xend \
+            $xenarch $dom0arch                                       \
+            $debian_runvars all_hostflags=$most_hostflags
   fi
 
-  if [ $xenarch = amd64 -a $dom0arch = i386 ]; then
+  do_freebsd_tests
 
-  job_create_test test-$xenarch$kern-$dom0arch-xl-multivcpu \
-                    test-debian xl $xenarch $dom0arch guests_vcpus=4  \
-                    $debian_runvars all_hostflags=$most_hostflags
+  for qemuu_suffix in '' -qemut -qemuu; do
+    case "$qemuu_suffix" in
+    '')
+          qemuu_runvar=''
+          ;;
+    -qemut)
+          qemuu_runvar=device_model_version=qemu-xen-traditional
+          ;;
+    -qemuu)
+          case $xenbranch in
+          xen-3.*-testing) continue;;
+          xen-4.0-testing) continue;;
+          xen-4.1-testing) continue;;
+          esac
+          qemuu_runvar=device_model_version=qemu-xen
+          ;;
+    esac
 
-  job_create_test test-$xenarch$kern-$dom0arch-xl-credit2  \
-       test-debian xl $xenarch $dom0arch                              \
-            guests_vcpus=4 xen_boot_append='sched=credit2'            \
-            $debian_runvars all_hostflags=$most_hostflags
+    do_hvm_winxp_tests
+    do_hvm_win7_x64_tests
+    do_hvm_rhel6_tests
 
-  fi
+  done # qemuu_suffix
 
-  if [ $xenarch = amd64 -a $dom0arch = amd64 -a "$kern" = "" ]; then
+  # Test live migration
+  job_create_test test-$xenarch$kern-$dom0arch-pair test-pair \
+            $onetoolstack $xenarch $dom0arch \
+            !host !host_hostflags \
+            $debian_runvars \
+            all_hostflags=$most_hostflags,equiv-1
 
-    for cpuvendor in intel; do
+  do_sedf_tests
+  do_credit2_tests
 
-  job_create_test test-$xenarch$kern-$dom0arch-xl-pcipt-intel \
-                    test-debian-nomigr xl $xenarch $dom0arch          \
-            guests_vcpus=4                                            \
-            $debian_runvars debian_pcipassthrough_nic=host            \
-            all_hostflags=$most_hostflags,hvm-$cpuvendor,pcipassthrough-nic
+  if [ $xenarch = amd64 -a $dom0arch = i386 ]; then
 
-    done
+  job_create_test test-$xenarch$kern-$dom0arch-xl-multivcpu \
+                    test-debian xl $xenarch $dom0arch guests_vcpus=4  \
+                    $debian_runvars all_hostflags=$most_hostflags
 
   fi
+
+  do_passthrough_tests
 }
 
 test_matrix_iterate