Skip to content

Commit

Permalink
Backport 11e926cf50c64d57b0dba095eb62c2be4a8a8f1e
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Sep 20, 2024
1 parent f18cde4 commit 353dd2d
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions test/hotspot/jtreg/applications/jcstress/JcstressRunner.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
Expand Down Expand Up @@ -42,14 +42,14 @@
* jcstress tests wrapper
*/
@Artifact(organization = "org.openjdk.jcstress", name = "jcstress-tests-all",
revision = "0.16", extension = "jar", unpack = false)
revision = JcstressRunner.VERSION, extension = "jar", unpack = false)
public class JcstressRunner {

public static final String VERSION = "0.17-SNAPSHOT-20240328";
public static final String MAIN_CLASS = "org.openjdk.jcstress.Main";

// Allow to configure jcstress mode parameter.
// Test mode preset: sanity, quick, default, tough, stress.
public static final String MODE_PROPERTY = "jcstress.mode";
public static final String TIME_BUDGET_PROPERTY = "jcstress.time_budget";
public static String timeBudget = "6m";

public static Path pathToArtifact() {
Map<String, Path> artifacts;
Expand All @@ -59,7 +59,7 @@ public static Path pathToArtifact() {
throw new Error("TESTBUG: Can not resolve artifacts for "
+ JcstressRunner.class.getName(), e);
}
return artifacts.get("org.openjdk.jcstress.jcstress-tests-all-0.16")
return artifacts.get("org.openjdk.jcstress.jcstress-tests-all-" + VERSION)
.toAbsolutePath();
}

Expand Down Expand Up @@ -109,21 +109,17 @@ private static String[] getCmd(String[] args) {
extraFlags.add("--jvmArgs");
extraFlags.add("-Djava.io.tmpdir=" + System.getProperty("user.dir"));

// The "default" preset might take days for some tests
// so use quick testing by default.
String mode = "quick";
for (String jvmArg : Utils.getTestJavaOpts()) {
if(jvmArg.startsWith("-D" + MODE_PROPERTY)) {
String[] pair = jvmArg.split("=", 2);
mode = pair[1];
continue;
if (jvmArg.startsWith("-D" + TIME_BUDGET_PROPERTY)) {
timeBudget = jvmArg.split("=", 2)[1];
} else {
extraFlags.add("--jvmArgs");
extraFlags.add(jvmArg);
}
extraFlags.add("--jvmArgs");
extraFlags.add(jvmArg);
}

extraFlags.add("-m");
extraFlags.add(mode);
extraFlags.add("-tb");
extraFlags.add(timeBudget);

extraFlags.add("-sc");
extraFlags.add("false");
Expand Down

0 comments on commit 353dd2d

Please sign in to comment.