summaryrefslogtreecommitdiffstats
path: root/prepRuntimeLocation.sh
blob: 7e886435cc8bac8ee9f337a4f1ae378f366d6f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /bin/bash

mkdir target
pushd target

# Prepare testing environment
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
/usr/share/java/tycho/copy-platform-all $(pwd)

popd

# Prepare the test.xml file

sed -i 's/\${eclipse-home}\/plugins\/\${testPluginX}/\${testPluginX}/' target/test.xml
sed -i '/<fileset/,/<\/fileset>/ 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 '/<attribute name="testPlugin"/ a <attribute name="testClass" \/>'  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 '/<antcall target="quickTests" \/>/ d' target/test.xml
sed -i '/<antcall target="longRunningTests" \/>/ d' target/test.xml
sed -i '/<target name="all">/ a <antcall target="linuxtoolsTests" \/>' target/test.xml

# Define our test task
sed -i '/<target name="quickTests">/ i \
<target name="linuxtoolsTests"> \
<!-- Copy over the XML to generate a top-level report for all of the tests --> \
    	    	<mkdir dir="\${results}\/origXml" \/> \
    			<xslt style="\${repoLocation}\/splitter.xsl" basedir="\${results}\/xml" includes="*.xml" destdir="\${results}\/origXml"\/> \
    	    	<!-- Aggregate XML report files --> \
    	    	<junitreport todir="\${results}\/xml" tofile="org.eclipse.sdk.tests.xml"> \
    	    		<fileset dir="\${results}/origXml" includes="*.xml" \/> \
    	    	<\/junitreport> \
    	    	<!-- Generate top-level HTML report --> \
    	    	<xslt style="\${repoLocation}\/JUNIT.XSL" basedir="\${results}\/xml" includes="org.eclipse.sdk.tests.xml" destdir="\${results}\/html" \/> \
<\/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

cp swtbot-library.xml alltest.xml updateTestBundleXML.sh target/