Skip to content

Move TestParallelStreamOperations to its own workload #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<junit class="net.adoptopenjdk.test.lambda.TestLambdaRecursive"/>
<junit class="net.adoptopenjdk.test.lambda.TestLambdasUserDefinedInterface"/>

<!-- Add the Streams tests -->
<junit class="net.adoptopenjdk.test.streams.TestParallelStreamOperations"/>
<!-- Add the Streams tests.
TestParallelStreamOperations runs in the separate workload, parallelStreams.xml -->
<junit class="net.adoptopenjdk.test.streams.TestStreamOperations"/>
</inventory>
</inventory>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<inventory>
<!-- Each instance of TestParallelStreamOperations requires 200Mb or more of Java heap
and terminates if two instances of the test are already running, so run in its own
workload with just two threads.
The test may take over an hour if run in interpreted (-Xint) mode. -->
<junit class="net.adoptopenjdk.test.streams.TestParallelStreamOperations"/>
</inventory>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void execute(StfCoreExtension test) throws StfException {
int cpuCount = Runtime.getRuntime().availableProcessors();

LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
.addJvmOption("-Xss3192K") // TestLambdaRecursive needs a large stack
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.addProjectToClasspath("openjdk.test.lambdasAndStreams");
Expand All @@ -47,7 +48,7 @@ public void execute(StfCoreExtension test) throws StfException {
.setSuiteInventory(inventoryFile); // Point at the file which lists the tests

if (!isTimeBasedLoadTest) {
loadTestInvocation = loadTestInvocation.setSuiteNumTests(200); // Run this many tests
loadTestInvocation = loadTestInvocation.setSuiteNumTests(3000); // Run this many tests
}

loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); // Randomly pick the next test each time
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*******************************************************************************
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

package net.adoptopenjdk.stf;

import net.adoptopenjdk.stf.extensions.core.StfCoreExtension;
import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo;
import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface;
import net.adoptopenjdk.stf.processes.ExpectedOutcome;
import net.adoptopenjdk.stf.processes.definitions.JavaProcessDefinition;
import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition;
import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator;

import java.util.*;

public class ParallelStreamsLoadTest implements StfPluginInterface {
public void help(HelpTextGenerator help) throws StfException {
help.outputSection("ParallelStreamsLoadTest runs junit tests for parallel stream operations");
help.outputText("");
}

public void pluginInit(StfCoreExtension test) throws StfException {
}

public void setUp(StfCoreExtension test) throws StfException {
}

public void execute(StfCoreExtension test) throws StfException {
String inventoryFile = "/openjdk.test.load/config/inventories/lambdasAndStreams/parallelStreams.xml";

LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
.addJvmOption("-Xmx1024M") // Workload test TestParallelStreamOperations requires at least 800Mb heap on openj9 non-compressed refs
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.addProjectToClasspath("openjdk.test.lambdasAndStreams")
.setInactivityLimit("60m") // The test may take a long time to run with -Xint and appear to be hung to the load test harness.
.addSuite("parallelStreams") // Start args for the first suite
.setSuiteThreadCount(2) // The TestParallelStreamOperations test is self limiting to two instances running concurrently
.setSuiteInventory(inventoryFile) // Point at the file which lists the tests
.setSuiteNumTests(2) // Run the TestParallelStreamOperations test once on each of the two threads
.setSuiteSequentialSelection();

test.doRunForegroundProcess("Run parallel streams load test", "LT", Echo.ECHO_ON,
ExpectedOutcome.cleanRun().within("60m"),
loadTestInvocation);
}

public void tearDown(StfCoreExtension test) throws StfException {
}
}