From 7375d4620380bb5dc5b0db2524670bb5f45b34ae Mon Sep 17 00:00:00 2001 From: Marian Koncek Date: Wed, 13 Dec 2023 13:21:22 +0100 Subject: [PATCH] Update to upstream version 3.2.2 --- .gitignore | 1 + 0001-Port-to-TestNG-7.4.0.patch | 50 +++++----- 0002-Disable-JUnit-4.8-test-grouping.patch | 107 ++++++++++----------- 0003-Port-to-JUnit-5.8.1.patch | 70 -------------- maven-surefire.spec | 17 ++-- sources | 2 +- 6 files changed, 87 insertions(+), 160 deletions(-) delete mode 100644 0003-Port-to-JUnit-5.8.1.patch diff --git a/.gitignore b/.gitignore index 9023da9..491fcce 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/0001-Port-to-TestNG-7.4.0.patch b/0001-Port-to-TestNG-7.4.0.patch index bc1cebb..2be6842 100644 --- a/0001-Port-to-TestNG-7.4.0.patch +++ b/0001-Port-to-TestNG-7.4.0.patch @@ -10,45 +10,45 @@ 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 @@ - - org.testng - testng -- 5.10 -- jdk15 -+ 7.4.0 - provided - - +@@ -54,8 +54,7 @@ + + org.testng + testng +- 5.10 +- jdk15 ++ 7.4.0 + provided + + 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 options ) - testng.setUseDefaultListeners( false ); - configureInstance( testng, options ); +@@ -57,7 +57,7 @@ public void configure(TestNG testng, Map 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 -- testng.setListenerClasses( loadListenerClasses( listeners ) ); -+ testng.setListenerClasses( ( List ) loadListenerClasses( listeners ) ); +- testng.setListenerClasses(loadListenerClasses(listeners)); ++ testng.setListenerClasses((List)loadListenerClasses(listeners)); } @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 options ) - String parallel = options.get( PARALLEL_PROP ); - if ( parallel != null ) - { -- suite.setParallel( parallel ); -+ suite.setParallel( XmlSuite.ParallelMode.getValidParallel( parallel ) ); +@@ -71,7 +71,7 @@ protected void configureThreadCount(XmlSuite suite, Map options) + protected void configureParallel(XmlSuite suite, Map options) throws TestSetFailedException { + String parallel = options.get(PARALLEL_PROP); + if (parallel != null) { +- suite.setParallel(parallel); ++ suite.setParallel(XmlSuite.ParallelMode.getValidParallel(parallel)); } } -- -2.35.1 +2.43.0 diff --git a/0002-Disable-JUnit-4.8-test-grouping.patch b/0002-Disable-JUnit-4.8-test-grouping.patch index a1d6f70..61756c2 100644 --- a/0002-Disable-JUnit-4.8-test-grouping.patch +++ b/0002-Disable-JUnit-4.8-test-grouping.patch @@ -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,91 +28,84 @@ 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 ) - Notifier notifier = new Notifier( listener, getSkipAfterFailureCount() ); +@@ -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 ) - { - Set failures = generateFailingTestDescriptions( testFailureListener.getAllFailures() ); + if (testsToRun == null) { + setTestsToRun(forkTestSet); +@@ -158,8 +158,7 @@ public RunResult invoke(Object forkTestSet) throws TestSetFailedException { + i++) { + Set failures = generateFailingTestDescriptions(testFailureListener.getAllFailures()); testFailureListener.reset(); -- FilterFactory filterFactory = new FilterFactory( testClassLoader ); -- Filter failureDescriptionFilter = filterFactory.createMatchAnyDescriptionFilter( failures ); -+ Filter failureDescriptionFilter = createMatchAnyDescriptionFilter( failures ); - rerunCore.execute( testsToRun, failureDescriptionFilter ); +- FilterFactory filterFactory = new FilterFactory(testClassLoader); +- Filter failureDescriptionFilter = filterFactory.createMatchAnyDescriptionFilter(failures); ++ Filter failureDescriptionFilter = createMatchAnyDescriptionFilter(failures); + 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() -- { -- final FilterFactory factory = new FilterFactory( testClassLoader ); +- private Filter createJUnit48Filter() { +- final FilterFactory factory = new FilterFactory(testClassLoader); - Map props = providerParameters.getProviderProperties(); -- Filter groupFilter = factory.canCreateGroupFilter( props ) ? factory.createGroupFilter( props ) : null; -- TestListResolver methodFilter = optionallyWildcardFilter( testResolver ); +- 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 -- { -- Filter jUnitMethodFilter = factory.createMethodFilter( methodFilter ); -- return groupFilter == null ? jUnitMethodFilter : factory.and( groupFilter, jUnitMethodFilter ); +- } else { +- Filter jUnitMethodFilter = factory.createMethodFilter(methodFilter); +- return groupFilter == null ? jUnitMethodFilter : factory.and(groupFilter, jUnitMethodFilter); - } - } - - private TestsToRun scanClassPath() - { - TestsToRun scanned = scanResult.applyFilter( scannerFilter, testClassLoader ); + 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 - private static XmlMethodSelector createGroupMatchingSelector( Map options ) - throws TestSetFailedException - { -- final String groups = options.get( ProviderParameterNames.TESTNG_GROUPS_PROP ); -- final String excludedGroups = options.get( ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP ); +@@ -258,32 +258,7 @@ private static XmlMethodSelector createMethodNameFilteringSelector(TestListResol + @SuppressWarnings("checkstyle:magicnumber") + private static XmlMethodSelector createGroupMatchingSelector(Map options) + 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 -- { -- Class clazz = Class.forName( clazzName ); +- 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 ) -- { -- throw new TestSetFailedException( e.getMessage(), e ); +- Method method = clazz.getMethod("setGroups", String.class, String.class); +- method.invoke(null, groups, excludedGroups); +- } catch (Exception e) { +- throw new TestSetFailedException(e.getMessage(), e); - } - - XmlMethodSelector xms = new XmlMethodSelector(); - -- xms.setName( clazzName ); +- xms.setName(clazzName); - // looks to need a high value -- xms.setPriority( 9999 ); +- xms.setPriority(9999); - - return xms; ++ return null; } - static void run( List suiteFiles, String testSourceDirectory, + static void run( -- -2.35.1 +2.43.0 diff --git a/0003-Port-to-JUnit-5.8.1.patch b/0003-Port-to-JUnit-5.8.1.patch deleted file mode 100644 index 00ffa65..0000000 --- a/0003-Port-to-JUnit-5.8.1.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 56f22fd719fe464c8a080e710de847983bb65ac1 Mon Sep 17 00:00:00 2001 -From: Mikolaj Izdebski -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 @@ - - org.junit.platform - junit-platform-launcher -- 1.3.2 -+ 1.8.1 - - - org.junit.jupiter - junit-jupiter-engine -- 5.3.2 -+ 5.8.1 - - - org.junit.jupiter - junit-jupiter-params -- 5.3.2 -+ 5.8.1 - - - org.mockito -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 - diff --git a/maven-surefire.spec b/maven-surefire.spec index c24d836..2c988b8 100644 --- a/maven-surefire.spec +++ b/maven-surefire.spec @@ -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 @@ -110,9 +110,8 @@ Javadoc for %{name}. %setup -q -n surefire-%{upstream_version} cp -p %{SOURCE2} . -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 +%patch 1 -p1 +%patch 2 -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 - 3.2.2-1 +- Update to upstream version 3.2.2 + * Sat Sep 02 2023 Mikolaj Izdebski - 3.0.0~M6-7 - Rebuild diff --git a/sources b/sources index 8f509b2..d74e861 100644 --- a/sources +++ b/sources @@ -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