diff --git a/test/one/profiler/test/TestProcess.java b/test/one/profiler/test/TestProcess.java index a505673f0..6b004ee93 100644 --- a/test/one/profiler/test/TestProcess.java +++ b/test/one/profiler/test/TestProcess.java @@ -31,8 +31,6 @@ public class TestProcess implements Closeable { public static final String PROFOUT = "%pout"; public static final String PROFERR = "%perr"; - public static final String PROFILER_LIB_NAME = "libasyncProfiler"; - private static final Pattern filePattern = Pattern.compile("(%[a-z]+)(\\.[a-z]+)?"); private static final MethodHandle pid = getPidHandle(); @@ -94,7 +92,7 @@ public Os currentOs() { } public String profilerLibPath() { - return "build/lib/" + PROFILER_LIB_NAME + "." + currentOs.getLibExt(); + return "build/lib/libasyncProfiler." + currentOs.getLibExt(); } private List buildCommandLine(Test test, Os currentOs) { diff --git a/test/test/alloc/AllocTests.java b/test/test/alloc/AllocTests.java index 1183efa4c..fb51ffa00 100644 --- a/test/test/alloc/AllocTests.java +++ b/test/test/alloc/AllocTests.java @@ -13,7 +13,7 @@ import java.io.File; import java.nio.file.Files; -import java.nio.file.Path; +import java.nio.file.Paths; import java.nio.file.StandardCopyOption; public class AllocTests { @@ -66,9 +66,9 @@ public void objectSamplerWtihDifferentAsprofs(TestProcess p) throws Exception { Output out = p.profile("-e alloc -d 3 -o collapsed"); // _[k] suffix in collapsed output corresponds to jdk.ObjectAllocationOutsideTLAB, which means alloc tracer is being used assert !out.contains("_\\[k\\]"); // we are using alloc tracer instead of object sampler, should definitely not happen on first profiling call - File asprofCopy = File.createTempFile(TestProcess.PROFILER_LIB_NAME, p.currentOs().getLibExt()); + File asprofCopy = File.createTempFile(new File(p.profilerLibPath()).getName(), null); asprofCopy.deleteOnExit(); - Files.copy(Path.of(p.profilerLibPath()), asprofCopy.toPath(), StandardCopyOption.REPLACE_EXISTING); + Files.copy(Paths.get(p.profilerLibPath()), asprofCopy.toPath(), StandardCopyOption.REPLACE_EXISTING); Output outWithCopy = p.profile(String.format("--libpath %s -e alloc -d 3 -o collapsed", asprofCopy.getAbsolutePath())); assert !outWithCopy.contains("_\\[k\\]"); // first instance of profiler has not properly relinquished the can_generate_sampled_object_alloc_events capability. } diff --git a/test/test/lock/LockTests.java b/test/test/lock/LockTests.java index ae6152ebf..f3b231ac6 100644 --- a/test/test/lock/LockTests.java +++ b/test/test/lock/LockTests.java @@ -11,6 +11,7 @@ import one.profiler.test.TestProcess; public class LockTests { + @Test(mainClass = DatagramTest.class, debugNonSafepoints = true) // Fails on Alpine public void datagramSocketLock(TestProcess p) throws Exception { Output out = p.profile("-e cpu -d 3 -o collapsed --cstack dwarf"); @@ -20,9 +21,9 @@ public void datagramSocketLock(TestProcess p) throws Exception { assert out.samples("sun/nio/ch/DatagramChannelImpl.send") > 10; } - @Test(mainClass = RaceToLock.class, inputs = { "0" }, output = true) - @Test(mainClass = RaceToLock.class, inputs = { "10000" }, output = true) - @Test(mainClass = RaceToLock.class, inputs = { "1000000" }, output = true) + @Test(mainClass = RaceToLock.class, inputs = "0", output = true) + @Test(mainClass = RaceToLock.class, inputs = "10000", output = true) + @Test(mainClass = RaceToLock.class, inputs = "1000000", output = true) public void raceToLocks(TestProcess p) throws Exception { int interval = Integer.parseInt(p.inputs()[0]); diff --git a/test/test/lock/RaceToLock.java b/test/test/lock/RaceToLock.java index 17872852d..6e1fe220a 100644 --- a/test/test/lock/RaceToLock.java +++ b/test/test/lock/RaceToLock.java @@ -8,14 +8,11 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.LockSupport; -import java.util.ArrayList; -import java.util.List; import java.util.Random; public class RaceToLock { private final Lock sharedLock = new ReentrantLock(true); - private final Object sharedObj = new Object(); private long sharedWaitTime = 0; private final Random random = new Random();