diff options
author | Eike Stepper | 2018-01-03 16:49:12 +0000 |
---|---|---|
committer | Eike Stepper | 2018-01-03 16:49:12 +0000 |
commit | 0bed1dcacbf3470342fe48f65859d94f02e5084d (patch) | |
tree | 9493d480ba6b5cca379338e3145a468b8851d952 /releng | |
parent | 5fcdb2849bdb23e634f703aa86cb4ea9566ef33d (diff) | |
download | cdo-0bed1dcacbf3470342fe48f65859d94f02e5084d.tar.gz cdo-0bed1dcacbf3470342fe48f65859d94f02e5084d.tar.xz cdo-0bed1dcacbf3470342fe48f65859d94f02e5084d.zip |
[528979] Migrate build to Maven/Tycho
https://bugs.eclipse.org/bugs/show_bug.cgi?id=528979
Diffstat (limited to 'releng')
3 files changed, 237 insertions, 35 deletions
diff --git a/releng/org.eclipse.emf.cdo.releng/hudson/generate.ant b/releng/org.eclipse.emf.cdo.releng/hudson/generate.ant index ec3580640f..e70d34e5dc 100644 --- a/releng/org.eclipse.emf.cdo.releng/hudson/generate.ant +++ b/releng/org.eclipse.emf.cdo.releng/hudson/generate.ant @@ -9,7 +9,7 @@ Contributors: Eike Stepper - initial API and implementation --> -<project name="CDO" default="generate"> +<project name="generate" default="generate"> <!-- ==== --> <!-- Init --> @@ -19,14 +19,9 @@ <property environment="env" /> <property name="build.root" value="${env.WORKSPACE}" /> <property name="git.clone" location="${build.root}/git" /> - <property name="features.dir" location="${git.clone}/features" /> - <property name="plugins.dir" location="${git.clone}/plugins" /> <property name="releng.dir" location="${git.clone}/releng" /> <property name="releng" location="${releng.dir}/org.eclipse.emf.cdo.releng" /> - <property name="releng.help" location="${releng.dir}/org.eclipse.emf.cdo.releng.help" /> <property name="releng.site" location="${releng.dir}/org.eclipse.emf.cdo.releng.site" /> - <property name="test.report" location="${build.root}/test-report.xml" /> - <property name="zips" location="${build.root}/zips" /> <property file="ant.properties" /> <property file="${build.root}/build-info.properties" /> @@ -43,6 +38,7 @@ <include name="plugins/**" /> <include name="binary/**" /> <include name="zips/**" /> + <include name="tests/**" /> <include name="help/**" /> <include name="*.jar" /> <include name="*.css" /> @@ -58,11 +54,13 @@ </fileset> </delete> + <!-- <echoxml file="${test.report}"> <testsuite name="CDO AllTests" tests="1" errors="0" failures="0" ignored="0"> <testcase name="noTestHasBeenExecuted" classname="org.eclipse.emf.cdo.tests.NoTest" time="0.00"/> </testsuite> </echoxml> + --> </target> <!-- ============= --> @@ -102,6 +100,7 @@ <!-- ============= --> <target name="generate-help" depends="clean"> + <property name="releng.help" location="${releng.dir}/org.eclipse.emf.cdo.releng.help" /> <mkdir dir="${build.root}/help" /> <copy todir="${build.root}/help"> <fileset dir="${releng.help}/html"> @@ -153,6 +152,7 @@ <!-- ================ --> <target name="generate-dropins" depends="clean"> + <property name="zips" location="${build.root}/zips" /> <mkdir dir="${zips}" /> <zip destfile="${zips}/emf-cdo-${build.qualifier}-Dropins.zip"> <fileset dir="${releng.site}/target/repository"> @@ -165,9 +165,9 @@ file="${zips}/emf-cdo-${build.qualifier}-Dropins.properties" /> </target> - <!-- ============ --> - <!-- Generate API --> - <!-- ============ --> + <!-- ==================== --> + <!-- Generate API Reports --> + <!-- ==================== --> <target name="generate-apireports" depends="clean"> <copy file="${releng}/api/api.xml" todir="${build.root}" overwrite="true" /> @@ -182,10 +182,45 @@ </java> </target> + <!-- ==================== --> + <!-- Generate Test Reports --> + <!-- ==================== --> + + <target name="generate-testreports" depends="clean"> + <property name="tests" location="${build.root}/tests" /> + <mkdir dir="${tests}" /> + <copy todir="${tests}/tmp" flatten="true"> + <fileset dir="${build.root}"> + <include name="**/target/surefire-reports/TEST-*.xml" /> + </fileset> + </copy> + <java classname="org.eclipse.emf.cdo.releng.FixTestReportNesting"> + <classpath> + <pathelement location="${releng}/target/classes/" /> + </classpath> + <arg value="${tests}/tmp" /> + </java> + <junitreport todir="${tests}"> + <fileset dir="${tests}/tmp/singles"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${tests}"> + <param name="TITLE" expression="CDO ${build.qualifier} Test Results" /> + </report> + </junitreport> + <delete includeemptydirs="true"> + <fileset dir="${tests}"> + <include name="tmp/**" /> + </fileset> + </delete> + <replace dir="${tests}" includes="**/package-summary.html" token="<h3>Package " value="<h3>Scenario " /> + <replace dir="${tests}" includes="overview-*.html" token="<h2>Packages</h2>" value="<h2>Scenarios</h2>" /> + </target> + <!-- ======== --> <!-- Generate --> <!-- ======== --> - <target name="generate" depends="generate-site,generate-help,generate-bookmarks,generate-dropins,generate-apireports" /> + <target name="generate" depends="generate-site,generate-help,generate-bookmarks,generate-dropins,generate-apireports,generate-testreports" /> </project> diff --git a/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/FixTestReportNesting.java b/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/FixTestReportNesting.java new file mode 100644 index 0000000000..86f426d9ab --- /dev/null +++ b/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/FixTestReportNesting.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2017 Eike Stepper (Berlin, Germany) and others. + * 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 + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.releng; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Eike Stepper + */ +public class FixTestReportNesting +{ + private static final String NL = System.getProperty("line.separator"); + + private static final Pattern TESTCASE = Pattern.compile("<testcase name=\"([^\"]*)\" classname=\"([^\"]*)\" time=\"([^\"]*)\"(/?>)"); + + private static StringBuilder builder; + + private static String lastClassname; + + private static String scenario; + + private static String artificialClassname; + + private static File folder; + + private static int tests; + + private static int errors; + + private static int failures; + + private static float times; + + public static void main(String[] args) throws Exception + { + folder = new File(args[0]); + + for (File file : folder.listFiles()) + { + String name = file.getName(); + if (name.startsWith("TEST-") && name.endsWith(".xml")) + { + fix(file); + } + } + } + + private static void fix(File file) throws IOException + { + String path = file.getAbsolutePath(); + scenario = path.substring(0, path.length() - ".xml".length()); + scenario = scenario.substring(scenario.lastIndexOf('.') + 1); + + BufferedReader reader = null; + + try + { + reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + + String line; + while ((line = reader.readLine()) != null) + { + String trimmed = line.trim(); + if (trimmed.startsWith("<testcase name=")) + { + Matcher matcher = TESTCASE.matcher(trimmed); + if (matcher.matches()) + { + String name = matcher.group(1); + String classname = matcher.group(2); + String time = matcher.group(3); + String ending = matcher.group(4); + + times += Float.parseFloat(time); + ++tests; + + if (!classname.equals(lastClassname)) + { + if (lastClassname != null) + { + finishTestSuite(); + } + } + + lastClassname = classname; + artificialClassname = scenario + "." + lastClassname.substring(lastClassname.lastIndexOf('.') + 1); + + if (builder == null) + { + builder = new StringBuilder(); + } + + writeln(" <testcase name=\"" + name + "\" classname=\"" + classname + "\" time=\"" + time + "\"" + ending); + continue; + } + } + else if (trimmed.startsWith("<error message=")) + { + ++errors; + } + else if (trimmed.startsWith("<failure message=")) + { + ++failures; + } + else if (trimmed.startsWith("</testsuite>")) + { + continue; + } + + writeln(line); + } + + if (lastClassname != null) + { + finishTestSuite(); + } + } + finally + { + if (reader != null) + { + reader.close(); + } + } + } + + private static void finishTestSuite() throws IOException + { + if (builder != null) + { + String text = builder.toString(); + builder = null; + + File tmp = new File(folder, "singles"); + tmp.mkdirs(); + + BufferedWriter writer = null; + + try + { + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(tmp, "TEST-" + artificialClassname + ".xml")))); + writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); + writer.write(NL); + writer.write("<testsuite name=\"" + artificialClassname + "\" tests=\"" + tests + "\" errors=\"" + errors + "\" failures=\"" + failures + "\" time=\"" + + times + "\">"); + writer.write(NL); + writer.write(text); + writer.write("</testsuite>"); + writer.write(NL); + } + finally + { + if (writer != null) + { + writer.close(); + } + } + + lastClassname = null; + tests = 0; + errors = 0; + failures = 0; + times = 0.0f; + } + } + + private static void writeln(String line) throws IOException + { + if (builder != null) + { + builder.append(line); + builder.append(NL); + } + } +} diff --git a/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/Main.java b/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/Main.java deleted file mode 100644 index 2da5b95c1c..0000000000 --- a/releng/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2017 Eike Stepper (Berlin, Germany) and others. - * 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 - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.releng; - -/** - * @author Eike Stepper - */ -public class Main -{ - public static void main(String[] args) - { - for (String arg : args) - { - System.out.println(arg); - } - } -} |