[Git][java-team/jtreg7][master] 11 commits: Merge remote-tracking branch 'vpa1977/upstream' into upstream
Tony Mancill (@tmancill)
gitlab at salsa.debian.org
Thu Oct 30 03:37:09 GMT 2025
Tony Mancill pushed to branch master at Debian Java Maintainers / jtreg7
Commits:
c5ac953b by tony mancill at 2024-07-09T09:51:22-07:00
Merge remote-tracking branch 'vpa1977/upstream' into upstream
- - - - -
69711919 by Vladimir Petko at 2025-02-12T10:35:23+13:00
New upstream version 7.5.1+1+ds1
- - - - -
82cab5d3 by Vladimir Petko at 2025-08-06T13:41:59+12:00
New upstream version 7.5.2+1+ds1
- - - - -
c77f07c5 by Vladimir Petko at 2025-10-29T08:22:07+13:00
d/p/codetools-*: add patches to resolve test ftbfs
- - - - -
c00c6c61 by Vladimir Petko at 2025-10-29T08:22:14+13:00
d/p/testng-build-with-gradle.patch: drop snakeyaml.
- - - - -
cff367ba by Vladimir Petko at 2025-10-29T08:22:16+13:00
* d/{control, copyright}: drop snakeyaml dependency
(Closes: #1117950).
- - - - -
50993c8c by Vladimir Petko at 2025-10-29T08:22:21+13:00
d/watch: update repack version.
- - - - -
25c8c6af by Vladimir Petko at 2025-10-29T08:22:25+13:00
changelog
- - - - -
77ae975b by Vladimir Petko at 2025-10-29T08:26:35+13:00
New upstream version 7.5.2+1+ds2
- - - - -
6ba95141 by Vladimir Petko at 2025-10-29T08:26:48+13:00
Update upstream source from tag 'upstream/7.5.2+1+ds2'
Update to upstream version '7.5.2+1+ds2'
with Debian dir e79187305c56bdad5f2323c38c4e9a3247d7c9ff
- - - - -
6b08fc4d by Tony Mancill at 2025-10-30T03:36:44+00:00
Merge branch 'vendor_snakeyaml' into 'master'
address jtreg7 ftbfs
See merge request java-team/jtreg7!11
- - - - -
16 changed files:
- debian/changelog
- debian/control
- debian/copyright
- + debian/patches/codetools-7904101-proposed.patch
- + debian/patches/codetools-7904104-proposed.patch
- + debian/patches/codetools-7904105-proposed.patch
- + debian/patches/codetools-7904106-proposed.patch
- + debian/patches/codetools-7904107-proposed.patch
- debian/patches/series
- debian/patches/testng-build-with-gradle.patch
- debian/watch
- − testng/testng-core/src/main/java/org/testng/Converter.java
- − testng/testng-core/src/main/java/org/testng/internal/Yaml.java
- − testng/testng-core/src/main/java/org/testng/internal/YamlParser.java
- − testng/testng-core/src/main/resources/META-INF/services/org.testng.xml.ISuiteParser
- − testng/testng-core/src/test/java/test/yaml/YamlTest.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,24 @@
+jtreg7 (7.5.2+1+ds2-1) UNRELEASED; urgency=medium
+
+ * d/{control, copyright,p/testng-build-with-gradle.patch}: drop
+ snakeyaml dependency (Closes: #1117950).
+ * Add patches to resolve test ftbfs (Closes: #1115694):
+ - d/p/codetools-7904101.patch: capture all stdout/stderr output
+ from the agent vm to the log file.
+ - d/p/codetools-7904104-proposed.patch: do not interrupt main
+ thread if the agent process is killed.
+ - d/p/codetools-7904105-proposed.patch: synchronize test result
+ updates.
+ - d/p/codetools-7904106-proposed.patch: use different work
+ directories for TestNativePath.
+ - d/p/codetools-7904107-proposed.patch: add a separate target to
+ filter log files.
+ * d/flush_stream.patch: drop patch, it is replaced by
+ d/p/codetools-7904101.patch.
+ * d/watch: update repack version.
+
+ -- Vladimir Petko <vladimir.petko at canonical.com> Thu, 23 Oct 2025 08:54:01 +1300
+
jtreg7 (7.5.2+1+ds1-2) unstable; urgency=medium
* d/copyright: revert FSF address change.
=====================================
debian/control
=====================================
@@ -34,7 +34,6 @@ Build-Depends:
libmaven-shade-plugin-java,
libassertj-core-java,
libjtharness-java (>= 6.0),
- libyaml-snake-java,
libfindbugs-java,
libbsh-java,
libasm-java,
=====================================
debian/copyright
=====================================
@@ -45,6 +45,11 @@ Files-Excluded-testng:
.gitattributes
.github/*
gradle/*
+ testng-core/src/main/java/org/testng/internal/Yaml.java
+ testng-core/src/test/java/test/yaml/YamlTest.java
+ testng-core/src/main/java/org/testng/Converter.java
+ testng-core/src/main/java/org/testng/internal/YamlParser.java
+ testng-core/src/main/resources/META-INF/services/org.testng.xml.ISuiteParser
Upstream-Name: jtreg
Source: https://github.com/openjdk/jtreg/
=====================================
debian/patches/codetools-7904101-proposed.patch
=====================================
@@ -0,0 +1,411 @@
+Description: intermittent failure in StreamsTest.agentvm.ok
+ FileDescriptor test intermittently fails because the agent's process output
+ capture lacks synchronisation.
+ This PR fixes the issue:
+ - Agent VM prints the "process output separator" to stderr and stdout
+ before and after the action.
+ - The main vm uses the marker to stop reading the stream for the current
+ test result section (or a general agent log).
+ - The main vm restarts reading the log after updating the test section (or clearing it)
+ until the next marker or the process is shut down.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Origin: upstream, https://github.com/openjdk/jtreg/pull/295
+Bug: https://bugs.openjdk.org/browse/CODETOOLS-7904101
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1115694
+Last-Update: 2025-10-28
+
+--- /dev/null
++++ b/src/share/classes/com/sun/javatest/regtest/agent/AgentProcessLogger.java
+@@ -0,0 +1,149 @@
++/*
++ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation. Oracle designates this
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
++ * or visit www.oracle.com if you need additional information or have any
++ * questions.
++ */
++
++package com.sun.javatest.regtest.agent;
++
++import java.io.BufferedReader;
++import java.io.IOException;
++import java.io.InputStreamReader;
++import java.io.PrintWriter;
++import java.util.Map;
++import java.util.concurrent.ExecutionException;
++import java.util.concurrent.ExecutorService;
++import java.util.concurrent.Executors;
++import java.util.concurrent.Future;
++import java.util.concurrent.TimeUnit;
++import java.util.concurrent.TimeoutException;
++import java.util.function.BiConsumer;
++import java.util.function.Function;
++
++/**
++ * Handles stdout/stderr process output from the agent.
++ */
++public class AgentProcessLogger {
++
++ /**
++ * Constructs a thread pool to handle agent process output
++ * and creates stdout and stderr readers
++ *
++ * @param p agent process
++ */
++ public AgentProcessLogger(Process p) {
++ executorService = Executors.newFixedThreadPool(2, runnable -> {
++ Thread th = new Thread(runnable);
++ th.setDaemon(true);
++ return th;
++ });
++ stdOut = new BufferedReader(new InputStreamReader(p.getInputStream()));
++ stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
++ }
++
++ /**
++ * Starts logging output and error streams to the specified consumer
++ *
++ * @param logConsumer log consumer, has two parameters - stream name and
++ * the log line
++ */
++ public void startLogging(BiConsumer<String, String> logConsumer,
++ Map<String, PrintWriter> processStreamWriters,
++ Function<String, PrintWriter> mappingFunction) {
++ if (inputDone != null || errorDone != null) {
++ throw new RuntimeException("call stopLogging first");
++ }
++ if (processStreamWriters != null) {
++ processStreamWriters.computeIfAbsent("stdout", mappingFunction);
++ processStreamWriters.computeIfAbsent("stderr", mappingFunction);
++ }
++ inputDone = executorService.submit(() -> captureLog("stdout", stdOut, logConsumer));
++ errorDone = executorService.submit(() -> captureLog("stderr", stdErr, logConsumer));
++ }
++
++
++ /**
++ * Waits for the logging tasks to finish
++ *
++ * @param timeout shutdown timeout
++ * @param timeUnit shutdown time unit
++ *
++ * @throws ExecutionException the logger threw an unexpected exception
++ * @throws InterruptedException the logger was interrupted
++ * @throws TimeoutException logging task failed to stop within 60 seconds
++ */
++ public void stopLogging(int timeout, TimeUnit timeUnit) throws ExecutionException, InterruptedException, TimeoutException {
++ inputDone.get(timeout, timeUnit);
++ errorDone.get(timeout, timeUnit);
++ inputDone = null;
++ errorDone = null;
++ }
++
++ /**
++ * Wait for logging tasks to finish and shutdown the thread pool
++ *
++ * @param timeout shutdown timeout
++ * @param timeUnit shutdown time unit
++ */
++ public void shutdown(int timeout, TimeUnit timeUnit) {
++ try {
++ stopLogging(timeout, timeUnit);
++ } catch (ExecutionException | InterruptedException | TimeoutException ex) {
++ // ignore exception, the process is terminating
++ }
++ executorService.shutdown();
++ }
++
++ /**
++ * Forward log lines to the consumer, stop forwarding on the separator
++ * line
++ *
++ * @param streamName name of the stream
++ * @param reader process's stream reader
++ */
++ private Void captureLog(String streamName, BufferedReader reader, BiConsumer<String, String> consumer) {
++ try {
++ String line;
++ while ((line = reader.readLine()) != null) {
++ int endMarker = line.indexOf(AgentServer.PROCESS_OUTPUT_SEPARATOR);
++ if (endMarker < 0) {
++ consumer.accept(streamName, line);
++ continue;
++ }
++ if (endMarker > 0) {
++ line = line.substring(0, endMarker);
++ consumer.accept(streamName, line);
++ }
++ break;
++ }
++ } catch (IOException ex) {
++ // ignore the exception, the reader might be closed
++ }
++ return null;
++ }
++
++ private final ExecutorService executorService;
++ private final BufferedReader stdOut;
++ private final BufferedReader stdErr;
++ private Future<Void> inputDone;
++ private Future<Void> errorDone;
++}
+--- a/src/share/classes/com/sun/javatest/regtest/agent/AgentServer.java
++++ b/src/share/classes/com/sun/javatest/regtest/agent/AgentServer.java
+@@ -30,9 +30,11 @@
+ import java.io.DataInputStream;
+ import java.io.DataOutputStream;
+ import java.io.File;
++import java.io.FileDescriptor;
+ import java.io.FileWriter;
+ import java.io.IOException;
+ import java.io.OutputStream;
++import java.io.OutputStreamWriter;
+ import java.io.PrintStream;
+ import java.io.PrintWriter;
+ import java.io.Writer;
+@@ -93,6 +95,9 @@
+ public static final byte KEEPALIVE = 5;
+ public static final byte CLOSE = 6;
+
++ public static final String PROCESS_OUTPUT_SEPARATOR =
++ "------ This line is the stdout/stderr output separator ------";
++
+ /**
+ * Send KEEPALIVE bytes periodically to a stream.
+ * The bytes are written every {@code WRITE_TIMEOUT} milliseconds.
+@@ -236,6 +241,7 @@
+ try {
+ int op;
+ while ((op = in.read()) != -1) {
++ writeProcessOutputSeparator();
+ switch (op) {
+ case DO_COMPILE:
+ doCompile();
+@@ -252,6 +258,8 @@
+ throw new Error("Agent.Server: unexpected op: " + op);
+ }
+ out.flush();
++ // signal end of section output for the log writer
++ writeProcessOutputSeparator();
+ }
+ } finally {
+ keepAlive.finished();
+@@ -260,6 +268,20 @@
+ }
+ }
+
++ private void writeProcessOutputSeparator() {
++ try {
++ processStdOut.write(PROCESS_OUTPUT_SEPARATOR);
++ processStdOut.write(System.lineSeparator());
++ processStdOut.flush();
++ processStdErr.write(PROCESS_OUTPUT_SEPARATOR);
++ processStdErr.write(System.lineSeparator());
++ processStdErr.flush();
++ }
++ catch (IOException e ){
++ // ignore exception as the agent process may be killed
++ }
++ }
++
+ private void doCompile() throws IOException {
+ if (traceServer) {
+ traceOut.println("Agent.Server.doCompile");
+@@ -388,7 +410,8 @@
+ private final PrintWriter logWriter;
+ private final int id;
+ private final Map<OutputKind, Writer> writers = new EnumMap<>(OutputKind.class);
+-
++ private final OutputStreamWriter processStdOut = new FileWriter(FileDescriptor.out);
++ private final OutputStreamWriter processStdErr = new FileWriter(FileDescriptor.err);
+ /**
+ * Create an output stream for output to be sent back to the client via the server connection.
+ * @param kind the kind of stream
+--- a/src/share/classes/com/sun/javatest/regtest/exec/Agent.java
++++ b/src/share/classes/com/sun/javatest/regtest/exec/Agent.java
+@@ -26,15 +26,12 @@
+ package com.sun.javatest.regtest.exec;
+
+
+-import java.io.BufferedReader;
+ import java.io.DataInputStream;
+ import java.io.DataOutputStream;
+ import java.io.EOFException;
+ import java.io.File;
+ import java.io.FileWriter;
+ import java.io.IOException;
+-import java.io.InputStream;
+-import java.io.InputStreamReader;
+ import java.io.PrintStream;
+ import java.io.PrintWriter;
+ import java.lang.reflect.Method;
+@@ -60,13 +57,16 @@
+ import java.util.TreeSet;
+ import java.util.WeakHashMap;
+ import java.util.concurrent.CountDownLatch;
++import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.TimeUnit;
++import java.util.concurrent.TimeoutException;
+
+ import com.sun.javatest.Status;
+ import com.sun.javatest.TestResult;
+ import com.sun.javatest.WorkDirectory;
+ import com.sun.javatest.regtest.TimeoutHandler;
+ import com.sun.javatest.regtest.agent.ActionHelper;
++import com.sun.javatest.regtest.agent.AgentProcessLogger;
+ import com.sun.javatest.regtest.agent.AgentServer;
+ import com.sun.javatest.regtest.agent.Alarm;
+ import com.sun.javatest.regtest.agent.Flags;
+@@ -164,8 +164,8 @@
+ env.putAll(envVars);
+ agentServerProcess = process = pb.start();
+ agentServerPid = ProcessUtils.getProcessId(process);
+- copyAgentProcessStream("stdout", process.getInputStream());
+- copyAgentProcessStream("stderr", process.getErrorStream());
++ processLogger = new AgentProcessLogger(process);
++ startAgentLog();
+
+ try {
+ final int ACCEPT_TIMEOUT = (int) (60 * 1000 * timeoutFactor);
+@@ -202,29 +202,11 @@
+ }
+
+ /**
+- * Reads the output written by an agent process, and copies it either to
+- * the current TestResult object (when one is available) or to the agent's
+- * log file, if output is found while there is no test using the agent.
+- *
+- * @param name the name of the stream
+- * @param in the stream
++ * Writes process input and error stream to the agent log.
+ */
+- void copyAgentProcessStream(final String name, final InputStream in) {
+- Thread t = new Thread() {
+- @Override
+- public void run() {
+- try (BufferedReader inReader = new BufferedReader(new InputStreamReader(in))) {
+- String line;
+- while ((line = inReader.readLine()) != null) {
+- handleProcessStreamLine(name, line);
+- }
+- } catch (IOException e) {
+- // ignore
+- }
+- }
+- };
+- t.setDaemon(true);
+- t.start();
++ private void startAgentLog() {
++ processLogger.startLogging( (String stream, String logLine) -> log(stream + ": " + logLine),
++ null, null);
+ }
+
+ /**
+@@ -258,30 +240,24 @@
+ *
+ * @param section the test result section to be used, or {@code null}
+ */
+- private synchronized void captureProcessStreams(TestResult.Section section) {
++ private synchronized void captureProcessStreams(TestResult.Section section, int timeout, TimeUnit timeUnit)
++ throws InterruptedException, ExecutionException, TimeoutException {
++ processLogger.stopLogging(timeout, timeUnit);
+ currentTestResultSection = section;
+ if (currentTestResultSection == null) {
+ for (PrintWriter pw : processStreamWriters.values()) {
+ pw.close();
+ }
+ processStreamWriters.clear();
+- }
+- }
+-
+- /**
+- * Saves a line of output that was written by the agent to stdout (fd1) or stderr (fd2).
+- * If there is a current test result section, the line is saved there;
+- * otherwise it is written to the agent log file.
+- *
+- * @param name the name of the stream from which the line was read
+- * @param line the line that was read
+- */
+- private synchronized void handleProcessStreamLine(String name, String line) {
+- if (currentTestResultSection == null) {
+- log(name + ": " + line);
++ startAgentLog();
+ } else {
+- processStreamWriters.computeIfAbsent(name, currentTestResultSection::createOutput)
+- .println(line);
++ processLogger.startLogging((String name, String line) -> {
++ Objects.requireNonNull(currentTestResultSection);
++ Objects.requireNonNull(processStreamWriters);
++ Objects.requireNonNull(name);
++ Objects.requireNonNull(line);
++ processStreamWriters.get(name).println(line);
++ }, processStreamWriters, currentTestResultSection::createOutput);
+ }
+ }
+
+@@ -391,17 +367,25 @@
+ }
+ keepAlive.setEnabled(false);
+ try {
+- captureProcessStreams(trs);
+ synchronized (out) {
+ agentAction.send();
+ }
+ trace(actionName + ": request sent");
+- return readResults(trs);
+- } catch (IOException e) {
++ // The agent sends process output separator in response
++ // to receiving a command. Wait for the separator and
++ // redirect log to the test result section
++ captureProcessStreams(trs, timeout, TimeUnit.SECONDS);
++ Status aResult = readResults(trs);
++ // The agent will be disposed on exception.
++ // Reset the agent log only if the agent can be reused.
++ // The agent will send process output separator on
++ // command execution.
++ captureProcessStreams(null, timeout, TimeUnit.SECONDS);
++ return aResult;
++ } catch (InterruptedException | TimeoutException | ExecutionException | IOException e) {
+ trace(actionName + ": error " + e);
+ throw new Fault(e);
+ } finally {
+- captureProcessStreams(null);
+ alarm.cancel();
+ keepAlive.setEnabled(true);
+ if (alarm.didFire()) {
+@@ -486,7 +470,9 @@
+ alarm.cancel();
+ Thread.interrupted(); // clear any interrupted status
+ }
+-
++ // Ensure that thread pool threads are shut down
++ // and the agent log is fully written
++ processLogger.shutdown(60, TimeUnit.SECONDS);
+ log("Closed");
+ }
+
+@@ -618,6 +604,7 @@
+ final List<String> vmOpts;
+ final File execDir;
+ final Process process;
++ final AgentProcessLogger processLogger;
+ final DataInputStream in;
+ final DataOutputStream out;
+ final KeepAlive keepAlive;
=====================================
debian/patches/codetools-7904104-proposed.patch
=====================================
@@ -0,0 +1,35 @@
+Description: intermittent test failure in TimeoutDefaultSecondsWaiter
+ victim.interrupt() is not needed if the process exits successfully
+ after the kill signal. This PR only calls interrupt() if the process
+ fails to exit or the wait is interrupted for some reason.
+ This allows TimeoutDefaultSecondsWaiter tests to pass.
+ Alternative: update assertion in TimeoutDefaultSecondsWaiter test.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Origin: upstream, https://github.com/openjdk/jtreg/pull/296
+Bug: https://bugs.openjdk.org/browse/CODETOOLS-7904104
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1115694
+Last-Update: 2025-10-28
+
+--- a/src/share/classes/com/sun/javatest/regtest/exec/ProcessCommand.java
++++ b/src/share/classes/com/sun/javatest/regtest/exec/ProcessCommand.java
+@@ -329,9 +329,17 @@ public void run() {
+
+ timeoutHandlerDone.countDown();
+
+- // JDK 1.8 introduces a Process.waitFor(timeout) method which could
+- // be used here. We need run on 1.5 so using interrupt() instead.
+- victim.interrupt();
++ // unlock the main thread if the process fails
++ // to exit
++ try {
++ if (!process.waitFor(timeout, TimeUnit.SECONDS)) {
++ victim.interrupt();
++ }
++ }
++ catch (InterruptedException e) {
++ log.println("Interrupted exception: " + e);
++ victim.interrupt();
++ }
+ }
+ };
+ timeoutHandlerThread.setName("Timeout Handler for " + cmd.get(0));
=====================================
debian/patches/codetools-7904105-proposed.patch
=====================================
@@ -0,0 +1,42 @@
+Description: intermittent test failure in CleanupDirTests.agentvm.conc
+ jtharness does not synchronize calls to Observer. Synchronized keyword
+ needs to be added when processing shared state.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Origin: upstream, https://github.com/openjdk/jtreg/pull/297
+Bug: https://bugs.openjdk.org/browse/CODETOOLS-7904105
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1115694
+Last-Update: 2025-10-28
+
+--- a/src/share/classes/com/sun/javatest/regtest/report/TestStats.java
++++ b/src/share/classes/com/sun/javatest/regtest/report/TestStats.java
+@@ -99,7 +99,7 @@
+ }
+
+ @Override
+- public void finishedTest(TestResult tr) {
++ public synchronized void finishedTest(TestResult tr) {
+ add(tr);
+ }
+
+--- a/src/share/classes/com/sun/javatest/regtest/report/XMLWriter.java
++++ b/src/share/classes/com/sun/javatest/regtest/report/XMLWriter.java
+@@ -365,7 +365,7 @@
+ }
+
+ @Override
+- public void finishedTest(TestResult tr) {
++ public synchronized void finishedTest(TestResult tr) {
+ try {
+ super.finishedTest(tr);
+ new XMLWriter(tr, mustVerify, harnessOut, harnessErr).toXML();
+--- a/src/share/classes/com/sun/javatest/regtest/tool/Tool.java
++++ b/src/share/classes/com/sun/javatest/regtest/tool/Tool.java
+@@ -1946,7 +1946,7 @@
+
+ h.addObserver(new BasicObserver() {
+ @Override
+- public void error(String msg) {
++ public synchronized void error(String msg) {
+ Tool.this.error(msg);
+ }
+ });
=====================================
debian/patches/codetools-7904106-proposed.patch
=====================================
@@ -0,0 +1,75 @@
+Description: TestNativePath: use different work directories
+ Both agentvm and othervm targets in TestNativePath use the same work path
+ $(BUILDTESTDIR)/nativepath.othervm/work.
+ This causes intermittent test failures when the tests are run in parallel.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Origin: upstream, https://github.com/openjdk/jtreg/pull/298
+Bug: https://bugs.openjdk.org/browse/CODETOOLS-7904106
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1115694
+Last-Update: 2025-10-28
+
+--- a/test/nativepath/TestNativePath.gmk
++++ b/test/nativepath/TestNativePath.gmk
+@@ -38,16 +38,16 @@
+ -jdk:$(JDKHOME) \
+ -nativepath:$(NATIVEPATH) \
+ -vmoption:-Dcorrect.nativepath=$(NATIVEPATH) \
+- -w:$(BUILDTESTDIR)/nativepath.othervm/work \
+- -r:$(BUILDTESTDIR)/nativepath.othervm/report \
++ -w:$(@:%.ok=%nativepath.othervm)/work \
++ -r:$(@:%.ok=%nativepath.othervm)/report \
+ -verbose:fail \
+ $(@:$(BUILDTESTDIR)/TestNativePath.%.ok=-%) \
+ $(TESTDIR)/nativepath/NativesOK.java
+
+ $(JTREG_IMAGEDIR)/bin/jtreg $(JTREG_OPTS) \
+ -jdk:$(JDKHOME) \
+- -w:$(BUILDTESTDIR)/nativepath.othervm2/work \
+- -r:$(BUILDTESTDIR)/nativepath.othervm2/report \
++ -w:$(@:%.ok=%nativepath.othervm2)/work \
++ -r:$(@:%.ok=%nativepath.othervm2)/report \
+ -verbose:fail \
+ $(@:$(BUILDTESTDIR)/TestNativePath.%.ok=-%) \
+ $(TESTDIR)/nativepath/NativesEmpty.java
+@@ -82,8 +82,8 @@
+ # should yield an error
+ $(JTREG_IMAGEDIR)/bin/jtreg $(JTREG_OPTS) \
+ -jdk:$(JDKHOME) \
+- -w:$(BUILDTESTDIR)/nativepath.othervm2/work \
+- -r:$(BUILDTESTDIR)/nativepath.othervm2/report \
++ -w:$(@:%.ok=%nativepath.othervm2)/work \
++ -r:$(@:%.ok=%nativepath.othervm2)/report \
+ -verbose:fail \
+ $(TESTDIR)/nativepath/NativesOK.java \
+ 2>&1 | grep -q "Use -nativepath to specify the location of native code"
+@@ -91,8 +91,8 @@
+ # Exclude all tests with native code
+ $(JTREG_IMAGEDIR)/bin/jtreg $(JTREG_OPTS) \
+ -jdk:$(JDKHOME) \
+- -w:$(BUILDTESTDIR)/nativepath.othervm2/work \
+- -r:$(BUILDTESTDIR)/nativepath.othervm2/report \
++ -w:$(@:%.ok=%nativepath.othervm2)/work \
++ -r:$(@:%.ok=%nativepath.othervm2)/report \
+ -k:!native \
+ -verbose:fail \
+ $(TESTDIR)/nativepath/NativesOK.java \
+@@ -103,15 +103,15 @@
+ -jdk:$(JDKHOME) \
+ -nativepath:$(NATIVEPATH) \
+ -e:CORRECTNATIVEPATH=$(NATIVEPATH) \
+- -w:$(BUILDTESTDIR)/nativepath.shell/work \
+- -r:$(BUILDTESTDIR)/nativepath.shell/report \
++ -w:$(@:%.ok=%nativepath.shell)/work \
++ -r:$(@:%.ok=%nativepath.shell)/report \
+ -verbose:fail \
+ $(TESTDIR)/nativepath/NativesOKShell.sh
+
+ $(JTREG_IMAGEDIR)/bin/jtreg $(JTREG_OPTS) \
+ -jdk:$(JDKHOME) \
+- -w:$(BUILDTESTDIR)/nativepath.shell/work \
+- -r:$(BUILDTESTDIR)/nativepath.shell/report \
++ -w:$(@:%.ok=%nativepath.shell)/work \
++ -r:$(@:%.ok=%nativepath.shell)/report \
+ -verbose:fail \
+ $(TESTDIR)/nativepath/NativesEmptyShell.sh
+
=====================================
debian/patches/codetools-7904107-proposed.patch
=====================================
@@ -0,0 +1,38 @@
+Description: AgentOut.othervm.ok should not access $(BUILDTESTDIR)/AgentOut.agentvm
+ AgentOut.othervm.ok tries to access $(BUILDTESTDIR)/AgentOut.agentvm.
+ This should only happen in AgentOut.agentvm.ok.
+ Add a new target to filter log lines that depends on AgentOut.agentvm.ok.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Origin: upstream, https://github.com/openjdk/jtreg/pull/299
+Bug: https://bugs.openjdk.org/browse/CODETOOLS-7904107
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1115694
+Last-Update: 2025-10-28
+
+--- a/test/agentout/AgentOut.gmk
++++ b/test/agentout/AgentOut.gmk
+@@ -78,6 +78,10 @@
+ < $$i \
+ > `dirname $$i`-filtered/`basename $$i` ; \
+ done
++ #
++ echo "run at `date`" > $@
++
++$(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered.ok: $(BUILDTESTDIR)/AgentOut.agentvm.ok
+ # merge direct and stderr from agent CompileTest to match stderr from othervm CompileTest
+ $(CAT) $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered/CompileTest-direct.log \
+ $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered/CompileTest-System.err.log \
+@@ -85,12 +89,10 @@
+ $(MV) $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered/tmp.log \
+ $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered/CompileTest-System.err.log
+ $(CAT) < $(DEV_NULL) > $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered/CompileTest-direct.log
+- #
+- echo "run at `date`" > $@
+
+ $(BUILDTESTDIR)/AgentOut.ok: \
+- $(BUILDTESTDIR)/AgentOut.agentvm.ok \
+- $(BUILDTESTDIR)/AgentOut.othervm.ok
++ $(BUILDTESTDIR)/AgentOut.othervm.ok \
++ $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered.ok
+ $(DIFF) --strip-trailing-cr --recursive \
+ $(BUILDTESTDIR)/AgentOut.agentvm/logs-filtered \
+ $(BUILDTESTDIR)/AgentOut.othervm/logs-filtered
=====================================
debian/patches/series
=====================================
@@ -27,4 +27,8 @@ testng-build-with-gradle.patch
jtdiff-version.patch
java21-codetools-7903646.patch
preview-test.patch
-flush-alarm.patch
+codetools-7904101-proposed.patch
+codetools-7904104-proposed.patch
+codetools-7904105-proposed.patch
+codetools-7904106-proposed.patch
+codetools-7904107-proposed.patch
=====================================
debian/patches/testng-build-with-gradle.patch
=====================================
@@ -4,7 +4,7 @@ Forwarded: not-needed
--- /dev/null
+++ b/testng/build.gradle
-@@ -0,0 +1,118 @@
+@@ -0,0 +1,117 @@
+plugins {
+ id 'java-library'
+ id 'maven-publish'
@@ -27,7 +27,6 @@ Forwarded: not-needed
+ compile 'org.apache.ant:ant:1.10.12'
+ compile 'com.google.inject:guice:5.1.0'
+ compile 'junit:junit:4.13.2'
-+ compile 'org.yaml:snakeyaml:1.33'
+ compile 'org.assertj:assertj-core:2.3.0'
+ compile 'com.google.code.findbugs:jsr305:debian'
+}
=====================================
debian/watch
=====================================
@@ -1,5 +1,5 @@
version=4
-opts="compression=gzip,repack,repacksuffix=+ds1,dversionmangle=s/\+(debian|dfsg|ds|deb)(\.?\d+)?$//" \
+opts="compression=gzip,repack,repacksuffix=+ds2,dversionmangle=s/\+(debian|dfsg|ds|deb)(\.?\d+)?$//" \
https://github.com/openjdk/jtreg/tags .*/jtreg-(7.[\d\.]+(?:\+[0-9]+)?)\.tar\.gz
opts="compression=gzip,component=jansi1,repack" \
=====================================
testng/testng-core/src/main/java/org/testng/Converter.java deleted
=====================================
@@ -1,88 +0,0 @@
-package org.testng;
-
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.ParameterException;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import org.testng.collections.Sets;
-import org.testng.internal.Yaml;
-import org.testng.xml.XmlSuite;
-import org.testng.xml.internal.Parser;
-
-/**
- * Convert XML files to YAML and vice versa.
- *
- * @author cbeust
- */
-public class Converter {
-
- @Parameter(description = "file1 [file2 file3...]", required = true)
- private List<String> m_files;
-
- @Parameter(names = "-d", description = "The directory where the file(s) will be created")
- private String m_outputDirectory = ".";
-
- public static void main(String[] args) throws IOException {
- Converter c = new Converter();
- c.run(args);
- }
-
- private void findAllSuites(Collection<XmlSuite> suites, Set<XmlSuite> result) {
- for (XmlSuite s : suites) {
- result.add(s);
- for (XmlSuite xs : s.getChildSuites()) {
- findAllSuites(Collections.singletonList(xs), result);
- }
- }
- }
-
- private void run(String[] args) throws IOException {
- JCommander jc = new JCommander(this);
- try {
- jc.parse(args);
- File f = new File(m_outputDirectory);
- if (!f.exists()) f.mkdir();
-
- for (String file : m_files) {
- Set<XmlSuite> allSuites = Sets.newHashSet();
- Parser parser = new Parser(file);
- parser.setLoadClasses(false); // we might not have these classes on the classpath
- findAllSuites(parser.parse(), allSuites);
-
- for (XmlSuite suite : allSuites) {
- String fileName = suite.getFileName();
- int ind = fileName.lastIndexOf(".");
- String bn = fileName.substring(0, ind);
- int ind2 = bn.lastIndexOf(File.separatorChar);
- String baseName = bn.substring(ind2 + 1);
-
- if (file.endsWith(".xml")) {
- File newFile = new File(m_outputDirectory, baseName + ".yaml");
- writeFile(newFile, Yaml.toYaml(suite).toString());
- } else if (file.endsWith(".yaml")) {
- File newFile = new File(m_outputDirectory, baseName + ".xml");
- writeFile(newFile, suite.toXml());
- } else {
- throw new TestNGException("Unknown file type:" + file);
- }
- }
- }
- } catch (ParameterException ex) {
- System.out.println("Error: " + ex.getMessage());
- jc.usage();
- }
- }
-
- private void writeFile(File newFile, String content) throws IOException {
- try (FileWriter bw = new FileWriter(newFile)) {
- bw.write(content);
- }
- System.out.println("Wrote " + newFile);
- }
-}
=====================================
testng/testng-core/src/main/java/org/testng/internal/Yaml.java deleted
=====================================
@@ -1,394 +0,0 @@
-package org.testng.internal;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import org.testng.TestNGException;
-import org.testng.internal.objects.InstanceCreator;
-import org.testng.util.Strings;
-import org.testng.xml.XmlClass;
-import org.testng.xml.XmlInclude;
-import org.testng.xml.XmlPackage;
-import org.testng.xml.XmlScript;
-import org.testng.xml.XmlSuite;
-import org.testng.xml.XmlTest;
-import org.yaml.snakeyaml.TypeDescription;
-import org.yaml.snakeyaml.constructor.Constructor;
-import org.yaml.snakeyaml.nodes.MappingNode;
-import org.yaml.snakeyaml.nodes.Node;
-import org.yaml.snakeyaml.nodes.NodeId;
-import org.yaml.snakeyaml.nodes.NodeTuple;
-import org.yaml.snakeyaml.nodes.ScalarNode;
-
-/** YAML support for TestNG. */
-public final class Yaml {
-
- private Yaml() {}
-
- public static XmlSuite parse(String filePath, InputStream is, boolean loadClasses)
- throws FileNotFoundException {
- Constructor constructor = new TestNGConstructor(XmlSuite.class);
- {
- TypeDescription suiteDescription = new TypeDescription(XmlSuite.class);
- suiteDescription.addPropertyParameters("packages", XmlPackage.class);
- suiteDescription.addPropertyParameters("listeners", String.class);
- suiteDescription.addPropertyParameters("tests", XmlTest.class);
- suiteDescription.addPropertyParameters("method-selectors", XmlMethodSelector.class);
- constructor.addTypeDescription(suiteDescription);
- }
-
- {
- TypeDescription testDescription = new TypeDescription(XmlTest.class);
- testDescription.addPropertyParameters("classes", XmlClass.class);
- testDescription.addPropertyParameters("metaGroups", String.class, List.class);
- testDescription.addPropertyParameters("method-selectors", XmlMethodSelector.class);
- constructor.addTypeDescription(testDescription);
- }
-
- TypeDescription xmlClassDescription = new XmlClassTypeDescriptor(loadClasses);
- constructor.addTypeDescription(xmlClassDescription);
-
- org.yaml.snakeyaml.Yaml y = new org.yaml.snakeyaml.Yaml(constructor);
- if (is == null) {
- is = new FileInputStream(new File(filePath));
- }
- XmlSuite result = y.load(is);
-
- result.setFileName(filePath);
-
- // Adjust XmlTest parents and indices
- for (XmlTest t : result.getTests()) {
- t.setSuite(result);
- int index = 0;
- for (XmlClass c : t.getClasses()) {
- c.setIndex(index++);
- }
- }
-
- return result;
- }
-
- private static void maybeAdd(StringBuilder sb, String key, Object value, Object def) {
- maybeAdd(sb, "", key, value, def);
- }
-
- private static void maybeAdd(StringBuilder sb, String sp, String key, Object value, Object def) {
- if (value != null && !value.equals(def)) {
- sb.append(sp).append(key).append(": ").append(value.toString()).append("\n");
- }
- }
-
- /*
- * The main entry point to convert an XmlSuite into YAML. This method is allowed to be used by
- * external tools (e.g. Eclipse).
- */
- public static StringBuilder toYaml(XmlSuite suite) {
- StringBuilder result = new StringBuilder();
-
- maybeAdd(result, "name", suite.getName(), null);
- maybeAdd(result, "junit", suite.isJUnit(), XmlSuite.DEFAULT_JUNIT);
- maybeAdd(result, "verbose", suite.getVerbose(), XmlSuite.DEFAULT_VERBOSE);
- maybeAdd(result, "threadCount", suite.getThreadCount(), XmlSuite.DEFAULT_THREAD_COUNT);
- maybeAdd(
- result,
- "dataProviderThreadCount",
- suite.getDataProviderThreadCount(),
- XmlSuite.DEFAULT_DATA_PROVIDER_THREAD_COUNT);
- maybeAdd(result, "timeOut", suite.getTimeOut(), null);
- maybeAdd(result, "parallel", suite.getParallel(), XmlSuite.DEFAULT_PARALLEL);
- maybeAdd(
- result,
- "configFailurePolicy",
- suite.getConfigFailurePolicy().toString(),
- XmlSuite.DEFAULT_CONFIG_FAILURE_POLICY);
- maybeAdd(
- result,
- "skipFailedInvocationCounts",
- suite.skipFailedInvocationCounts(),
- XmlSuite.DEFAULT_SKIP_FAILED_INVOCATION_COUNTS);
-
- toYaml(result, "", suite.getParameters());
- toYaml(result, suite.getPackages());
-
- if (!suite.getListeners().isEmpty()) {
- result.append("listeners:\n");
- toYaml(result, " ", suite.getListeners());
- }
-
- if (!suite.getPackages().isEmpty()) {
- result.append("packages:\n");
- toYaml(result, suite.getPackages());
- }
- if (!suite.getTests().isEmpty()) {
- result.append("tests:\n");
- for (XmlTest t : suite.getTests()) {
- toYaml(result, t);
- }
- }
-
- if (!suite.getChildSuites().isEmpty()) {
- result.append("suite-files:\n");
- toYaml(result, " ", suite.getSuiteFiles());
- }
-
- return result;
- }
-
- /** Convert a XmlTest into YAML */
- private static void toYaml(StringBuilder result, XmlTest t) {
- String sp2 = Strings.repeat(" ", 2);
- result.append(" ").append("- name: ").append(t.getName()).append("\n");
-
- maybeAdd(result, sp2, "junit", t.isJUnit(), XmlSuite.DEFAULT_JUNIT);
- maybeAdd(result, sp2, "verbose", t.getVerbose(), XmlSuite.DEFAULT_VERBOSE);
- maybeAdd(result, sp2, "timeOut", t.getTimeOut(), null);
- maybeAdd(result, sp2, "parallel", t.getParallel(), XmlSuite.DEFAULT_PARALLEL);
- maybeAdd(
- result,
- sp2,
- "skipFailedInvocationCounts",
- t.skipFailedInvocationCounts(),
- XmlSuite.DEFAULT_SKIP_FAILED_INVOCATION_COUNTS);
-
- maybeAdd(result, "preserveOrder", sp2, t.getPreserveOrder(), XmlSuite.DEFAULT_PRESERVE_ORDER);
-
- toYaml(result, sp2, t.getLocalParameters());
-
- if (!t.getIncludedGroups().isEmpty()) {
- result
- .append(sp2)
- .append("includedGroups: [ ")
- .append(Utils.join(t.getIncludedGroups(), ","))
- .append(" ]\n");
- }
-
- if (!t.getExcludedGroups().isEmpty()) {
- result
- .append(sp2)
- .append("excludedGroups: [ ")
- .append(Utils.join(t.getExcludedGroups(), ","))
- .append(" ]\n");
- }
-
- if (!t.getXmlDependencyGroups().isEmpty()) {
- result.append(sp2).append(sp2).append("xmlDependencyGroups:\n");
- t.getXmlDependencyGroups()
- .forEach(
- (k, v) -> result.append(sp2).append(sp2).append(sp2).append(k + ": " + v + "\n"));
- }
-
- Map<String, List<String>> mg = t.getMetaGroups();
- if (mg.size() > 0) {
- result.append(sp2).append("metaGroups: { ");
- boolean first = true;
- for (Map.Entry<String, List<String>> entry : mg.entrySet()) {
- if (!first) {
- result.append(", ");
- }
- result
- .append(entry.getKey())
- .append(": [ ")
- .append(Utils.join(entry.getValue(), ","))
- .append(" ] ");
- first = false;
- }
- result.append(" }\n");
- }
-
- if (!t.getXmlPackages().isEmpty()) {
- result.append(sp2).append(sp2).append("xmlPackages:\n");
- for (XmlPackage xp : t.getXmlPackages()) {
- toYaml(result, sp2 + " - ", xp);
- }
- }
-
- if (!t.getXmlClasses().isEmpty()) {
- result.append(sp2).append("classes:\n");
- for (XmlClass xc : t.getXmlClasses()) {
- toYaml(result, sp2 + " ", xc);
- }
- }
-
- result.append("\n");
- }
-
- private static void toYaml(StringBuilder result, String sp2, XmlClass xc) {
- List<XmlInclude> im = xc.getIncludedMethods();
- List<String> em = xc.getExcludedMethods();
- String name = (im.isEmpty() && em.isEmpty()) ? "" : "name: ";
-
- result.append(sp2).append("- ").append(name).append(xc.getName()).append("\n");
- if (!im.isEmpty()) {
- result.append(sp2).append(" includedMethods:\n");
- for (XmlInclude xi : im) {
- toYaml(result, sp2 + " ", xi);
- }
- }
-
- if (!em.isEmpty()) {
- result.append(sp2).append(" excludedMethods:\n");
- toYaml(result, sp2 + " ", em);
- }
- }
-
- private static void toYaml(StringBuilder result, String sp, XmlInclude xi) {
- result.append(sp).append("- name: ").append(xi.getName()).append("\n");
- String sp2 = sp + " ";
- toYaml(result, sp2, xi.getLocalParameters());
- }
-
- private static void toYaml(StringBuilder result, String sp, List<String> strings) {
- for (String l : strings) {
- result.append(sp).append("- ").append(l).append("\n");
- }
- }
-
- private static void toYaml(StringBuilder sb, List<XmlPackage> packages) {
- if (!packages.isEmpty()) {
- sb.append("packages:\n");
- for (XmlPackage p : packages) {
- toYaml(sb, " ", p);
- }
- }
- for (XmlPackage p : packages) {
- toYaml(sb, " ", p);
- }
- }
-
- private static void toYaml(StringBuilder sb, String sp, XmlPackage p) {
- sb.append(sp).append("name: ").append(p.getName()).append("\n");
-
- generateIncludeExclude(sb, sp, "includes", p.getInclude());
- generateIncludeExclude(sb, sp, "excludes", p.getExclude());
- }
-
- private static void generateIncludeExclude(
- StringBuilder sb, String sp, String key, List<String> includes) {
- if (!includes.isEmpty()) {
- sb.append(sp).append(" ").append(key).append("\n");
- for (String inc : includes) {
- sb.append(sp).append(" ").append(inc);
- }
- }
- }
-
- private static void mapToYaml(Map<String, String> map, StringBuilder out) {
- if (map.size() > 0) {
- out.append("{ ");
- boolean first = true;
- for (Map.Entry<String, String> e : map.entrySet()) {
- if (!first) {
- out.append(", ");
- }
- first = false;
- out.append(e.getKey()).append(": ").append(e.getValue());
- }
- out.append(" }\n");
- }
- }
-
- private static void toYaml(StringBuilder sb, String sp, Map<String, String> parameters) {
- if (!parameters.isEmpty()) {
- sb.append(sp).append("parameters").append(": ");
- mapToYaml(parameters, sb);
- }
- }
-
- private static class TestNGConstructor extends Constructor {
-
- public TestNGConstructor(Class<?> theRoot) {
- super(theRoot);
- yamlClassConstructors.put(NodeId.scalar, new ConstructParallelMode());
- yamlClassConstructors.put(NodeId.mapping, new ConstructXmlScript());
- }
-
- private class ConstructXmlScript extends ConstructMapping {
-
- @Override
- public Object construct(Node node) {
- if (node.getType().equals(org.testng.xml.XmlMethodSelector.class)) {
- final XmlScript xmlScript = new XmlScript();
- org.testng.xml.XmlMethodSelector selector = new org.testng.xml.XmlMethodSelector();
- MappingNode mappingNode = ((MappingNode) node);
- List<NodeTuple> tuples = mappingNode.getValue();
- for (NodeTuple tuple : tuples) {
- setValue(tuple, "expression", xmlScript::setExpression);
- setValue(tuple, "language", xmlScript::setLanguage);
- setValue(tuple, "className", selector::setClassName);
- setValue(tuple, "priority", text -> selector.setPriority(Integer.parseInt(text)));
- }
- selector.setScript(xmlScript);
- return selector;
- }
- return super.construct(node);
- }
-
- private void setValue(NodeTuple tuple, String key, Consumer<String> cons) {
- ScalarNode keyNode = (ScalarNode) tuple.getKeyNode();
- ScalarNode valueNode = (ScalarNode) tuple.getValueNode();
- if (keyNode.getValue().equals(key)) {
- String value = constructScalar(valueNode);
- cons.accept(value);
- }
- }
- }
-
- private class ConstructParallelMode extends ConstructScalar {
-
- @Override
- public Object construct(Node node) {
- if (node.getType().equals(XmlSuite.ParallelMode.class)) {
- String parallel = constructScalar((ScalarNode) node);
- return XmlSuite.ParallelMode.getValidParallel(parallel);
- }
- if (node.getType().equals(XmlSuite.FailurePolicy.class)) {
- String failurePolicy = constructScalar((ScalarNode) node);
- return XmlSuite.FailurePolicy.getValidPolicy(failurePolicy);
- }
- return super.construct(node);
- }
- }
- }
-
- private static class XmlClassTypeDescriptor extends TypeDescription {
-
- private final boolean loadClasses;
-
- public XmlClassTypeDescriptor(boolean loadClasses) {
- super(XmlClass.class);
- this.loadClasses = loadClasses;
- }
-
- @Override
- public Object newInstance(Node node) {
- String className;
-
- try {
- java.lang.reflect.Constructor<?> c =
- XmlClass.class.getDeclaredConstructor(String.class, boolean.class);
- c.setAccessible(true);
- if (node instanceof MappingNode) {
- Node valueNode =
- ((MappingNode) node)
- .getValue().stream()
- .filter(
- nodeTuple ->
- ((ScalarNode) nodeTuple.getKeyNode()).getValue().equals("name"))
- .findFirst()
- .orElseThrow(() -> new TestNGException("Node 'name' not found"))
- .getValueNode();
- className = ((ScalarNode) valueNode).getValue();
- } else {
- className = ((ScalarNode) node).getValue();
- }
- return InstanceCreator.newInstance(c, className, loadClasses);
- } catch (Exception e) {
- throw new TestNGException("Failed to instantiate class", e);
- }
- }
- }
-}
=====================================
testng/testng-core/src/main/java/org/testng/internal/YamlParser.java deleted
=====================================
@@ -1,26 +0,0 @@
-package org.testng.internal;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import org.testng.TestNGException;
-import org.testng.xml.ISuiteParser;
-import org.testng.xml.XmlSuite;
-import org.testng.xml.internal.Parser;
-
-public class YamlParser implements ISuiteParser {
-
- @Override
- public XmlSuite parse(String filePath, InputStream is, boolean loadClasses)
- throws TestNGException {
- try {
- return Yaml.parse(filePath, is, loadClasses);
- } catch (FileNotFoundException e) {
- throw new TestNGException(e);
- }
- }
-
- @Override
- public boolean accept(String fileName) {
- return Parser.hasFileScheme(fileName) && fileName.endsWith(".yaml");
- }
-}
=====================================
testng/testng-core/src/main/resources/META-INF/services/org.testng.xml.ISuiteParser deleted
=====================================
@@ -1 +0,0 @@
-org.testng.internal.YamlParser
\ No newline at end of file
=====================================
testng/testng-core/src/test/java/test/yaml/YamlTest.java deleted
=====================================
@@ -1,96 +0,0 @@
-package test.yaml;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Paths;
-import java.util.Collection;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.testng.internal.Yaml;
-import org.testng.internal.YamlParser;
-import org.testng.reporters.Files;
-import org.testng.xml.SuiteXmlParser;
-import org.testng.xml.XmlSuite;
-import org.testng.xml.internal.Parser;
-import test.SimpleBaseTest;
-
-public class YamlTest extends SimpleBaseTest {
- public static final String CLASS_NOT_FOUND_MESSAGE = "Cannot find class in classpath";
-
- @DataProvider
- public Object[][] dp() {
- return new Object[][] {
- new Object[] {"a1"}, new Object[] {"a2"}, new Object[] {"a3"}, new Object[] {"a4"},
- };
- }
-
- @Test(dataProvider = "dp")
- public void compareFiles(String name) throws IOException {
- Collection<XmlSuite> s1 =
- new Parser(getPathToResource("yaml" + File.separator + name + ".yaml")).parse();
- Collection<XmlSuite> s2 =
- new Parser(getPathToResource("yaml" + File.separator + name + ".xml")).parse();
-
- Assert.assertEquals(s1, s2);
- }
-
- @Test(description = "GITHUB-1787")
- public void testParameterInclusion() throws IOException {
- SuiteXmlParser parser = new SuiteXmlParser();
- String file = "src/test/resources/yaml/1787.xml";
- XmlSuite xmlSuite = parser.parse(file, new FileInputStream(file), false);
- StringBuilder yaml = org.testng.internal.Yaml.toYaml(xmlSuite);
- Matcher m = Pattern.compile("parameters:").matcher(yaml.toString());
- int count = 0;
- while (m.find()) {
- count++;
- }
- assertThat(count).isEqualTo(5);
- File newSuite = File.createTempFile("suite", ".xml");
- newSuite.deleteOnExit();
- Files.writeFile(yaml.toString(), newSuite);
- assertThat(parser.parse(newSuite.getAbsolutePath(), new FileInputStream(file), false))
- .isEqualTo(xmlSuite);
- }
-
- @Test(description = "GITHUB-2078")
- public void testXmlDependencyGroups() throws IOException {
- String actualXmlFile = "src/test/resources/yaml/2078.xml";
- XmlSuite actualXmlSuite =
- new SuiteXmlParser().parse(actualXmlFile, new FileInputStream(actualXmlFile), false);
- String expectedYamlFile = "src/test/resources/yaml/2078.yaml";
- String expectedYaml =
- new String(
- java.nio.file.Files.readAllBytes(Paths.get(expectedYamlFile)), StandardCharsets.UTF_8);
- assertThat(Yaml.toYaml(actualXmlSuite).toString()).isEqualToNormalizingNewlines(expectedYaml);
- }
-
- @Test(description = "GITHUB-2689")
- public void testLoadClassesFlag() throws IOException {
- YamlParser yamlParser = new YamlParser();
- String yamlSuiteFile = "src/test/resources/yaml/suiteWithNonExistentTest.yaml";
-
- try {
- yamlParser.parse(yamlSuiteFile, new FileInputStream(yamlSuiteFile), false);
- } catch (Throwable throwable) {
- Throwable rootCause = getRootCause(throwable);
- String rootCauseMessage = rootCause.getMessage();
- if (rootCauseMessage.contains(CLASS_NOT_FOUND_MESSAGE)) {
- throw new AssertionError("TestNG shouldn't attempt to load test class", throwable);
- }
-
- throw new AssertionError("Yaml parser failed to parse suite", throwable);
- }
- }
-
- private Throwable getRootCause(Throwable throwable) {
- return throwable.getCause() != null ? getRootCause(throwable.getCause()) : throwable;
- }
-}
View it on GitLab: https://salsa.debian.org/java-team/jtreg7/-/compare/1907e0b0ff3db53ca59f4e5d751b46a81cdf1b98...6b08fc4da6979825197d4f22dbc5bdb406d4f740
--
View it on GitLab: https://salsa.debian.org/java-team/jtreg7/-/compare/1907e0b0ff3db53ca59f4e5d751b46a81cdf1b98...6b08fc4da6979825197d4f22dbc5bdb406d4f740
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20251030/0ef20236/attachment.htm>
More information about the pkg-java-commits
mailing list