Update to upstream version 3.2.2

This commit is contained in:
Marian Koncek 2023-12-13 13:21:22 +01:00
parent 04918a32cb
commit 7375d46203
6 changed files with 87 additions and 160 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@
/maven-surefire-3.0.0-M4.tar.gz
/maven-surefire-3.0.0~M4.tar.gz
/maven-surefire-3.0.0~M6.tar.gz
/maven-surefire-3.2.2.tar.gz

View File

@ -10,10 +10,10 @@ Subject: [PATCH 1/4] Port to TestNG 7.4.0
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml
index ece647d6a..682f296e6 100644
index 5cf9b2e..d23b123 100644
--- a/surefire-providers/surefire-testng/pom.xml
+++ b/surefire-providers/surefire-testng/pom.xml
@@ -51,8 +51,7 @@
@@ -54,8 +54,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@ -24,10 +24,10 @@ index ece647d6a..682f296e6 100644
</dependency>
<dependency>
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
index ed918f538..c4a0cd19d 100644
index b73b9ba..ab187b6 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
@@ -63,7 +63,7 @@ public void configure( TestNG testng, Map<String, String> options )
@@ -57,7 +57,7 @@ public void configure(TestNG testng, Map<String, String> options) throws TestSet
testng.setUseDefaultListeners(false);
configureInstance(testng, options);
// TODO: we should have the Profile so that we can decide if this is needed or not
@ -37,18 +37,18 @@ index ed918f538..c4a0cd19d 100644
@Override
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
index 6caf82459..2d988381f 100755
index d91e76a..06dbd23 100755
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
@@ -68,7 +68,7 @@ public void configure( XmlSuite suite, Map<String, String> options )
@@ -71,7 +71,7 @@ protected void configureThreadCount(XmlSuite suite, Map<String, String> options)
protected void configureParallel(XmlSuite suite, Map<String, String> options) throws TestSetFailedException {
String parallel = options.get(PARALLEL_PROP);
if ( parallel != null )
{
if (parallel != null) {
- suite.setParallel(parallel);
+ suite.setParallel(XmlSuite.ParallelMode.getValidParallel(parallel));
}
}
--
2.35.1
2.43.0

View File

@ -4,15 +4,15 @@ Date: Mon, 27 Apr 2020 10:45:30 +0200
Subject: [PATCH 2/4] Disable JUnit 4.8 test grouping
---
.../surefire/junitcore/JUnitCoreProvider.java | 25 +++--------------
.../maven/surefire/testng/TestNGExecutor.java | 27 -------------------
2 files changed, 3 insertions(+), 49 deletions(-)
.../surefire/junitcore/JUnitCoreProvider.java | 21 +++------------
.../maven/surefire/testng/TestNGExecutor.java | 27 +------------------
2 files changed, 4 insertions(+), 44 deletions(-)
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 7ed483426..1ffd826db 100644
index f2f58fe..c09c51e 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -40,7 +40,6 @@
@@ -39,7 +39,6 @@
import org.apache.maven.surefire.common.junit4.JUnit4RunListener;
import org.apache.maven.surefire.common.junit4.JUnitTestFailureListener;
import org.apache.maven.surefire.common.junit4.Notifier;
@ -20,7 +20,7 @@ index 7ed483426..1ffd826db 100644
import org.apache.maven.surefire.common.junit48.JUnit48Reflector;
import org.apache.maven.surefire.common.junit48.JUnit48TestChecker;
import org.junit.runner.Description;
@@ -51,6 +50,7 @@
@@ -50,6 +49,7 @@
import static org.apache.maven.surefire.api.report.RunMode.RERUN_TEST_AFTER_FAILURE;
import static org.apache.maven.surefire.api.testset.TestListResolver.optionallyWildcardFilter;
import static org.apache.maven.surefire.api.util.TestsToRun.fromClass;
@ -28,17 +28,17 @@ index 7ed483426..1ffd826db 100644
import static org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.generateFailingTestDescriptions;
import static org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory.createCustomListeners;
import static org.apache.maven.surefire.common.junit4.Notifier.pureNotifier;
@@ -126,7 +126,7 @@ public RunResult invoke( Object forkTestSet )
@@ -118,7 +118,7 @@ public RunResult invoke(Object forkTestSet) throws TestSetFailedException {
Notifier notifier = new Notifier(listener, getSkipAfterFailureCount());
// startCapture() called in createRunListener() in prior to setTestsToRun()
- Filter filter = jUnit48Reflector.isJUnit48Available() ? createJUnit48Filter() : null;
+ Filter filter = null;
if ( testsToRun == null )
{
@@ -169,8 +169,7 @@ public RunResult invoke( Object forkTestSet )
{
if (testsToRun == null) {
setTestsToRun(forkTestSet);
@@ -158,8 +158,7 @@ public RunResult invoke(Object forkTestSet) throws TestSetFailedException {
i++) {
Set<Description> failures = generateFailingTestDescriptions(testFailureListener.getAllFailures());
testFailureListener.reset();
- FilterFactory filterFactory = new FilterFactory(testClassLoader);
@ -47,59 +47,51 @@ index 7ed483426..1ffd826db 100644
rerunCore.execute(testsToRun, failureDescriptionFilter);
}
}
@@ -271,24 +270,6 @@ private boolean isParallelTypes()
@@ -236,20 +235,6 @@ private boolean isParallelTypes() {
return jUnitCoreParameters.isParallelClasses() || jUnitCoreParameters.isParallelSuites();
}
- private Filter createJUnit48Filter()
- {
- private Filter createJUnit48Filter() {
- final FilterFactory factory = new FilterFactory(testClassLoader);
- Map<String, String> props = providerParameters.getProviderProperties();
- Filter groupFilter = factory.canCreateGroupFilter(props) ? factory.createGroupFilter(props) : null;
- TestListResolver methodFilter = optionallyWildcardFilter(testResolver);
- boolean onlyGroups = methodFilter.isEmpty() || methodFilter.isWildcard();
- if ( onlyGroups )
- {
- if (onlyGroups) {
- return groupFilter;
- }
- else
- {
- } else {
- Filter jUnitMethodFilter = factory.createMethodFilter(methodFilter);
- return groupFilter == null ? jUnitMethodFilter : factory.and(groupFilter, jUnitMethodFilter);
- }
- }
-
private TestsToRun scanClassPath()
{
private TestsToRun scanClassPath() {
TestsToRun scanned = scanResult.applyFilter(scannerFilter, testClassLoader);
return runOrderCalculator.orderTestClasses(scanned);
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
index 7ed1719a8..07d3ad33c 100644
index 020212f..299b6bf 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
@@ -278,36 +278,9 @@ private static XmlMethodSelector createMethodNameFilteringSelector( TestListReso
@@ -258,32 +258,7 @@ private static XmlMethodSelector createMethodNameFilteringSelector(TestListResol
@SuppressWarnings("checkstyle:magicnumber")
private static XmlMethodSelector createGroupMatchingSelector(Map<String, String> options)
throws TestSetFailedException
{
throws TestSetFailedException {
- final String groups = options.get(ProviderParameterNames.TESTNG_GROUPS_PROP);
- final String excludedGroups = options.get(ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP);
-
- if ( groups == null && excludedGroups == null )
{
return null;
}
- if (groups == null && excludedGroups == null) {
- return null;
- }
-
- // the class is available in the testClassPath
- final String clazzName = "org.apache.maven.surefire.testng.utils.GroupMatcherMethodSelector";
- try
- {
- try {
- Class<?> clazz = Class.forName(clazzName);
-
- // HORRIBLE hack, but TNG doesn't allow us to setup a method selector instance directly.
- Method method = clazz.getMethod("setGroups", String.class, String.class);
- method.invoke(null, groups, excludedGroups);
- }
- catch ( Exception e )
- {
- } catch (Exception e) {
- throw new TestSetFailedException(e.getMessage(), e);
- }
-
@ -110,9 +102,10 @@ index 7ed1719a8..07d3ad33c 100644
- xms.setPriority(9999);
-
- return xms;
+ return null;
}
static void run( List<String> suiteFiles, String testSourceDirectory,
static void run(
--
2.35.1
2.43.0

View File

@ -1,70 +0,0 @@
From 56f22fd719fe464c8a080e710de847983bb65ac1 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 22 Apr 2022 00:28:31 +0200
Subject: [PATCH 3/4] Port to JUnit 5.8.1
---
pom.xml | 6 +++---
.../maven/surefire/junitplatform/LazyLauncher.java | 14 ++++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index c261bf3c2..a75e156ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,17 +250,17 @@
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
- <version>1.3.2</version>
+ <version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
- <version>5.3.2</version>
+ <version>5.8.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
- <version>5.3.2</version>
+ <version>5.8.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java
index 6a1a3b3b3..dee110e3c 100644
--- a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java
@@ -21,6 +21,7 @@
import org.apache.maven.surefire.api.util.ReflectionUtils;
import org.junit.platform.launcher.Launcher;
+import org.junit.platform.launcher.LauncherDiscoveryListener;
import org.junit.platform.launcher.LauncherDiscoveryRequest;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestPlan;
@@ -55,6 +56,19 @@ public void execute( LauncherDiscoveryRequest launcherDiscoveryRequest,
launcher().execute( launcherDiscoveryRequest, testExecutionListeners );
}
+ @Override
+ public void execute( TestPlan testPlan,
+ TestExecutionListener... testExecutionListeners )
+ {
+ launcher().execute( testPlan, testExecutionListeners );
+ }
+
+ @Override
+ public void registerLauncherDiscoveryListeners( LauncherDiscoveryListener... launcherDiscoveryListeners )
+ {
+ launcher().registerLauncherDiscoveryListeners( launcherDiscoveryListeners );
+ }
+
private Launcher launcher()
{
if ( launcher == null )
--
2.35.1

View File

@ -1,8 +1,8 @@
%bcond_with bootstrap
Name: maven-surefire
Version: 3.0.0~M6
Release: 7%{?dist}
Version: 3.2.2
Release: 1%{?dist}
Summary: Test framework project
License: Apache-2.0 AND CPL-1.0
URL: https://maven.apache.org/surefire/
@ -19,7 +19,6 @@ Source2: https://junit.sourceforge.net/cpl-v10.html
Patch1: 0001-Port-to-TestNG-7.4.0.patch
Patch2: 0002-Disable-JUnit-4.8-test-grouping.patch
Patch3: 0003-Port-to-JUnit-5.8.1.patch
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
@ -40,13 +39,14 @@ BuildRequires: mvn(org.apache.maven:maven-parent:pom:)
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata)
BuildRequires: mvn(org.codehaus.plexus:plexus-java)
BuildRequires: mvn(org.eclipse.aether:aether-util)
BuildRequires: mvn(org.eclipse.sisu:sisu-maven-plugin)
BuildRequires: mvn(org.fusesource.jansi:jansi)
BuildRequires: mvn(org.junit.platform:junit-platform-launcher)
BuildRequires: mvn(org.testng:testng)
BuildRequires: mvn(org.testng:testng::jdk15:)
%endif
# PpidChecker relies on /usr/bin/ps to check process uptime
Requires: procps-ng
@ -112,7 +112,6 @@ cp -p %{SOURCE2} .
%patch 1 -p1
%patch 2 -p1
%patch3 -p1
# Disable strict doclint
sed -i /-Xdoclint:all/d pom.xml
@ -122,6 +121,7 @@ sed -i /-Xdoclint:all/d pom.xml
%pom_disable_module surefire-shadefire
%pom_disable_module surefire-grouper
%pom_remove_dep org.junit:junit-bom
%pom_remove_dep :surefire-grouper surefire-providers/common-junit48
%pom_remove_dep :surefire-grouper surefire-providers/surefire-testng-utils
rm surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/{FilterFactory,GroupMatcherCategoryFilter}.java
@ -173,6 +173,9 @@ find -name *.java -exec sed -i -e s/org.apache.maven.surefire.shared.utils/org.a
%license LICENSE NOTICE cpl-v10.html
%changelog
* Wed Dec 13 2023 Marian Koncek <mkoncek@redhat.com> - 3.2.2-1
- Update to upstream version 3.2.2
* Sat Sep 02 2023 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.0.0~M6-7
- Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (maven-surefire-3.0.0~M6.tar.gz) = 1258e113645e5e42a956ccad99f5ae44b362e8abc8dc5f17112b0fbae353a5e14b5b6fca4b6dab71d3d910a8b57d934dfcbfcdfb03304947f6043c0694aab231
SHA512 (maven-surefire-3.2.2.tar.gz) = 13db27b91d369b6d6858636192af39841d8111dbb784835a44c84056860214e9decf21c6099423716cba3b9d5acf488d7f6a37f0524195445ac8819a1c4d77ca
SHA512 (cpl-v10.html) = f7aa86fafb6a7831b1a5302099fbfe95361bcb5c49a2bc7aac0f5d53cea6c92fc3adbba897a54ab5b0cf32771cdc933fc5bb233461fbd48254a250d0d59109c9