]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
run_tests.sh OS X script fixes
authorDoug Wiegley <dougw@a10networks.com>
Fri, 11 Jul 2014 02:44:21 +0000 (20:44 -0600)
committerDoug Wiegley <dougw@a10networks.com>
Fri, 21 Nov 2014 00:56:19 +0000 (17:56 -0700)
On OS X, '*' is not a valid grep modified for '[^[:space:]:]', nor is it
necessary when the lines being checked against must be prefixed with
neutron.tests.
Also, dirname was being called with an empty var, without quoting, resulting
in usage errors.

Closes-Bug: 1391858

Change-Id: I34ab0625a00809f68b7a44cb3a175a57ba0bd6d5

run_tests.sh

index 25dbb11be6f3a135b8d8dee538d19550e2bbd1a6..51a1046cbb878172205ad341ad2f8ddd478e7807 100755 (executable)
@@ -134,11 +134,16 @@ function run_tests {
   set +e
   testargs=`echo "$testargs" | sed -e's/^\s*\(.*\)\s*$/\1/'`
   TESTRTESTS="$TESTRTESTS --testr-args='--subunit $testopts $testargs'"
-  OS_TEST_PATH=`echo $testargs|grep -o 'neutron\.tests[^[:space:]:]*\+'|tr . /`
+  OS_TEST_PATH=`echo $testargs|grep -o 'neutron\.tests[^[:space:]:]\+'|tr . /`
+  if [ -n "$OS_TEST_PATH" ]; then
+      os_test_dir=$(dirname "$OS_TEST_PATH")
+  else
+      os_test_dir=''
+  fi
   if [ -d "$OS_TEST_PATH" ]; then
       wrapper="OS_TEST_PATH=$OS_TEST_PATH $wrapper"
-  elif [ -d "$(dirname $OS_TEST_PATH)" ]; then
-      wrapper="OS_TEST_PATH=$(dirname $OS_TEST_PATH) $wrapper"
+  elif [ -d "$os_test_dir" ]; then
+      wrapper="OS_TEST_PATH=$os_test_dir $wrapper"
   fi
   echo "Running \`${wrapper} $TESTRTESTS\`"
   bash -c "${wrapper} $TESTRTESTS | ${wrapper} subunit2pyunit"