mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-25 09:40:10 +00:00
8377425: Test runtime/os/TestWXHealing.java fails on macosx-aarch64 product build
Reviewed-by: aph, dholmes
This commit is contained in:
parent
3bd4a11180
commit
fac338b03e
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2025 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2026, 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
|
||||
@ -22,31 +23,72 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @test id=TraceWXHealing
|
||||
* @summary Run shell with -XX:+StressWXHealing and -XX:+TraceWXHealing. This tests most of
|
||||
* the triggers for WX mode.
|
||||
* @requires os.family == "mac"
|
||||
* @requires os.arch == "aarch64"
|
||||
* @summary Run shell with -XX:+StressWXHealing. This tests most of
|
||||
* the triggers for WX mode.
|
||||
* @requires vm.debug == true
|
||||
* @library /test/lib
|
||||
* @compile WXHealing.java
|
||||
* @run main TestWXHealing
|
||||
* @build jtreg.SkippedException
|
||||
* @run main TestWXHealing traceWXHealing
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test id=No-TraceWXHealing
|
||||
* @summary Run shell with -XX:+StressWXHealing. This tests most of
|
||||
* the triggers for WX mode.
|
||||
* @requires os.family == "mac"
|
||||
* @requires os.arch == "aarch64"
|
||||
* @library /test/lib
|
||||
* @compile WXHealing.java
|
||||
* @build jtreg.SkippedException
|
||||
* @run main TestWXHealing
|
||||
*/
|
||||
import java.util.regex.*;
|
||||
import jdk.test.lib.process.*;
|
||||
import jtreg.SkippedException;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.*;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
public class TestWXHealing {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
String[] opts = {"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+TraceWXHealing", "-XX:+StressWXHealing", "WXHealing"};
|
||||
String[] opts;
|
||||
boolean traceWXHealing = args.length > 0 && args[0].equals("traceWXHealing");
|
||||
// pass -XX:+TraceWXHealing only when instructed to do so
|
||||
if (traceWXHealing) {
|
||||
opts = new String[]{
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+TraceWXHealing",
|
||||
"-XX:+StressWXHealing",
|
||||
"WXHealing"
|
||||
};
|
||||
} else {
|
||||
opts = new String[]{
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+StressWXHealing",
|
||||
"WXHealing"
|
||||
};
|
||||
}
|
||||
var process = ProcessTools.createTestJavaProcessBuilder(opts).start();
|
||||
String output = new String(process.getInputStream().readAllBytes(), UTF_8);
|
||||
System.out.println(output);
|
||||
OutputAnalyzer oa = new OutputAnalyzer(process, UTF_8);
|
||||
oa.shouldHaveExitValue(0);
|
||||
String output = oa.getStdout();
|
||||
System.out.println("output from WXHealing application: " + output);
|
||||
if (output.isEmpty()) {
|
||||
throw new RuntimeException("no output generated by WXHealing application");
|
||||
}
|
||||
if (!traceWXHealing) {
|
||||
// if -XX:+TraceWXHealing wasn't enabled, then this test merely
|
||||
// verifies that the java application launched with -XX:+StressWXHealing
|
||||
// exited normally.
|
||||
return;
|
||||
}
|
||||
// verify the output generated by -XX:+TraceWXHealing
|
||||
if (output.contains("MAP_JIT write protection does not work on this system")) {
|
||||
System.out.println("Test was not run because MAP_JIT write protection does not work on this system");
|
||||
throw new SkippedException("Test was not run because MAP_JIT write protection does not work on this system");
|
||||
} else {
|
||||
var pattern = Pattern.compile("Healing WXMode WXArmedForWrite at 0x[0-9a-f]* to WXWrite ");
|
||||
var matches = pattern.matcher(output).results().count();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user