[SUREFIRE-1472] Multibranch Pipeline supports JDK 7-10 Maven 3.2-3.5 Linux Windows
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/ea893232 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/ea893232 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/ea893232 Branch: refs/heads/SUREFIRE-1463 Commit: ea89323267645b979e4078ac69a56f3894465072 Parents: 09f0eef Author: Tibor17 <tibordig...@apache.org> Authored: Tue Feb 6 05:30:00 2018 +0100 Committer: Tibor17 <tibordig...@apache.org> Committed: Fri Feb 16 23:48:52 2018 +0100 ---------------------------------------------------------------------- Jenkinsfile | 357 ------------------- Jenkinsfile.groovy | 284 +++++++++++++++ maven-failsafe-plugin/pom.xml | 5 + maven-surefire-common/pom.xml | 2 - maven-surefire-report-plugin/pom.xml | 1 + pom.xml | 93 +++-- surefire-api/pom.xml | 2 - surefire-booter/pom.xml | 2 - surefire-its/pom.xml | 16 +- .../maven/surefire/its/JUnit47ParallelIT.java | 6 +- .../apache/maven/surefire/its/UmlautDirIT.java | 17 +- .../surefire/its/fixture/JUnit4SuiteTest.java | 44 +++ .../its/fixture/SurefireLauncherTest.java | 4 - ...urefire1295AttributeJvmCrashesToTestsIT.java | 105 +++--- .../test/resources/crash-during-test/pom.xml | 13 + .../java/junit44/environment/BasicTest.java | 52 --- .../java/junit44/environment/SomeOtherTest.java | 28 -- .../junit44/environment/Test1CrashedTest.java | 52 +++ .../junit44/environment/Test2WaitingTest.java | 34 ++ .../java/junit44/environment/Test3FastTest.java | 30 ++ surefire-providers/pom.xml | 1 - surefire-providers/surefire-junit3/pom.xml | 1 - surefire-providers/surefire-junit4/pom.xml | 6 - .../surefire/junitcore/pc/ParallelComputer.java | 22 +- .../junitcore/pc/ParallelComputerBuilder.java | 2 +- .../pc/ParallelComputerBuilderTest.java | 82 +++-- .../junitcore/pc/ParallelComputerUtilTest.java | 63 ++-- surefire-report-parser/pom.xml | 12 +- .../surefire/report/JUnit4SuiteTest.java | 46 +++ 29 files changed, 757 insertions(+), 625 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/Jenkinsfile ---------------------------------------------------------------------- diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index c080713..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env groovy - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -properties( - [ - buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '0', daysToKeepStr: env.BRANCH_NAME == 'master' ? '30' : '7', numToKeepStr: '5')), - disableConcurrentBuilds() - ] -) - -def oses = ['windows'] // ['linux', 'windows'] -def mavens = env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.5.x'] -def jdks = ['9'] // env.BRANCH_NAME == 'master' ? ['7', '8', '9', '10'] : ['10'] - -def cmd = ['mvn'] -def options = ['-e', '-V', '-nsu'] -def optionsITs = ['-e', '-V', '-nsu', '-P', 'run-its'] -def goals = ['clean', 'install' , 'jacoco:report'] -def goalsITs = ['verify'] -def Map stages = [:] - -oses.eachWithIndex { os, indexOfOs -> - - mavens.eachWithIndex { maven, indexOfMaven -> - - jdks.eachWithIndex { jdk, indexOfJdk -> - - def String label = jenkinsEnv.labelForOS(os); - def String jdkTestName = jenkinsEnv.jdkFromVersion(os, jdk) - def String jdkName = jenkinsEnv.jdkFromVersion(os, '8') - def String mvnName = jenkinsEnv.mvnFromVersion(os, maven) - - def stageKey = "${os}-jdk${jdk}-maven${maven}" - - if (label == null || jdkTestName == null || mvnName == null) { - println "Skipping ${stageKey} as unsupported by Jenkins Environment." - return; - } - - println "${stageKey} ==> Label: ${label}, JDK: ${jdkTestName}, Maven: ${mvnName}." - - - stages[stageKey] = { - if (os == 'windows') { - node("${env.WIN_LABEL}") { - try { - println "Basedir = ${pwd()}." - - def mvnLocalRepoDir - - dir('.repository') { - mvnLocalRepoDir = "${pwd()}" - } - - println "Maven Local Repository = ${mvnLocalRepoDir}." - - dir('build') { - stage("checkout ${stageKey}") { - checkout scm - } - - def jdkTestHome = resolveToolNameToJavaPath(jdkTestName, mvnName) - def properties = ["\"-Djdk.home=${jdkTestHome}\"", "-Djacoco.skip=true"] - println("Setting JDK for testing ${properties[0]}") - - stage("build ${stageKey}") { - withMaven(jdk: jdkName, maven: mvnName, - mavenLocalRepo: mvnLocalRepoDir, mavenOpts: '-Xmx512m', - options: [ - artifactsPublisher(disabled: true), - ]) { - def script = cmd + options + goals + properties - bat script.join(' ') - } - } - - def propertiesITs = properties - - stage("build-failsafe-it ${stageKey}") { -// lock('maven-surefire-its') { -// timeout(time: 15, unit: 'MINUTES') { -// withMaven(jdk: jdkName, maven: mvnName, -// mavenLocalRepo: mvnLocalRepoDir, mavenOpts: '-Xmx512m', -// options: [ -// invokerPublisher(), -// artifactsPublisher(disabled: true) -// ]) { -// def script = cmd + optionsITs + goalsITs + propertiesITs -// bat script.join(' ') -// } -// } -// } - } - } - } finally { -// Wait for INFRA installation of Pipeline Utils, use fileExists() -// if (fileExists('build/maven-failsafe-plugin/target/it') { -// zip(zipFile: "it--maven-failsafe-plugin--${stageKey}.zip", dir: 'build/maven-failsafe-plugin/target/it', archive: true) -// } -// -// if (fileExists('build/surefire-its/target') { -// zip(zipFile: "it--surefire-its--${stageKey}.zip", dir: 'build/surefire-its/target', archive: true) -// } - -// archiveArtifacts(artifacts: 'build/surefire-its/target/**/log.txt', allowEmptyArchive: true, fingerprint: true, onlyIfSuccessful: false) - - stage("cleanup ${stageKey}") { - // clean up after ourselves to reduce disk space - cleanWs() - } - } - } - } else { - node("${env.NIX_LABEL}") { - try { - println "Basedir = ${pwd()}." - - def mvnLocalRepoDir - - dir('.repository') { - mvnLocalRepoDir = "${pwd()}" - } - - println "Maven Local Repository = ${mvnLocalRepoDir}." - - dir('build') { - stage("checkout ${stageKey}") { - checkout scm - } - - def jdkTestHome = resolveToolNameToJavaPath(jdkTestName, mvnName) - //https://github.com/jacoco/jacoco/issues/629 - def skipPlugins = jdk != '9' - def properties = ["\"-Djdk.home=${jdkTestHome}\"", "-Djacoco.skip=${skipPlugins}"] - println("Setting JDK for testing ${properties[0]}") - - stage("build ${stageKey}") { - withMaven(jdk: jdkName, maven: mvnName, - mavenLocalRepo: mvnLocalRepoDir, mavenOpts: '-Xmx1g', - options: [ - findbugsPublisher(disabled: skipPlugins), - openTasksPublisher(disabled: skipPlugins, ignoreCase: true, - pattern: sourcesPatternCsv(), - low: tasksViolationLow(), - normal: tasksViolationNormal(), - high: tasksViolationHigh()), - artifactsPublisher(disabled: true) - ]) { - def script = cmd + options + goals + properties - sh script.join(' ') - } - } - - def propertiesITs = [properties[0], '-Djacoco.skip=true'] - - stage("build-failsafe-it ${stageKey}") { -// lock('maven-surefire-its') { -// timeout(time: 15, unit: 'MINUTES') { -// withMaven(jdk: jdkName, maven: mvnName, -// mavenLocalRepo: mvnLocalRepoDir, mavenOpts: '-Xmx1g', -// options: [ -// invokerPublisher(), -// openTasksPublisher(disabled: true, ignoreCase: true, -// pattern: sourcesPatternCsv(), -// low: tasksViolationLow(), -// normal: tasksViolationNormal(), -// high: tasksViolationHigh()), -// artifactsPublisher(disabled: true) -// ]) { -// def script = cmd + optionsITs + goalsITs + propertiesITs -// sh script.join(' ') -// } -// } -// } - } - } - } finally { - if (indexOfMaven == mavens.size() - 1 && jdk == '9') { - jacoco(changeBuildStatus: false, - execPattern: '**/*.exec', - sourcePattern: sourcesPatternCsv(), - classPattern: classPatternCsv()) - - junit(healthScaleFactor: 0.0, - allowEmptyResults: true, - keepLongStdio: true, - testResults: testReportsPatternCsv()) - - if (currentBuild.result == 'UNSTABLE') { - currentBuild.result = 'FAILURE' - } - } - -// Wait for INFRA installation of Pipeline Utils, use fileExists() -// if (fileExists('build/maven-failsafe-plugin/target/it') { -// zip(zipFile: "it--maven-failsafe-plugin--${stageKey}.zip", dir: 'build/maven-failsafe-plugin/target/it', archive: true) -// } -// -// if (fileExists('build/surefire-its/target') { -// zip(zipFile: "it--surefire-its--${stageKey}.zip", dir: 'build/surefire-its/target', archive: true) -// } -// -// sh 'tar czvf it1.tgz build/maven-failsafe-plugin/target/it' -// sh 'tar czvf it2.tgz build/surefire-its/target' -// archiveArtifacts(artifacts: '**/*.tgz', allowEmptyArchive: true, fingerprint: true, onlyIfSuccessful: false) -// archiveArtifacts(artifacts: '*.tgz', allowEmptyArchive: true, fingerprint: true, onlyIfSuccessful: false) - - stage("cleanup ${stageKey}") { - // clean up after ourselves to reduce disk space - cleanWs() - } - } - } - } - } - } - } -} - -timeout(time: 18, unit: 'HOURS') { - try { - parallel(stages) - // JENKINS-34376 seems to make it hard to detect the aborted builds - } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { - // this ambiguous condition means a user probably aborted - if (e.causes.size() == 0) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e - } catch (hudson.AbortException e) { - // this ambiguous condition means during a shell step, user probably aborted - if (e.getMessage().contains('script returned exit code 143')) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e - } catch (InterruptedException e) { - currentBuild.result = "ABORTED" - throw e - } catch (Throwable e) { - currentBuild.result = "FAILURE" - throw e - } finally { - stage("notifications") { - //jenkinsNotify() - } - } -} - -/** - * It is used instead of tool(${jdkTestName}). - */ -def resolveToolNameToJavaPath(jdkToolName, mvnName) { - def javaHome = null - try { - withMaven(jdk: jdkToolName, maven: mvnName) { - javaHome = isUnix() ? sh(script: 'echo -en $JAVA_HOME', returnStdout: true) : bat(script: '@echo %JAVA_HOME%', returnStdout: true) - } - - if (javaHome != null) { - javaHome = javaHome.trim() - def exec = javaHome + (isUnix() ? '/bin/java' : '\\bin\\java.exe') - if (!fileExists(exec)) { - println "The ${exec} does not exist in jdkToolName=${jdkToolName}." - javaHome = null - } - } - } catch(e) { - println "Caught an exception while resolving 'jdkToolName' ${jdkToolName} via 'mvnName' ${mvnName}: ${e}" - javaHome = null; - } - assert javaHome != null : "Could not resolve ${jdkToolName} to JAVA_HOME." - return javaHome -} - -@NonCPS -def sourcesPatternCsv() { - return '**/maven-failsafe-plugin/src/main/java,' + - '**/maven-surefire-common/src/main/java,' + - '**/maven-surefire-plugin/src/main/java,' + - '**/maven-surefire-report-plugin/src/main/java,' + - '**/surefire-api/src/main/java,' + - '**/surefire-booter/src/main/java,' + - '**/surefire-grouper/src/main/java,' + - '**/surefire-its/src/main/java,' + - '**/surefire-logger-api/src/main/java,' + - '**/surefire-providers/**/src/main/java,' + - '**/surefire-report-parser/src/main/java' -} - -@NonCPS -def classPatternCsv() { - return '**/maven-failsafe-plugin/target/classes,' + - '**/maven-surefire-common/target/classes,' + - '**/maven-surefire-plugin/target/classes,' + - '**/maven-surefire-report-plugin/target/classes,' + - '**/surefire-api/target/classes,' + - '**/surefire-booter/target/classes,' + - '**/surefire-grouper/target/classes,' + - '**/surefire-its/target/classes,' + - '**/surefire-logger-api/target/classes,' + - '**/surefire-providers/**/target/classes,' + - '**/surefire-report-parser/target/classes' -} - -@NonCPS -def tasksViolationLow() { - return '@SuppressWarnings' -} - -@NonCPS -def tasksViolationNormal() { - return 'TODO,FIXME,@deprecated' -} - -@NonCPS -def tasksViolationHigh() { - return 'finalize(),Locale.setDefault,TimeZone.setDefault,\ -System.out,System.err,System.setOut,System.setErr,System.setIn,System.exit,System.gc,System.runFinalization,System.load' -} - -@NonCPS -def testReportsPatternCsv() { - return '**/maven-failsafe-plugin/target/surefire-reports/*.xml,' + - '**/maven-surefire-common/target/surefire-reports/*.xml,' + - '**/maven-surefire-plugin/target/surefire-reports/*.xml,' + - '**/maven-surefire-report-plugin/target/surefire-reports/*.xml,' + - '**/surefire-api/target/surefire-reports/*.xml,' + - '**/surefire-booter/target/surefire-reports/*.xml,' + - '**/surefire-grouper/target/surefire-reports/*.xml,' + - '**/surefire-its/target/surefire-reports/*.xml,' + - '**/surefire-logger-api/target/surefire-reports/*.xml,' + - '**/surefire-providers/**/target/surefire-reports/*.xml,' + - '**/surefire-report-parser/target/surefire-reports/*.xml,' + - '**/surefire-its/target/failsafe-reports/*.xml' -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/Jenkinsfile.groovy ---------------------------------------------------------------------- diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy new file mode 100644 index 0000000..89b0618 --- /dev/null +++ b/Jenkinsfile.groovy @@ -0,0 +1,284 @@ +#!/usr/bin/env groovy + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +properties( + [ + buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '0', daysToKeepStr: env.BRANCH_NAME == 'master' ? '30' : '7', numToKeepStr: '5')), + disableConcurrentBuilds() + ] +) + +final String NIX_LABEL = 'ubuntu-1||ubuntu-4||ubuntu-6||H19||H20' +final String WIN_LABEL = 'windows-2016-1' + +final def oses = ['windows'] // ['linux', 'windows'] +final def mavens = ['3.5.x'] // env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.5.x'] +final def jdks = ['9'] // env.BRANCH_NAME == 'master' ? ['7', '8', '9', '10'] : ['10'] + +final def cmd = ['mvn'] +final def options = ['-e', '-V', '-nsu', '-P', 'run-its'] +final def goals = ['clean', 'install', 'jacoco:report'] +final Map stages = [:] + +oses.eachWithIndex { os, indexOfOs -> + stages[os] = { + mavens.eachWithIndex { maven, indexOfMaven -> + jdks.eachWithIndex { jdk, indexOfJdk -> + final String label = jenkinsEnv.labelForOS(os); + final String jdkTestName = jenkinsEnv.jdkFromVersion(os, jdk) + final String jdkName = jenkinsEnv.jdkFromVersion(os, '8') + final String mvnName = jenkinsEnv.mvnFromVersion(os, maven) + final String stageKey = "${os}-jdk${jdk}-maven${maven}" + + if (label == null || jdkTestName == null || mvnName == null) { + println "Skipping ${stageKey} as unsupported by Jenkins Environment." + return; + } + + println "${stageKey} ==> Label: ${label}, JDK: ${jdkTestName}, Maven: ${mvnName}." + if (os == 'windows') { + node(WIN_LABEL) { + buildProcess(stageKey, jdkName, jdkTestName, mvnName, cmd, options, goals, false) + } + } else { + node(NIX_LABEL) { + boolean makeReports = indexOfMaven == mavens.size() - 1 && jdk == '9' + buildProcess(stageKey, jdkName, jdkTestName, mvnName, cmd, options, goals, makeReports) + } + } + } + } + } +} + +timeout(time: 24, unit: 'HOURS') { + try { + parallel(stages) + // JENKINS-34376 seems to make it hard to detect the aborted builds + } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { + // this ambiguous condition means a user probably aborted + if (e.causes.size() == 0) { + currentBuild.result = "ABORTED" + } else { + currentBuild.result = "FAILURE" + } + throw e + } catch (hudson.AbortException e) { + // this ambiguous condition means during a shell step, user probably aborted + if (e.getMessage().contains('script returned exit code 143')) { + currentBuild.result = "ABORTED" + } else { + currentBuild.result = "FAILURE" + } + throw e + } catch (InterruptedException e) { + currentBuild.result = "ABORTED" + throw e + } catch (Throwable e) { + currentBuild.result = "FAILURE" + throw e + } finally { + stage("notifications") { + //jenkinsNotify() + } + } +} + +def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvnName, cmd, options, goals, boolean makeReports) { + cleanWs() + try { + if (isUnix()) { + sh 'mkdir -p .m2' + } else { + bat 'mkdir .m2' + } + def mvnLocalRepoDir = null + dir('.m2') { + mvnLocalRepoDir = "${pwd()}" + } + + println "Maven Local Repository = ${mvnLocalRepoDir}." + assert mvnLocalRepoDir != null: 'Local Maven Repository is undefined.' + + stage("checkout ${stageKey}") { + checkout scm + } + + def jdkTestHome = resolveToolNameToJavaPath(jdkTestName, mvnName) + //https://github.com/jacoco/jacoco/issues/629 + def properties = ["\"-Djdk.home=${jdkTestHome}\"", "-Djacoco.skip=${!makeReports}"] + println("Setting JDK for testing ${properties[0]}") + def mavenOpts = '-server -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xms64m -Xmx1g -Djava.awt.headless=true' + + stage("build ${stageKey}") { + withMaven(jdk: jdkName, maven: mvnName, + mavenLocalRepo: mvnLocalRepoDir, mavenOpts: mavenOpts, + options: [ + findbugsPublisher(disabled: !makeReports), + openTasksPublisher(disabled: true), + junitPublisher(disabled: true), + artifactsPublisher(disabled: true), + invokerPublisher(disabled: true) + ]) { + def script = cmd + options + goals + properties + if (isUnix()) { + sh script.join(' ') + } else { + bat script.join(' ') + } + } + } + } finally { + if (makeReports) { + openTasks(ignoreCase: true, canComputeNew: false, defaultEncoding: 'UTF-8', pattern: sourcesPatternCsv(), + high: tasksViolationHigh(), normal: tasksViolationNormal(), low: tasksViolationLow()) + + jacoco(changeBuildStatus: false, + execPattern: '**/*.exec', + sourcePattern: sourcesPatternCsv(), + classPattern: classPatternCsv()) + + junit(healthScaleFactor: 0.0, + allowEmptyResults: true, + keepLongStdio: true, + testResults: testReportsPatternCsv()) + + if (currentBuild.result == 'UNSTABLE') { + currentBuild.result = 'FAILURE' + } + + if (fileExists('maven-failsafe-plugin/target/it')) { + sh "tar czf failsafe-its-${stageKey}.tgz maven-failsafe-plugin/target/it" + } + + if (fileExists('surefire-its/target')) { + sh "tar czf surefire-its-${stageKey}.tgz surefire-its/target" + } +// println(readFile('target/rat.txt')) +// Wait for INFRA installation of Pipeline Utils, use fileExists() +// if (fileExists('maven-failsafe-plugin/target/it')) { +// zip(zipFile: "it--maven-failsafe-plugin--${stageKey}.zip", dir: 'maven-failsafe-plugin/target/it', archive: true) +// } +// +// if (fileExists('surefire-its/target')) { +// zip(zipFile: "it--surefire-its--${stageKey}.zip", dir: 'surefire-its/target', archive: true) +// } +// +// archiveArtifacts(artifacts: 'surefire-its/target/**/log.txt', allowEmptyArchive: true, fingerprint: true, onlyIfSuccessful: false) + + archive excludes: '**/*.jar', includes: '*.tgz' + } + + + stage("cleanup ${stageKey}") { + // clean up after ourselves to reduce disk space + cleanWs() + } + } +} + +/** + * It is used instead of tool(${jdkTestName}). + */ +def resolveToolNameToJavaPath(jdkToolName, mvnName) { + def javaHome = null + try { + withMaven(jdk: jdkToolName, maven: mvnName) { + javaHome = isUnix() ? sh(script: 'echo -en $JAVA_HOME', returnStdout: true) : bat(script: '@echo %JAVA_HOME%', returnStdout: true) + } + + if (javaHome != null) { + javaHome = javaHome.trim() + def exec = javaHome + (isUnix() ? '/bin/java' : '\\bin\\java.exe') + if (!fileExists(exec)) { + println "The ${exec} does not exist in jdkToolName=${jdkToolName}." + javaHome = null + } + } + } catch(e) { + println "Caught an exception while resolving 'jdkToolName' ${jdkToolName} via 'mvnName' ${mvnName}: ${e}" + javaHome = null; + } + assert javaHome != null : "Could not resolve ${jdkToolName} to JAVA_HOME." + return javaHome +} + +@NonCPS +static def sourcesPatternCsv() { + return '**/maven-failsafe-plugin/src/main/java,' + + '**/maven-surefire-common/src/main/java,' + + '**/maven-surefire-plugin/src/main/java,' + + '**/maven-surefire-report-plugin/src/main/java,' + + '**/surefire-api/src/main/java,' + + '**/surefire-booter/src/main/java,' + + '**/surefire-grouper/src/main/java,' + + '**/surefire-its/src/main/java,' + + '**/surefire-logger-api/src/main/java,' + + '**/surefire-providers/**/src/main/java,' + + '**/surefire-report-parser/src/main/java' +} + +@NonCPS +static def classPatternCsv() { + return '**/maven-failsafe-plugin/target/classes,' + + '**/maven-surefire-common/target/classes,' + + '**/maven-surefire-plugin/target/classes,' + + '**/maven-surefire-report-plugin/target/classes,' + + '**/surefire-api/target/classes,' + + '**/surefire-booter/target/classes,' + + '**/surefire-grouper/target/classes,' + + '**/surefire-its/target/classes,' + + '**/surefire-logger-api/target/classes,' + + '**/surefire-providers/**/target/classes,' + + '**/surefire-report-parser/target/classes' +} + +@NonCPS +static def tasksViolationLow() { + return '@SuppressWarnings' +} + +@NonCPS +static def tasksViolationNormal() { + return 'TODO,FIXME,@deprecated' +} + +@NonCPS +static def tasksViolationHigh() { + return 'finalize(),Locale.setDefault,TimeZone.setDefault,\ +System.out,System.err,System.setOut,System.setErr,System.setIn,System.exit,System.gc,System.runFinalization,System.load' +} + +@NonCPS +static def testReportsPatternCsv() { + return '**/maven-failsafe-plugin/target/surefire-reports/*.xml,' + + '**/maven-surefire-common/target/surefire-reports/*.xml,' + + '**/maven-surefire-plugin/target/surefire-reports/*.xml,' + + '**/maven-surefire-report-plugin/target/surefire-reports/*.xml,' + + '**/surefire-api/target/surefire-reports/*.xml,' + + '**/surefire-booter/target/surefire-reports/*.xml,' + + '**/surefire-grouper/target/surefire-reports/*.xml,' + + '**/surefire-its/target/surefire-reports/*.xml,' + + '**/surefire-logger-api/target/surefire-reports/*.xml,' + + '**/surefire-providers/**/target/surefire-reports/*.xml,' + + '**/surefire-report-parser/target/surefire-reports/*.xml,' + + '**/surefire-its/target/failsafe-reports/*.xml' +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/maven-failsafe-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml index 9e3d87b..7176456 100644 --- a/maven-failsafe-plugin/pom.xml +++ b/maven-failsafe-plugin/pom.xml @@ -57,6 +57,10 @@ <classifier>site-source</classifier> </dependency> <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> + </dependency> + <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> @@ -284,6 +288,7 @@ <goals> <goal>clean</goal> <goal>verify</goal> + <goal>-nsu</goal> </goals> <setupIncludes> <setupInclude>dummy-*/pom.xml</setupInclude> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/maven-surefire-common/pom.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml index 7e063c8..e6ef88a 100644 --- a/maven-surefire-common/pom.xml +++ b/maven-surefire-common/pom.xml @@ -171,8 +171,6 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <jvm>${jdk.home}/bin/java</jvm> - <redirectTestOutputToFile>true</redirectTestOutputToFile> <includes> <include>**/JUnit4SuiteTest.java</include> </includes> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/maven-surefire-report-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index 9cdd569..662db98 100644 --- a/maven-surefire-report-plugin/pom.xml +++ b/maven-surefire-report-plugin/pom.xml @@ -168,6 +168,7 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> + <useSystemClassLoader>true</useSystemClassLoader> <classpathDependencyExcludes> <classpathDependencyExclude>org.fusesource.jansi:jansi</classpathDependencyExclude> </classpathDependencyExcludes> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index f5af360..4a768a5 100644 --- a/pom.xml +++ b/pom.xml @@ -50,8 +50,8 @@ <modules> <module>surefire-logger-api</module> - <module>surefire-shadefire</module> <module>surefire-api</module> + <module>surefire-shadefire</module> <module>surefire-booter</module> <module>surefire-grouper</module> <module>surefire-providers</module> @@ -99,6 +99,7 @@ <jdk.home>${java.home}/..</jdk.home> <maven.compiler.testSource>1.7</maven.compiler.testSource> <maven.compiler.testTarget>1.7</maven.compiler.testTarget> + <jvm.args.tests>-server -XX:+UseG1GC -Xms128m -Xmx144m -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:SoftRefLRUPolicyMSPerMB=50 -Djava.awt.headless=true</jvm.args.tests> </properties> <dependencyManagement> @@ -433,8 +434,10 @@ <configuration> <!-- NOTE: Be sure to isolate the Surefire version under test from the version running the tests! --> <useSystemClassLoader>false</useSystemClassLoader> - <argLine>-Xms128m -Xmx144m ${jacoco.agent}</argLine> + <argLine>${jvm.args.tests} ${jacoco.agent}</argLine> <useFile>false</useFile> + <redirectTestOutputToFile>false</redirectTestOutputToFile> + <jvm>${jdk.home}/bin/java</jvm> </configuration> </plugin> <plugin> @@ -470,6 +473,10 @@ <artifactId>maven-site-plugin</artifactId> <version>3.4</version> </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.2</version> + </plugin> </plugins> </pluginManagement> <plugins> @@ -546,50 +553,60 @@ </excludes> </enforceBytecodeVersion> </rules> - <fail>true</fail> </configuration> </execution> </executions> + <configuration> + <fail>true</fail> + </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> </plugin> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <version>0.12</version> - <executions> - <execution> - <id>rat-check</id> - <goals> - <goal>check</goal> - </goals> - <configuration> - <excludes combine.children="append"> - <exclude>Jenkinsfile</exclude> - <exclude>README.md</exclude> - <exclude>.gitignore</exclude> - <exclude>.git/**/*</exclude> - <exclude>**/.idea</exclude> - <exclude>**/.svn/**/*</exclude> - <exclude>**/*.iml</exclude> - <exclude>**/*.ipr</exclude> - <exclude>**/*.iws</exclude> - <exclude>**/*.versionsBackup</exclude> - <exclude>**/dependency-reduced-pom.xml</exclude> - <exclude>.repository/**</exclude> <!-- jenkins with local maven repository --> - <exclude>src/test/resources/**/*</exclude> - <exclude>src/test/resources/**/*.css</exclude> - <exclude>**/*.jj</exclude> - <exclude>src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider - </exclude> - <exclude>DEPENDENCIES</exclude> - </excludes> - </configuration> - </execution> - </executions> - </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <version>0.12</version> + <executions> + <execution> + <id>rat-check</id> + <goals> + <goal>check</goal> + </goals> + <configuration> + <excludes combine.children="append"> + <exclude>Jenkinsfile</exclude> + <exclude>README.md</exclude> + <exclude>.gitignore</exclude> + <exclude>.git/**/*</exclude> + <exclude>**/.idea</exclude> + <exclude>**/.svn/**/*</exclude> + <exclude>**/*.iml</exclude> + <exclude>**/*.ipr</exclude> + <exclude>**/*.iws</exclude> + <exclude>**/*.versionsBackup</exclude> + <exclude>**/dependency-reduced-pom.xml</exclude> + <exclude>.repository/**</exclude> <!-- jenkins with local maven repository --> + <exclude>src/test/resources/**/*</exclude> + <exclude>src/test/resources/**/*.css</exclude> + <exclude>**/*.jj</exclude> + <exclude>src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider + </exclude> + <exclude>DEPENDENCIES</exclude> + <exclude>.m2/**</exclude> + <exclude>.m2</exclude> + </excludes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <deployAtEnd>true</deployAtEnd> + </configuration> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-api/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-api/pom.xml b/surefire-api/pom.xml index 00ef758..bfc4203 100644 --- a/surefire-api/pom.xml +++ b/surefire-api/pom.xml @@ -52,8 +52,6 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <jvm>${jdk.home}/bin/java</jvm> - <redirectTestOutputToFile>true</redirectTestOutputToFile> <includes> <include>**/JUnit4SuiteTest.java</include> </includes> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-booter/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml index ef5e26c..a69b38b 100644 --- a/surefire-booter/pom.xml +++ b/surefire-booter/pom.xml @@ -116,8 +116,6 @@ </dependency> </dependencies> <configuration> - <jvm>${jdk.home}/bin/java</jvm> - <redirectTestOutputToFile>true</redirectTestOutputToFile> <includes> <include>**/JUnit4SuiteTest.java</include> </includes> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index e679753..a14c6c6 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -27,7 +27,7 @@ <version>2.21.0-SNAPSHOT</version> </parent> - <artifactId>surefire-is</artifactId> + <artifactId>surefire-its</artifactId> <name>Maven Surefire Integration Tests</name> <description>Used internally testing MOJOs. The project is not deployed.</description> @@ -84,8 +84,17 @@ <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-shadefire</artifactId> + <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> + </dependency> + </dependencies> <configuration> - <test>*Test</test> + <includes> + <include>org/apache/maven/surefire/its/fixture/JUnit4SuiteTest.java</include> + </includes> </configuration> </plugin> <plugin> @@ -99,7 +108,7 @@ <forkMode>once</forkMode> <argLine>-server -Xmx64m -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Djava.awt.headless=true</argLine> <includes> - <include>org/apache/**/*IT*.java</include> + <include>org/apache/**/UmlautDirIT.java</include> </includes> <!-- Pass current surefire version to the main suite so that it --> <!-- can forward to all integration test projects. SUREFIRE-513 --> @@ -120,7 +129,6 @@ <jacoco.agent>${jacoco-it.agent}</jacoco.agent> </systemPropertyVariables> <redirectTestOutputToFile>false</redirectTestOutputToFile> - <useFile>false</useFile> </configuration> <dependencies> <dependency> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java index 5aee1a8..fdf75ef 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java @@ -524,7 +524,7 @@ public class JUnit47ParallelIT @Test public void forcedShutdownVerifyingLogs() { - // executes for 2.5 sec until timeout has elapsed + // attempts to run for 2.4 sec until timeout has elapsed unpack().parallelMethods().threadCountMethods( 3 ).disablePerCoreThreadCount() .parallelTestsTimeoutForcedInSeconds( 1.05d ).setTestToRun( "Waiting*Test" ).failNever().executeTest() .verifyTextInLog( "The test run has finished abruptly after timeout of 1.05 seconds." ) @@ -535,6 +535,8 @@ public class JUnit47ParallelIT private SurefireLauncher unpack() { return unpack( "junit47-parallel" ) - .showErrorStackTraces(); + .showErrorStackTraces() + .forkOnce() + .redirectToFile( false ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java index 8848dc2..7b008bc 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java @@ -40,25 +40,30 @@ public class UmlautDirIT public void testUmlaut() throws Exception { - specialUnpack().executeTest().verifyErrorFreeLog().assertTestSuiteResults( 1, 0, 0, 0 ); + specialUnpack( "1" ) + .executeTest() + .verifyErrorFreeLog() + .assertTestSuiteResults( 1, 0, 0, 0 ); } @Test public void testUmlautIsolatedClassLoader() throws Exception { - specialUnpack().useSystemClassLoader( false ).executeTest().assertTestSuiteResults( 1, 0, 0, 0 ); + specialUnpack( "2" ) + .useSystemClassLoader( false ) + .executeTest() + .assertTestSuiteResults( 1, 0, 0, 0 ); } - SurefireLauncher specialUnpack() - throws VerificationException, IOException + SurefireLauncher specialUnpack( String postfix ) + throws IOException { SurefireLauncher unpack = unpack( "junit-pathWithUmlaut" ); MavenLauncher maven = unpack.maven(); - File dest = new File( maven.getUnpackedAt().getParentFile().getPath(), "/junit-pathWith\u00DCmlaut" ); + File dest = new File( maven.getUnpackedAt().getParentFile().getPath(), "/junit-pathWith\u00DCmlaut_" + postfix ); maven.moveUnpackTo( dest ); return unpack; } - } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/JUnit4SuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/JUnit4SuiteTest.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/JUnit4SuiteTest.java new file mode 100644 index 0000000..3961b13 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/JUnit4SuiteTest.java @@ -0,0 +1,44 @@ +package org.apache.maven.surefire.its.fixture; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite. + * + * @author Tibor Digana (tibor17) + * @since 2.21.0 + */ +@Suite.SuiteClasses( { + MavenLauncherTest.class, + SurefireLauncherTest.class +} ) +@RunWith( Suite.class ) +public class JUnit4SuiteTest +{ + public static Test suite() + { + return new JUnit4TestAdapter( JUnit4SuiteTest.class ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java index b5df941..801ebec 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java @@ -19,9 +19,6 @@ package org.apache.maven.surefire.its.fixture; * under the License. */ -import java.io.IOException; -import org.apache.maven.it.VerificationException; - import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -33,7 +30,6 @@ public class SurefireLauncherTest { @Test public void launcherGetsProperMethodName() - throws IOException, VerificationException { MavenLauncher mavenLauncher = new MavenLauncher( SurefireLauncherTest.class, "foo", "" ); String method = new SurefireLauncher( mavenLauncher ).getTestMethodName(); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java index 3ca758a..ab9469f 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java @@ -19,21 +19,23 @@ package org.apache.maven.surefire.its.jiras; * under the License. */ -import org.apache.maven.it.VerificationException; import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Before; -import org.junit.Test; +import org.junit.experimental.theories.DataPoints; +import org.junit.experimental.theories.FromDataPoints; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; import java.util.Iterator; -import java.util.concurrent.TimeUnit; +import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX; import static org.apache.commons.lang3.SystemUtils.IS_OS_MAC_OSX; +import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS; import static org.fest.assertions.Assertions.assertThat; import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; /** * https://issues.apache.org/jira/browse/SUREFIRE-1295 @@ -42,67 +44,72 @@ import static org.junit.Assume.assumeTrue; * @author michaeltandy * @since 2.20 */ +@RunWith( Theories.class ) public class Surefire1295AttributeJvmCrashesToTestsIT extends SurefireJUnit4IntegrationTestCase { - @Before - public void skipWindows() + public enum ForkMode { - assumeTrue( IS_OS_LINUX || IS_OS_MAC_OSX ); + DEFAULT, + ONE_FORK_NO_REUSE, + ONE_FORK_REUSE } - @Test - public void crashInFork() throws VerificationException, InterruptedException - { - SurefireLauncher launcher = unpack( "crash-during-test" ); + @DataPoints( "crashStyle" ) + public static String[] crashStyle = { "exit", "abort", "segfault" }; - checkCrashTypes( launcher ); - } + @DataPoints( "forkStyle" ) + public static ForkMode[] forkStyle = ForkMode.values(); - @Test - public void crashInSingleUseFork() throws VerificationException, InterruptedException + @Theory + public void test( @FromDataPoints( "crashStyle" ) String crashStyle, + @FromDataPoints( "forkStyle" ) ForkMode forkStyle ) + throws Exception { - SurefireLauncher launcher = unpack( "crash-during-test" ) - .forkCount( 1 ) - .reuseForks( false ); - - checkCrashTypes( launcher ); - } + // JUnit Assumptions not supported by Theories runner. + if ( !IS_OS_LINUX && !IS_OS_MAC_OSX && !IS_OS_WINDOWS ) + { + return; + } - @Test - public void crashInReusableFork() throws VerificationException, InterruptedException - { - SurefireLauncher launcher = unpack( "crash-during-test" ) - .forkPerThread() - .reuseForks( true ) - .threadCount( 1 ); + SurefireLauncher launcher = + unpack( "crash-during-test", "_" + crashStyle + "_" + forkStyle.ordinal() ) + .setForkJvm(); - checkCrashTypes( launcher ); - } + switch ( forkStyle ) + { + case DEFAULT: + break; + case ONE_FORK_NO_REUSE: + launcher.forkCount( 1 ) + .reuseForks( false ); + break; + case ONE_FORK_REUSE: + launcher.forkPerThread() + .reuseForks( true ) + .threadCount( 1 ); + break; + default: + fail(); + } - private static void checkCrashTypes( SurefireLauncher launcher ) - throws VerificationException, InterruptedException - { - checkCrash( launcher.addGoal( "-DcrashType=exit" ) ); - checkCrash( launcher.addGoal( "-DcrashType=abort" ) ); - checkCrash( launcher.addGoal( "-DcrashType=segfault" ) ); + checkCrash( launcher.addGoal( "-DcrashType=" + crashStyle ) ); } - private static void checkCrash( SurefireLauncher launcher ) throws VerificationException, InterruptedException + private static void checkCrash( SurefireLauncher launcher ) throws Exception { OutputValidator validator = launcher.maven() - .withFailure() - .executeTest() - .verifyTextInLog( "The forked VM terminated without properly saying " - + "goodbye. VM crash or System.exit called?" - ) - .verifyTextInLog( "Crashed tests:" ); + .withFailure() + .executeTest() + .verifyTextInLog( "The forked VM terminated without properly saying " + + "goodbye. VM crash or System.exit called?" ) + .verifyTextInLog( "Crashed tests:" ); // Cannot flush log.txt stream because it is consumed internally by Verifier. // Waiting for the stream to become flushed on disk. - TimeUnit.SECONDS.sleep( 1L ); + SECONDS.sleep( 1L ); - for ( Iterator<String> it = validator.loadLogLines().iterator(); it.hasNext(); ) + for ( Iterator< String > it = validator.loadLogLines().iterator(); it.hasNext(); ) { String line = it.next(); if ( line.contains( "Crashed tests:" ) ) @@ -110,7 +117,8 @@ public class Surefire1295AttributeJvmCrashesToTestsIT line = it.next(); if ( it.hasNext() ) { - assertThat( line ).contains( "junit44.environment.BasicTest" ); + assertThat( line ) + .contains( "junit44.environment.Test1CrashedTest" ); } else { @@ -118,8 +126,5 @@ public class Surefire1295AttributeJvmCrashesToTestsIT } } } - } - - } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/pom.xml b/surefire-its/src/test/resources/crash-during-test/pom.xml index 0d9e3e7..3929e83 100644 --- a/surefire-its/src/test/resources/crash-during-test/pom.xml +++ b/surefire-its/src/test/resources/crash-during-test/pom.xml @@ -51,12 +51,25 @@ </dependencies> <build> + <pluginManagement> + <plugins> + <!-- + mvn clean is called beforehand. + The German word Umlaut which is not ASCII must be deleted the same on all M3 versions. + --> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + </plugin> + </plugins> + </pluginManagement> <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>${surefire.version}</version> <configuration> <forkMode>once</forkMode> + <runOrder>alphabetical</runOrder> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java deleted file mode 100644 index 57d57bb..0000000 --- a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package junit44.environment; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import static org.junit.Assert.*; -import org.junit.Test; -import uk.me.mjt.CrashJvm; - -public class BasicTest -{ - @Test - public void testCrashJvm() - { - assertTrue(CrashJvm.loadedOk()); - - String crashType = System.getProperty("crashType"); - assertNotNull(crashType); - if ( crashType.equals( "exit" ) ) - { - CrashJvm.exit(); - } - else if ( crashType.equals( "abort" ) ) - { - CrashJvm.abort(); - } - else if (crashType.equals( "segfault" )) - { - CrashJvm.segfault(); - } - else - { - fail("Don't recognise crashType " + crashType); - } - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java deleted file mode 100644 index e10f6aa..0000000 --- a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java +++ /dev/null @@ -1,28 +0,0 @@ - -package junit44.environment; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.junit.Test; - -public class SomeOtherTest { - @Test - public void nonCrashingTest() {} -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test1CrashedTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test1CrashedTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test1CrashedTest.java new file mode 100644 index 0000000..28fe637 --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test1CrashedTest.java @@ -0,0 +1,52 @@ +package junit44.environment; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.*; +import org.junit.Test; +import uk.me.mjt.CrashJvm; + +public class Test1CrashedTest +{ + @Test + public void testCrashJvm() + { + assertTrue(CrashJvm.loadedOk()); + + String crashType = System.getProperty("crashType"); + assertNotNull(crashType); + if ( crashType.equals( "exit" ) ) + { + CrashJvm.exit(); + } + else if ( crashType.equals( "abort" ) ) + { + CrashJvm.abort(); + } + else if (crashType.equals( "segfault" )) + { + CrashJvm.segfault(); + } + else + { + fail("Don't recognise crashType " + crashType); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test2WaitingTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test2WaitingTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test2WaitingTest.java new file mode 100644 index 0000000..dc3ce47 --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test2WaitingTest.java @@ -0,0 +1,34 @@ +package junit44.environment; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; + +public class Test2WaitingTest +{ + @Test + public void nonCrashingTest() + throws InterruptedException + { + MILLISECONDS.sleep( 1500L ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test3FastTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test3FastTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test3FastTest.java new file mode 100644 index 0000000..3a4d88e --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/Test3FastTest.java @@ -0,0 +1,30 @@ +package junit44.environment; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +public class Test3FastTest +{ + @Test + public void emptyTest() + { + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-providers/pom.xml b/surefire-providers/pom.xml index 65ae76f..de5214a 100644 --- a/surefire-providers/pom.xml +++ b/surefire-providers/pom.xml @@ -56,7 +56,6 @@ <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/surefire-junit3/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit3/pom.xml b/surefire-providers/surefire-junit3/pom.xml index 2e906da..93375b2 100644 --- a/surefire-providers/surefire-junit3/pom.xml +++ b/surefire-providers/surefire-junit3/pom.xml @@ -72,7 +72,6 @@ </execution> </executions> </plugin> - </plugins> </build> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/surefire-junit4/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit4/pom.xml b/surefire-providers/surefire-junit4/pom.xml index 870f13c..fe1496f 100644 --- a/surefire-providers/surefire-junit4/pom.xml +++ b/surefire-providers/surefire-junit4/pom.xml @@ -55,12 +55,6 @@ <plugins> <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <jvm>${java.home}/bin/java</jvm> - </configuration> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.4</version> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputer.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputer.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputer.java index a198887..2e4104c 100644 --- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputer.java +++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputer.java @@ -67,7 +67,7 @@ public abstract class ParallelComputer protected abstract ShutdownResult describeStopped( boolean shutdownNow ); - abstract boolean shutdownThreadPoolsAwaitingKilled(); + protected abstract boolean shutdownThreadPoolsAwaitingKilled(); protected final void beforeRunQuietly() { @@ -249,19 +249,23 @@ public abstract class ParallelComputer { if ( testsBeforeShutdown != null ) { - for ( final Description test : testsBeforeShutdown.get().getTriggeredTests() ) + final ShutdownResult shutdownResult = testsBeforeShutdown.get(); + if ( shutdownResult != null ) { - if ( test != null && test.getDisplayName() != null ) + for ( final Description test : shutdownResult.getTriggeredTests() ) { - executedTests.add( test.getDisplayName() ); + if ( test != null && test.getDisplayName() != null ) + { + executedTests.add( test.getDisplayName() ); + } } - } - for ( final Description test : testsBeforeShutdown.get().getIncompleteTests() ) - { - if ( test != null && test.getDisplayName() != null ) + for ( final Description test : shutdownResult.getIncompleteTests() ) { - incompleteTests.add( test.getDisplayName() ); + if ( test != null && test.getDisplayName() != null ) + { + incompleteTests.add( test.getDisplayName() ); + } } } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java index fd0cab3..22d7eab 100755 --- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java +++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java @@ -333,7 +333,7 @@ public final class ParallelComputerBuilder } @Override - boolean shutdownThreadPoolsAwaitingKilled() + protected boolean shutdownThreadPoolsAwaitingKilled() { boolean notInterrupted = notThreadSafeTests.shutdownThreadPoolsAwaitingKilled(); final Scheduler m = master; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ea893232/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java index 212e157..b90da87 100755 --- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java +++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilderTest.java @@ -26,9 +26,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.Stopwatch; import org.junit.runner.Description; import org.junit.runner.JUnitCore; import org.junit.runner.Result; @@ -54,7 +52,6 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.apache.maven.surefire.junitcore.pc.RangeMatcher.between; import static org.junit.Assert.*; -import static java.util.concurrent.TimeUnit.MILLISECONDS; /** * @author Tibor Digana (tibor17) @@ -70,9 +67,6 @@ public class ParallelComputerBuilderTest private static final ConsoleStream logger = new DefaultDirectConsoleReporter( System.out ); - @Rule - public final Stopwatch stopwatch = new Stopwatch() {}; - private static void testKeepBeforeAfter( ParallelComputerBuilder builder, Class<?>... classes ) { JUnitCore core = new JUnitCore(); @@ -94,8 +88,16 @@ public class ParallelComputerBuilderTest } } + @BeforeClass + public static void cleanup() throws InterruptedException + { + System.gc(); + Thread.sleep( 500L ); + } + @Before - public void beforeTest() throws InterruptedException { + public void beforeTest() + { Class1.maxConcurrentMethods = 0; Class1.concurrentMethods = 0; shutdownTask = null; @@ -104,8 +106,6 @@ public class ParallelComputerBuilderTest NotThreadSafeTest3.t = null; NormalTest1.t = null; NormalTest2.t = null; - System.gc(); - Thread.sleep( 50L ); } @Test @@ -136,8 +136,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 0 ) ); @@ -171,8 +174,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class, Class1.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class, Class1.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 1 ) ); @@ -197,8 +203,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class, Class1.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class, Class1.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 1 ) ); @@ -229,8 +238,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 0 ) ); @@ -253,8 +265,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 0 ) ); @@ -280,8 +295,11 @@ public class ParallelComputerBuilderTest // 2 groups with 3 threads. // Each group takes 0.5s. ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class, Class1.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class, Class1.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 1 ) ); @@ -304,8 +322,11 @@ public class ParallelComputerBuilderTest assertFalse( parallelComputerBuilder.isOptimized() ); ParallelComputerBuilder.PC computer = (ParallelComputerBuilder.PC) parallelComputerBuilder.buildComputer(); - Result result = new JUnitCore().run( computer, TestSuite.class, Class1.class ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final JUnitCore core = new JUnitCore(); + final long t1 = System.currentTimeMillis(); + final Result result = core.run( computer, TestSuite.class, Class1.class ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertThat( computer.getSuites().size(), is( 1 ) ); assertThat( computer.getClasses().size(), is( 1 ) ); @@ -321,8 +342,10 @@ public class ParallelComputerBuilderTest @Test( timeout = 2000 ) public void shutdown() { - Result result = new ShutdownTest().run( false ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final long t1 = System.currentTimeMillis(); + final Result result = new ShutdownTest().run( false ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertTrue( result.wasSuccessful() ); assertTrue( beforeShutdown ); assertThat( timeSpent, between( 450, 1250 ) ); @@ -331,8 +354,10 @@ public class ParallelComputerBuilderTest @Test( timeout = 2000 ) public void shutdownWithInterrupt() { + final long t1 = System.currentTimeMillis(); new ShutdownTest().run( true ); - long timeSpent = stopwatch.runtime( MILLISECONDS ); + final long t2 = System.currentTimeMillis(); + final long timeSpent = t2 - t1; assertTrue( beforeShutdown ); assertThat( timeSpent, between( 450, 1250 ) ); } @@ -717,11 +742,12 @@ public class ParallelComputerBuilderTest public static class ReportOneTestAtRuntimeRunner extends ParentRunner { - private final Class testClass; + private final Class<?> testClass; private final Description suiteDescription; private Description myTestMethodDescr; - public ReportOneTestAtRuntimeRunner( Class testClass ) throws InitializationError + @SuppressWarnings( "unchecked" ) + public ReportOneTestAtRuntimeRunner( Class<?> testClass ) throws InitializationError { super( Object.class ); this.testClass = testClass;