Compare commits

...

6 Commits

Author SHA1 Message Date
Vitaly Provodin
55ac9d53e3 exclude javax/swing/JToolBar/4529206/bug4529206.java due to 8288707 on linux 2022-06-19 07:12:40 +07:00
Vitaly Provodin
66f71949b3 fixup! JBR-4567 fix checking test status 2022-06-18 06:45:00 +07:00
Vitaly Provodin
8e7e3f76a7 fixup! JBR-4567 replace comma with point in RenderPerf scores 2022-06-18 06:44:56 +07:00
Maxim Kartashev
62f8abdea8 JBR-4562 Generate hs_err file on SIGABRT
The generation can be switched off with the env var JVM_NO_SIGABRT.
2022-06-16 13:19:48 +03:00
Maxim Kartashev
2fc6a7d38b JBR-3101 Exception in NSApplicationAWT: java.lang.NullPointerException at java.desktop/sun.lwawt.macosx.CPlatformComponent.setBounds
CWarningWindow doesn't have a peer, so accomodated for that in
CPlatformComponent.setBounds().
2022-06-16 12:25:09 +03:00
Vitaly Provodin
004cba3473 JBR-4570 improve synchronization and increase waiting time 2022-06-16 15:42:45 +07:00
7 changed files with 131 additions and 14 deletions

View File

@@ -62,9 +62,9 @@ fi
testContent=`echo "$testContent" | tr "," "." | awk -F'\t' '{
if ($3>$2+$2*0.1) {
print "* "$1"\t"$2"\t"$3"\t"(($2>0)?$3+$2:"-")
print "* "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
} else {
print " "$1"\t"$2"\t"$3"\t"(($2>0)?$3+$2:"-")
print " "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
}
}'`
if [ -z $noHeaders ]; then
@@ -77,12 +77,12 @@ if [ -z $tc ]; then
exit 0
fi
failed=1
failed=0
echo "$testContent" 2>&1 | (
while read -r s; do
testname=`echo "$s" | cut -f 1 | tr -d "[:space:]" | tr -d "*"`
duration=`echo "$s" | cut -f 3`
echo "$s" | cut -c1 | grep -c "*" && failed=0
echo "$s" | cut -c1 | grep -c "*" && failed=1
echo \#\#teamcity[testStarted name=\'$testNamePrefix$testname\']
echo "===>$s"
echo \#\#teamcity[buildStatisticValue key=\'$testNamePrefix$testname\' value=\'$duration\']

View File

@@ -567,6 +567,12 @@ int JVM_HANDLE_XXX_SIGNAL(int sig, siginfo_t* info,
return true; // ignore it
}
if (sig == SIGABRT) {
// Re-set the handler so that we don't recurse if/when abort() is called
// from here.
os::signal(SIGABRT, (void*)SIG_DFL);
}
// Note: it's not uncommon that JNI code uses signal/sigset to install,
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
@@ -1290,6 +1296,9 @@ void install_signal_handlers() {
// check because late initialization will overwrite it to UserHandler.
set_signal_handler(BREAK_SIGNAL, false);
}
if (CatchSIGABRT) {
set_signal_handler(SIGABRT);
}
#if defined(__APPLE__)
// lldb (gdb) installs both standard BSD signal handlers, and mach exception
// handlers. By replacing the existing task exception handler, we disable lldb's mach

View File

@@ -2099,8 +2099,10 @@ const intx ObjectAlignmentInBytes = 8;
"core: core HA. Use integrated hotswap-agent-core.jar" \
"external: external HA. use external HA, open required JDK " \
"modules.") \
constraint(HotswapAgentConstraintFunc, AfterErgo)
constraint(HotswapAgentConstraintFunc, AfterErgo) \
\
product(bool, CatchSIGABRT, false, \
"Handle SIGABRT and generate hs_err file (Unix only) ")
// end of RUNTIME_FLAGS

View File

@@ -30,6 +30,7 @@ import java.awt.Insets;
import sun.lwawt.PlatformComponent;
import sun.lwawt.PlatformWindow;
import sun.lwawt.LWWindowPeer;
/**
* On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
@@ -63,7 +64,8 @@ class CPlatformComponent extends CFRetainedResource
public void setBounds(final int x, final int y, final int w, final int h) {
// translates values from the coordinate system of the top-level window
// to the coordinate system of the content view
final Insets insets = platformWindow.getPeer().getInsets();
final LWWindowPeer peer = platformWindow.getPeer();
final Insets insets = (peer != null) ? peer.getInsets() : new Insets(0, 0, 0, 0);
execute(ptr->nativeSetBounds(ptr, x - insets.left, y - insets.top, w, h));
}

View File

@@ -0,0 +1,99 @@
/*
* Copyright 2022 JetBrains s.r.o.
*
* Licensed 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.
*/
/**
* @test
* @requires (os.family == "mac" | os.family == "linux")
* @summary Verifies that double-free causes hs_err file to be generated
* (it is implied that the underlying malloc() is capable of
* detecting this and will abort() in that case).
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run main AbortHandler
*/
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import java.util.ArrayList;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.nio.file.Files;
public class AbortHandler {
static final String MARKER_TEXT = "SHOULD NOT REACH HERE";
static final String HS_ERR_FILE_NAME = "hs_err.txt";
static final Unsafe unsafe = Unsafe.getUnsafe();
public static void main(String args[]) throws Exception {
if (args.length > 0 && args[0].equals("--test")) {
final long addr = unsafe.allocateMemory(42);
unsafe.freeMemory(addr);
unsafe.freeMemory(addr);
unsafe.freeMemory(addr);
unsafe.freeMemory(addr);
System.out.println(MARKER_TEXT); // not supposed to get here if libc detected double-free
} else {
verifyErrorFileNotCreated(); // with default options
verifyErrorFileCreated(); // with the option that enables SIGABRT to be caught
}
}
public static void verifyErrorFileNotCreated() throws Exception {
ArrayList<String> opts = new ArrayList<>();
opts.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
opts.add("-XX:-CreateCoredumpOnCrash");
// opts.add("-XX:+CatchSIGABRT"); // By default, SIGABRT shouldn't generate hs_err
opts.add("AbortHandler");
opts.add("--test");
ProcessBuilder pb = ProcessTools.createTestJvm(opts);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
final String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
if (hs_err_file != null) {
throw new RuntimeException("hs_err_pid file generated with default options");
}
}
public static void verifyErrorFileCreated() throws Exception {
ArrayList<String> opts = new ArrayList<>();
opts.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
opts.add("-XX:-CreateCoredumpOnCrash");
opts.add("-XX:+CatchSIGABRT");
opts.add("AbortHandler");
opts.add("--test");
ProcessBuilder pb = ProcessTools.createTestJvm(opts);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain(MARKER_TEXT);
final String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
if (hs_err_file == null) {
throw new RuntimeException("Did not find hs_err_pid file in output");
}
final Path hsErrPath = Paths.get(hs_err_file);
if (!Files.exists(hsErrPath)) {
throw new RuntimeException("hs_err_pid file missing at " + hsErrPath + ".\n");
}
System.out.println(hs_err_file + " was created");
}
}

View File

@@ -21,6 +21,8 @@ import java.awt.Desktop;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* @test
@@ -33,7 +35,10 @@ import java.awt.event.KeyEvent;
*/
public class AboutHandlerTest {
private static final int WAIT_TIME = 1000;
private static CountDownLatch doneSignal = new CountDownLatch(1);
private static final int WAIT_TIME = 3000;
private static Robot robot;
@@ -45,9 +50,11 @@ public class AboutHandlerTest {
robot = new Robot();
robot.setAutoDelay(50);
long starttime = System.currentTimeMillis();
Desktop.getDesktop().setAboutHandler(e -> {
System.out.println("AboutHandler hits");
testPassed = true;
doneSignal.countDown();
});
SwingUtilities.invokeLater(() -> {
@@ -55,8 +62,9 @@ public class AboutHandlerTest {
});
// waiting for AboutHandler
sleep(WAIT_TIME);
doneSignal.await(WAIT_TIME, TimeUnit.SECONDS);
long endtime = System.currentTimeMillis();
System.out.println("Duration (milisec): " + (endtime - starttime));
myApp.dispose();
if (!testPassed)
@@ -85,8 +93,4 @@ public class AboutHandlerTest {
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
private static void sleep(int millis) throws InterruptedException {
Thread.sleep(millis);
}
}

View File

@@ -762,6 +762,7 @@ javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
javax/swing/JSplitPane/4885629/bug4885629.java 8019935 macosx-all
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922,8197552 macosx-all,windows-all 8064922:macosx-all, 8197552:windows-all
javax/swing/JToolBar/4529206/bug4529206.java 8288707 linux-x64
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java 8194048 windows-all
javax/swing/text/DefaultCaret/HidingSelection/MultiSelectionTest.java 8213562 linux-all