diff options
author | Mat Booth | 2016-04-05 23:52:12 +0000 |
---|---|---|
committer | Mat Booth | 2016-04-05 23:58:45 +0000 |
commit | ebb80dcfae4b1263d0726eabf0603784e1422d8a (patch) | |
tree | 25b732737da2e0e94eea6125ebb8a35e2cf61c8c | |
parent | a504d79f37ec4e8d9d57782fbaa9925fbad80e84 (diff) | |
download | org.eclipse.linuxtools.eclipse-build-ebb80dcfae4b1263d0726eabf0603784e1422d8a.tar.gz org.eclipse.linuxtools.eclipse-build-ebb80dcfae4b1263d0726eabf0603784e1422d8a.tar.xz org.eclipse.linuxtools.eclipse-build-ebb80dcfae4b1263d0726eabf0603784e1422d8a.zip |
Teach "prepAllTestBundles.sh" to honour tycho surefire exclusions.
Previously, we would ignore any "<excludes>" specified in pom.xml
files. This had the effect of trying to run classes as test cases
that were never meant to be run that way. This would manifest as
a failure due to "no runnable methods" during a test suite run.
Change-Id: Iad649c1b8354134fadf4f74bea1a5035f2942f4a
Signed-off-by: Mat Booth <mat.booth@redhat.com>
Reviewed-on: https://git.eclipse.org/r/69968
-rwxr-xr-x | testbundle-to-eclipse-test/prepAllTestBundles.sh | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/testbundle-to-eclipse-test/prepAllTestBundles.sh b/testbundle-to-eclipse-test/prepAllTestBundles.sh index b12b226..84c7a9c 100755 --- a/testbundle-to-eclipse-test/prepAllTestBundles.sh +++ b/testbundle-to-eclipse-test/prepAllTestBundles.sh @@ -38,27 +38,35 @@ for jar in `find ${testBundleFolder} -name "*.jar" | grep -v eclipse-tests`; do useSWTBot='true' fi - # Find Test class(es) - includepatterns= - testclasses= - testclass=`unzip -p ${jar} ${jarPomPath} | grep '<testClass>' | sed 's/.*<testClass>\(.*\)<\/testClass>.*/\1/'` - if [ "${testclass}" = '' ]; then - # Check for custom includes - includepatterns=`unzip -p ${jar} ${jarPomPath} | sed -n '/<includes>/,/<\/includes>/p' | sed -n 's/.*<include>\(.*\)<\/include>.*/\1/p' | sed 's/\*\*/\.\*/'` - for pat in ${includepatterns}; do - testclasses="${testclasses} `jar -tf ${jar} | grep -E "${pat}" | grep '.class' | grep -v '\\$' | tr '/' '.' | sed 's/\.class//'`" - done - if [ "${includepatterns}" = '' ]; then - testclass=`jar -tf ${jar} | grep '/AllTests.class' | tr '/' '.' | sed 's/\.class//'` - fi - fi - if [ "${testclass}" = '' ]; then - if [ "${includepatterns}" = '' ]; then - # Use default includes - testclasses=`jar -tf ${jar} | grep -E '/(Test.*\.class|.*Test\.class)' | grep -vE '/(Abstract.*\.class|.*Abstract\.class)' | grep -v '\\$' | tr '/' '.' | sed 's/\.class//'` + # Check for explicit test class + testclasses=$(unzip -p ${jar} ${jarPomPath} | grep '<testClass>' | sed 's/.*<testClass>\(.*\)<\/testClass>.*/\1/') + if [ -z "$testclasses" ] ; then + # Check for custom includes and excludes + includepatterns=`unzip -p ${jar} ${jarPomPath} | sed -n '/<includes>/,/<\/includes>/p' | sed -n 's/.*<include>\(.*\)<\/include>.*/\1/p' | sed -e 's/\*\*/\*/' -e 's/\./\\\\./g' -e 's/\*/\.\*/g'` + excludepatterns=`unzip -p ${jar} ${jarPomPath} | sed -n '/<excludes>/,/<\/excludes>/p' | sed -n 's/.*<exclude>\(.*\)<\/exclude>.*/\1/p' | sed -e 's/\*\*/\*/' -e 's/\./\\\\./g' -e 's/\*/\.\*/g'` + # List of all non-inner classes + allclasses="$(jar -tf ${jar} | grep '.class$' | grep -v '\$')" + # Default includes, if custom includes are not specified + if [ -z "$includepatterns" ] ; then + includepatterns='.*/(Test.*\.class|.*Test\.class)' + # Override and use the "all" classes instead, if one is detected and neither custom includes nor excludes are specified + if [ -z "$excludepatterns" ] ; then + allpattern='.*/AllTests\.class' + all="$(echo "$allclasses" | grep -E "${allpattern}\$")" + if [ -n "$all" ] ; then + includepatterns='.*/AllTests\.class' + fi + fi fi - else - testclasses="${testclass}" + # Trim list down using include and exclude patterns + for pat in $includepatterns ; do + testclasses="$testclasses $(echo "$allclasses" | grep -E "${pat}\$")" + done + for pat in $excludepatterns '.*/Abstract.*\.class' ; do + testclasses="$(echo "$testclasses" | grep -vE "${pat}\$")" + done + # Convert to dotted class names + testclasses="$(echo "$testclasses" | tr '/' '.' | sed 's/\.class//')" fi for testclass in ${testclasses} ; do |