#! /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 mkdir target pushd target # Prepare testing environment if [ ! -e /usr/share/java/eclipse-testing ]; then echo "/usr/share/java/eclipse-testing/ does not exist. Please install the package providing this location." exit 1 fi cp -rp /usr/share/java/eclipse-testing/* ./ # Remove eclipse-tests p2 repo and generate for system rm -rf features plugins content.jar artifacts.jar binary # Create directory of all system OSGi bundles # Do not create into p2 repo yet (we must make test bundles have dir shape) ../gatherBundles.sh $(pwd) popd # Prepare the test.xml file sed -i 's/\${eclipse-home}\/plugins\/\${testPluginX}/\${testPluginX}/' target/test.xml sed -i '// s/dir="\${eclipse-home}\/plugins"/dir="\${basedir}"/' target/test.xml sed -i 's/refid="test.plugin.file" \/>/value="\${basedir}\/alltest.xml" \/>/' target/test.xml sed -i 's/\${report}/\${testPlugin}/' target/test.xml # Support multiple XML reports from same bundle but different test classes sed -i '/' target/test.xml sed -i 's/@{testPlugin}\.xml/@{testPlugin}-@{testClass}\.xml/' target/test.xml sed -i 's/\${testPlugin}\.xml/\${output-file}/' target/test.xml sed -i 's/\${testPlugin}_\${platform}\.xml/\${output-file}/' target/test.xml # Insert our test task sed -i '// d' target/test.xml sed -i '// d' target/test.xml sed -i '// a ' target/test.xml # A VERY dirty hack to mimic Tycho's improper usage of test bundle resources sed -i '// i \ \ \ <\/path> \ \ \ \ ' target/test.xml # Define our test task sed -i '// i \ \ \ \ \ \ \ \ <\/junitreport> \ \ \ <\/target>' target/test.xml sed -i 's/"-installIUs \(.*\)"/"-installIUs \1,org.eclipse.swtbot.eclipse.junit.headless"/' target/test.xml # Prepare the runtests.sh file sed -i '/cp \${testslocation}\/\*\.properties/ a cp \${testslocation}\/{JUNIT.XSL,alltest.xml,updateTestBundleXML.sh,swtbot-library.xml} \.' target/runtests.sh sed -i '/^properties=/ a testslocation=\$(pwd)' target/runtests.sh # Do not print test properties (output is annoying) sed -i '/echoproperties/d' target/library.xml cp swtbot-library.xml alltest.xml updateTestBundleXML.sh target/