mirror of https://github.com/apache/lucene.git
An improved check for ignoring the c2-crash test if running on a client compiler. (#12953)
This commit is contained in:
parent
f6582ce048
commit
6bb244a932
|
@ -60,9 +60,6 @@ grant {
|
|||
permission java.lang.RuntimePermission "getFileStoreAttributes";
|
||||
permission java.lang.RuntimePermission "writeFileDescriptor";
|
||||
|
||||
// needed to check if C2 (implied by the presence of the CI env) is enabled
|
||||
permission java.lang.RuntimePermission "getenv.CI";
|
||||
|
||||
// TestLockFactoriesMultiJVM opens a random port on 127.0.0.1 (port 0 = ephemeral port range):
|
||||
permission java.net.SocketPermission "127.0.0.1:0", "accept,listen,resolve";
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package org.apache.lucene.util.bkd;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -34,7 +32,7 @@ import org.apache.lucene.store.IndexOutput;
|
|||
import org.apache.lucene.tests.util.LuceneTestCase;
|
||||
import org.apache.lucene.tests.util.TestUtil;
|
||||
import org.apache.lucene.util.CollectionUtil;
|
||||
import org.apache.lucene.util.SuppressForbidden;
|
||||
import org.apache.lucene.util.Constants;
|
||||
|
||||
public class TestDocIdsWriter extends LuceneTestCase {
|
||||
|
||||
|
@ -159,10 +157,12 @@ public class TestDocIdsWriter extends LuceneTestCase {
|
|||
}
|
||||
|
||||
// This simple test tickles a JVM C2 JIT crash on JDK's less than 21.0.1
|
||||
// Crashes only when run with C2, so with the environment variable `CI` set
|
||||
// Crashes only when run with HotSpot C2.
|
||||
// Regardless of whether C2 is enabled or not, the test should never fail.
|
||||
public void testCrash() throws IOException {
|
||||
assumeTrue("Requires C2, which is only enabled when CI env is set", getCIEnv() != null);
|
||||
assumeTrue(
|
||||
"Requires HotSpot C2 compiler (won't work on client VM).",
|
||||
Constants.IS_HOTSPOT_VM && !Constants.IS_CLIENT_VM);
|
||||
int itrs = atLeast(100);
|
||||
for (int i = 0; i < itrs; i++) {
|
||||
try (Directory dir = newDirectory();
|
||||
|
@ -174,11 +174,4 @@ public class TestDocIdsWriter extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "needed to check if C2 is enabled")
|
||||
@SuppressWarnings("removal")
|
||||
private static String getCIEnv() {
|
||||
PrivilegedAction<String> pa = () -> System.getenv("CI");
|
||||
return AccessController.doPrivileged(pa);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue