Skip to content

Commit

Permalink
8305962: update jcstress to 0.16
Browse files Browse the repository at this point in the history
Backport-of: 292ee630ae32c3b50363b10ffa6090e57ffef1e8
  • Loading branch information
shipilev committed Feb 28, 2024
1 parent f2565a6 commit 61164ce
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 5 deletions.
28 changes: 25 additions & 3 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, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, 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,11 +42,15 @@
* jcstress tests wrapper
*/
@Artifact(organization = "org.openjdk.jcstress", name = "jcstress-tests-all",
revision = "0.5", extension = "jar", unpack = false)
revision = "0.16", extension = "jar", unpack = false)
public class JcstressRunner {

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 Path pathToArtifact() {
Map<String, Path> artifacts;
try {
Expand All @@ -55,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.5")
return artifacts.get("org.openjdk.jcstress.jcstress-tests-all-0.16")
.toAbsolutePath();
}

Expand Down Expand Up @@ -104,11 +108,29 @@ 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;
}
extraFlags.add("--jvmArgs");
extraFlags.add(jvmArg);
}

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

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

extraFlags.add("-af");
extraFlags.add("GLOBAL");

String[] result = new String[extraFlags.size() + args.length];
extraFlags.toArray(result);
System.arraycopy(args, 0, result, extraFlags.size(), args.length);
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/applications/jcstress/TestGenerator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, 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 @@ -122,7 +122,7 @@ public static void main(String[] args) throws IOException {
BufferedReader reader = Files.newBufferedReader(output);

reader.lines()
.skip(4) // skip first 4 lines: name, -{80}, revision and empty line
.filter(s -> s.startsWith("org.openjdk.jcstress.tests"))
.map(s -> s.split("\\.")[4]) // group by the package name following "org.openjdk.jcstress.tests."
.distinct()
.filter(s -> !s.startsWith("sample")) // skip sample test
Expand Down
31 changes: 31 additions & 0 deletions test/hotspot/jtreg/applications/jcstress/collections.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */

/**
* @test collections
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.collections\.
*/

31 changes: 31 additions & 0 deletions test/hotspot/jtreg/applications/jcstress/mxbeans.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */

/**
* @test mxbeans
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.mxbeans\.
*/

31 changes: 31 additions & 0 deletions test/hotspot/jtreg/applications/jcstress/oota.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */

/**
* @test oota
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.oota\.
*/

1 comment on commit 61164ce

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.