mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8370846: Support execution of mlvm testing with test thread factory
Reviewed-by: cjplummer
This commit is contained in:
parent
be8cbfa612
commit
2596608ba1
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import jdk.test.lib.thread.TestThreadFactory;
|
||||||
import nsk.share.jdi.Binder;
|
import nsk.share.jdi.Binder;
|
||||||
import nsk.share.jdi.Debugee;
|
import nsk.share.jdi.Debugee;
|
||||||
import vm.mlvm.share.Env;
|
import vm.mlvm.share.Env;
|
||||||
@ -437,10 +438,22 @@ public abstract class JDIBreakpointTest extends MlvmTest {
|
|||||||
for (StackFrame f : frames) {
|
for (StackFrame f : frames) {
|
||||||
Location l = f.location();
|
Location l = f.location();
|
||||||
|
|
||||||
|
String sourcePath;
|
||||||
|
try {
|
||||||
|
sourcePath = l.sourcePath();
|
||||||
|
} catch (AbsentInformationException aie) {
|
||||||
|
// Test Thread Factory support has generated methods in MainWrapper class.
|
||||||
|
if (TestThreadFactory.isTestThreadFactorySet()) {
|
||||||
|
sourcePath = "unknown";
|
||||||
|
} else {
|
||||||
|
throw aie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buf.append(String.format("#%-4d", frameNum))
|
buf.append(String.format("#%-4d", frameNum))
|
||||||
.append(l.method())
|
.append(l.method())
|
||||||
.append("\n source: ")
|
.append("\n source: ")
|
||||||
.append(l.sourcePath())
|
.append(sourcePath)
|
||||||
.append(":")
|
.append(":")
|
||||||
.append(l.lineNumber())
|
.append(l.lineNumber())
|
||||||
.append("; bci=")
|
.append("; bci=")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -32,8 +32,27 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
|
|
||||||
public class TestThreadFactory {
|
public class TestThreadFactory {
|
||||||
|
|
||||||
private static ThreadFactory threadFactory = "Virtual".equals(System.getProperty("test.thread.factory"))
|
public enum TestThreadFactoryType {
|
||||||
? virtualThreadFactory() : platformThreadFactory();
|
NONE, VIRTUAL
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static TestThreadFactoryType testThreadFactoryType =
|
||||||
|
"Virtual".equals(System.getProperty("test.thread.factory"))
|
||||||
|
? TestThreadFactoryType.VIRTUAL
|
||||||
|
: TestThreadFactoryType.NONE;
|
||||||
|
|
||||||
|
private final static ThreadFactory threadFactory =
|
||||||
|
testThreadFactoryType == TestThreadFactoryType.VIRTUAL
|
||||||
|
? virtualThreadFactory()
|
||||||
|
: platformThreadFactory();
|
||||||
|
|
||||||
|
public static TestThreadFactoryType testThreadFactoryType() {
|
||||||
|
return testThreadFactoryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isTestThreadFactorySet() {
|
||||||
|
return !testThreadFactoryType.equals(TestThreadFactoryType.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
public static Thread newThread(Runnable task) {
|
public static Thread newThread(Runnable task) {
|
||||||
return threadFactory.newThread(task);
|
return threadFactory.newThread(task);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user