From f8755e75e164f468e41462932e1d701e30e300a7 Mon Sep 17 00:00:00 2001 From: Doug Wiegley Date: Thu, 10 Jul 2014 20:44:21 -0600 Subject: [PATCH] run_tests.sh OS X script fixes 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 25dbb11be6..51a1046cbb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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"