diff options
author | Roland Grunberg <rgrunber@redhat.com> | 2013-08-08 15:08:56 -0400 |
---|---|---|
committer | Roland Grunberg <rgrunber@redhat.com> | 2013-08-08 15:52:37 -0400 |
commit | f9a71ca6994a9e9fa7e29451f91fbf4445e53cf7 (patch) | |
tree | aa5d1f5b193d5e3283d33e110869cdec41010d1b | |
download | tycho-surefire-testbundlerunner-f9a71ca6994a9e9fa7e29451f91fbf4445e53cf7.tar.gz tycho-surefire-testbundlerunner-f9a71ca6994a9e9fa7e29451f91fbf4445e53cf7.tar.xz tycho-surefire-testbundlerunner-f9a71ca6994a9e9fa7e29451f91fbf4445e53cf7.zip |
Initial Commit.
-rw-r--r-- | pom.xml.orig | 92 | ||||
-rwxr-xr-x | prepTestBundle.sh | 67 | ||||
-rwxr-xr-x | runAllTestBundles.sh | 24 |
3 files changed, 183 insertions, 0 deletions
diff --git a/pom.xml.orig b/pom.xml.orig new file mode 100644 index 0000000..4195153 --- /dev/null +++ b/pom.xml.orig @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2011, Red Hat, Inc. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.eclipse.tycho</groupId> + <artifactId>org.eclipse.tycho.surefire.testbundlerunner</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Tycho Surefire Test Bundle Runner</name> + + <properties> + <tycho-version>0.18.0</tycho-version> + <platform-version-name>kepler</platform-version-name> + <sdk-version>4.3</sdk-version> + <eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site> + <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20130118183705/repository</orbit-site> + <swtbot-site>http://download.eclipse.org/technology/swtbot/snapshots</swtbot-site> + </properties> + + <repositories> + <repository> + <id>orbit</id> + <layout>p2</layout> + <url>${orbit-site}</url> + </repository> + <repository> + <id>kepler</id> + <layout>p2</layout> + <url>${eclipse-site}</url> + </repository> + <repository> + <id>swtbot</id> + <layout>p2</layout> + <url>${swtbot-site}</url> + </repository> + </repositories> + + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-maven-plugin</artifactId> + <version>${tycho-version}</version> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>target-platform-configuration</artifactId> + <version>${tycho-version}</version> + <configuration> + <resolver>p2</resolver> + </configuration> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <useUIHarness>true</useUIHarness> + <useUIThread>true</useUIThread> + <dependencies> + <dependency> + <type>p2-installable-unit</type> + <artifactId>org.eclipse.sdk.feature.group</artifactId> + <version>${sdk-version}</version> + </dependency> + </dependencies> + <product>org.eclipse.sdk.ide</product> + <argLine>-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -Dorg.eclipse.swt.browser.UseWebKitGTK=true</argLine> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <modules> + </modules> + +</project> diff --git a/prepTestBundle.sh b/prepTestBundle.sh new file mode 100755 index 0000000..be704d2 --- /dev/null +++ b/prepTestBundle.sh @@ -0,0 +1,67 @@ +#! /bin/bash + +# Copyright (C) 2013, Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html + +# Support for running Tycho Surefire on an OSGi Test Bundle +# mvn org.eclipse.tycho:tycho-surefire-plugin:test + +# Maven Conceptual Layout +# org.eclipse.tycho:org.eclipse.tycho.surefire.testbundlerunner +# | plugin:tycho-maven-plugin +# | plugin:target-platform-configuration +# | +# --> osgiTestBundle (gid:aid) +# plugin:tycho-surefire-plugin + + +# File System Conceptual Layout +# org.eclipse.tycho:org.eclipse.tycho.surefire.testbundlerunner +# | +# --> pom.xml +# --> ${bsname} +# | +# --> pom.xml +# --> META-INF/MANIFEST.MF +# --> target/classes/**.class +# --> resources/ + +jarLoc=$1 + +jarPomPath=`jar -tf ${jarLoc} | grep 'pom.xml'` +bsname=`unzip -p ${jarLoc} 'META-INF/MANIFEST.MF' | grep 'Bundle-SymbolicName' | sed 's/Bundle-SymbolicName: \([a-zA-Z.]*\)\(;\)\?.*/\1/'` + +mkdir ${bsname} +pushd ${bsname} + +# place manifest and pom +jar -xf ${jarLoc} 'META-INF/MANIFEST.MF' ${jarPomPath} +mv ${jarPomPath} . +rm -rf 'META-INF/maven' + +# set the parent +sed -i '/<parent>/,/<\/parent>/ s/<artifactId>.*<\/artifactId>/<artifactId>org.eclipse.tycho.surefire.testbundlerunner<\/artifactId>/ ' pom.xml +sed -i '/<parent>/,/<\/parent>/ s/<groupId>.*<\/groupId>/<groupId>org.eclipse.tycho<\/groupId>/ ' pom.xml +sed -i '/<parent>/,/<\/parent>/ s/<version>.*<\/version>/<version>1.0.0-SNAPSHOT<\/version>/ ' pom.xml + +# place classes +# non-classes will just be ignored +mkdir -p target/classes +pushd target/classes +jar -xf ${jarLoc} +popd + +# place resources and other files +# non-resources will just be ignored +jar -xf ${jarLoc} + +popd + +if [ ! -e pom.xml ]; then + cp pom.xml{.orig,} +fi +# link the parent to the child +sed -i "/<\/modules>/ i <module>${bsname}<\/module>" pom.xml diff --git a/runAllTestBundles.sh b/runAllTestBundles.sh new file mode 100755 index 0000000..d5a2d10 --- /dev/null +++ b/runAllTestBundles.sh @@ -0,0 +1,24 @@ +#! /bin/bash + +# Copyright (C) 2013, Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html + +# Run Tycho Surefire on a set of an Eclipse Test Bundles + +# The definiton of an Eclipse Test Bundle for our purposes is any packaged +# OSGi bundle containing a pom.xml with a packaging type of +# 'eclipse-test-plugin' + +# Takes a single argument (absolute path of folder containing test bundles) + +testBundleFolder=$1 + +for jar in `find ${testBundleFolder} -name "*.jar"`; do + jarPomPath=`jar -tf ${jar} | grep 'pom.xml'` + unzip -p ${jar} ${jarPomPath} | grep -q '<packaging>eclipse-test-plugin</packaging>' && ./prepTestBundle.sh ${jar} +done + +mvn-rpmbuild -fae -DskipTychoVersionCheck org.eclipse.tycho:tycho-surefire-plugin:test |