]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: run-standalone.sh improvements
authorDavid Zafman <dzafman@redhat.com>
Mon, 31 Jul 2017 16:27:15 +0000 (09:27 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 4 Aug 2017 13:38:09 +0000 (06:38 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
qa/run-standalone.sh
qa/standalone/README

index 185ed41c25d27444c2d4dd2196e2739fd3b1c1cd..6b94958568725a095dfa5b4adcf1081d73a4a015 100755 (executable)
@@ -1,25 +1,82 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
+set -e
 
-if [ ! -e Makefile ]; then
+if [ ! -e Makefile -o ! -d bin ]; then
     echo 'run this from the build dir'
     exit 1
 fi
 
+if [ ! -d /tmp/ceph-disk-virtualenv -o ! -d /tmp/ceph-detect-init-virtualenv ]; then
+    echo '/tmp/*-virtualenv directories not built'
+    exit 1
+fi
+
 if [ `uname` = FreeBSD ]; then
     # otherwise module prettytable will not be found
     export PYTHONPATH=/usr/local/lib/python2.7/site-packages
     exec_mode=+111
 else
+    export PYTHONPATH=/usr/lib/python2.7/dist-packages
     exec_mode=/111
 fi
 
-for f in `find ../qa/standalone -perm $exec_mode -type f`
+PATH=$(pwd)/bin:$PATH
+
+# TODO: Use getops
+dryrun=false
+if [[ "$1" = "--dry-run" ]]; then
+    dryrun=true
+    shift
+fi
+
+all=false
+if [ "$1" = "" ]; then
+   all=true
+fi
+
+select=("$@")
+
+location="../qa/standalone"
+
+count=0
+errors=0
+for f in $(cd $location ; find . -perm $exec_mode -type f)
 do
-    echo '--- $f ---'
-    PATH=$PATH:bin \
-       CEPH_ROOT=.. \
-       CEPH_LIB=lib \
-       $f || exit 1
+    f=$(echo $f | sed 's/\.\///')
+    if [[ "$all" = "false" ]]; then
+        found=false
+        for c in "${!select[@]}"
+        do
+            if [[ "${select[$c]}" = $(basename $f) ]]; then
+                found=true
+                break
+            fi
+            if [[ "${select[$c]}" = "$f" ]]; then
+                found=true
+                break
+            fi
+        done
+        if [[ "$found" = "false" ]]; then
+            continue
+        fi
+    fi
+    count=$(expr $count + 1)
+    echo "--- $f ---"
+    if [[ "$dryrun" != "true" ]]; then
+        if ! PATH=$PATH:bin \
+           CEPH_ROOT=.. \
+           CEPH_LIB=lib \
+           $location/$f ; then
+          echo "$f .............. FAILED"
+          errors=$(expr $errors + 1)
+        fi
+    fi
 done
 
+if [ "$errors" != "0" ]; then
+    echo "$errors TESTS FAILED, $count TOTAL TESTS"
+    exit 1
+fi
+
+echo "ALL $count TESTS PASSED"
 exit 0
index b362295962b7f498c2abe15884847a3025225fe2..8ec202639bdbd09e2164be00c1c6e911088b2e27 100644 (file)
@@ -12,7 +12,7 @@ You can run them in a git checkout + build directory as well:
   * The qa/run-standalone.sh will run all of them in sequence.  This is slow
      since there is no parallelism.
 
-  * You can run an individual script by passing these environment args.  For
-    example, if you are in the build/ directory,
+  * You can run individual script(s) by specifying the basename or path below
+    qa/standalone as arguments to qa/run-standalone.sh.
 
-PATH=$PATH:bin CEPH_ROOT=.. CEPH_LIB=lib ../qa/standalone/mon/misc.sh
+../qa/run-standalone.sh misc.sh osd/osd-dup.sh