]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Restore ability to run functional tests with run_tests.sh
authorTerry Wilson <twilson@redhat.com>
Wed, 16 Apr 2014 20:23:40 +0000 (16:23 -0400)
committerTerry Wilson <twilson@redhat.com>
Wed, 23 Apr 2014 15:37:35 +0000 (10:37 -0500)
Change f20b1d42 which split the running of functional tests from
the running of unit tests caused running:
  ./run_tests.sh neutron.tests.functional
to fail as the OS_TEST_PATH variable will be defaulted to
neutron.tests.unit which means that the functional tests will not
be discovered in the above case.

This patch trys to detect an argument passed in the form of a
neutron.tests string and correctly sets the OS_TEST_PATH variable
based on it.

Change-Id: I8ccdc7f10d3c8478281aeaf8d02175d0eeb8d6e9

run_tests.sh

index 4d838e8aa9dc0d75bf86dcf379ccef2621d71e4f..8f0dbd3d7d400a2bb69319bb98f04d9683851d69 100755 (executable)
@@ -130,6 +130,12 @@ function run_tests {
   set +e
   testrargs=`echo "$testrargs" | sed -e's/^\s*\(.*\)\s*$/\1/'`
   TESTRTESTS="$TESTRTESTS --testr-args='--subunit $testropts $testrargs'"
+  OS_TEST_PATH=`echo $testrargs|grep -o 'neutron\.tests[^[:space:]:]*\+'|tr . /`
+  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"
+  fi
   echo "Running \`${wrapper} $TESTRTESTS\`"
   bash -c "${wrapper} $TESTRTESTS | ${wrapper} subunit2pyunit"
   RESULT=$?