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
This commit is contained in:
Doug Wiegley 2014-07-10 20:44:21 -06:00
parent c9bea66dfe
commit 5a43874658

View File

@ -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"