From 3eea79b0b75401d2d57b0f7c53f4151bb3cb547d Mon Sep 17 00:00:00 2001 From: "Mesbah_Alam@ca.ibm.com" Date: Thu, 21 Jan 2021 15:59:51 -0500 Subject: [PATCH] Add time-based execution mechanism in STF load tests Signed-off-by: Mesbah_Alam@ca.ibm.com --- openjdk.build/makefile | 8 +-- .../stf/ClassloadingLoadTest.java | 37 ++++++------ .../adoptopenjdk/stf/ConcurrentLoadTest.java | 39 ++++++------ .../stf/DirectByteBufferLoadTest.java | 35 +++++------ .../net/adoptopenjdk/stf/LambdaLoadTest.java | 37 ++++++------ .../net/adoptopenjdk/stf/LangLoadTest.java | 36 +++++------ .../net/adoptopenjdk/stf/MathLoadTest.java | 52 +++++++++------- .../adoptopenjdk/stf/MauveMultiThrdLoad.java | 34 +++++------ .../stf/MauveMultiThrdLoadTrc.java | 35 +++++------ .../stf/MauveSingleInvocLoad.java | 36 +++++------ .../adoptopenjdk/stf/MauveSingleThrdLoad.java | 36 +++++------ .../stf/MauveSingleThrdLoadTrc.java | 34 +++++------ .../net/adoptopenjdk/stf/MixedLoadTest.java | 59 ++++--------------- .../net/adoptopenjdk/stf/NioLoadTest.java | 37 ++++++------ .../stf/SerializationLoadTest.java | 38 ++++++------ .../net/adoptopenjdk/stf/UtilLoadTest.java | 36 +++++------ 16 files changed, 280 insertions(+), 309 deletions(-) diff --git a/openjdk.build/makefile b/openjdk.build/makefile index 8931e2c7..15878c8a 100644 --- a/openjdk.build/makefile +++ b/openjdk.build/makefile @@ -591,7 +591,7 @@ test.LockingLoadTest: echo Target $@ completed test.MathLoadTest_all: echo Running target $@ - $(STF_COMMAND) -test=MathLoadTest $(LOG) + $(STF_COMMAND) -test=MathLoadTest -test-args="workload=math" $(LOG) echo Target $@ completed test.MathLoadTest_autosimd: echo Running target $@ @@ -603,15 +603,15 @@ test.MathLoadTest_bigdecimal: echo Target $@ completed test.MauveSingleThreadLoadTest: echo Running target $@ - $(STF_COMMAND) -test=MauveSingleThreadLoadTest $(LOG) + $(STF_COMMAND) -test=MauveSingleThrdLoad $(LOG) echo Target $@ completed test.MauveSingleInvocationLoadTest: echo Running target $@ - $(STF_COMMAND) -test=MauveSingleInvocationLoadTest $(LOG) + $(STF_COMMAND) -test=MauveSingleInvocLoad $(LOG) echo Target $@ completed test.MauveMultiThreadLoadTest: echo Running target $@ - $(STF_COMMAND) -test=MauveMultiThreadLoadTest $(LOG) + $(STF_COMMAND) -test=MauveMultiThrdLoad $(LOG) echo Target $@ completed test.NioLoadTest: echo Running target $@ diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ClassloadingLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ClassloadingLoadTest.java index b18c648f..25eca8f4 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ClassloadingLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ClassloadingLoadTest.java @@ -17,11 +17,10 @@ import java.util.ArrayList; import net.adoptopenjdk.loadTest.InventoryData; -import net.adoptopenjdk.stf.codeGeneration.Stage; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.DirectoryRef; 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; @@ -31,7 +30,7 @@ * This is a simple test plugin that runs a workload of tests * from the test.classloading project. */ -public class ClassloadingLoadTest implements StfPluginInterface { +public class ClassloadingLoadTest extends TimeBasedLoadTest { private int testCountMultiplier = 3000; private boolean specialTest = false; @@ -42,12 +41,6 @@ public void help(HelpTextGenerator help) throws StfException { + "from the test.classloading project."); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { String jvmOptionsInUse = test.getJavaArgs(test.env().primaryJvm()); @@ -88,19 +81,25 @@ public void execute(StfCoreExtension test) throws StfException { .addModules(modulesAdd) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.classloading") - .setAbortIfOutOfMemory(false) + .addProjectToClasspath("openjdk.test.classloading"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("classloading") .setSuiteThreadCount(cpuCount - 1, 10) - .setSuiteInventory(inventoryFile) - .setSuiteNumTests(totalTests * testCountMultiplier) - .setSuiteRandomSelection(); + .setSuiteInventory(inventoryFile); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * testCountMultiplier); + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); test.doRunForegroundProcess("Run classloading tests", "CLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("2h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ConcurrentLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ConcurrentLoadTest.java index 2813af54..2e6cb77b 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ConcurrentLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/ConcurrentLoadTest.java @@ -14,27 +14,21 @@ package net.adoptopenjdk.stf; +import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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 net.adoptopenjdk.loadTest.InventoryData; -public class ConcurrentLoadTest implements StfPluginInterface { +public class ConcurrentLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("ConcurrentLoadTest runs concurrency unit tests"); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { String inventoryFile = "/openjdk.test.load/config/inventories/concurrent/concurrent.xml"; int totalTests = InventoryData.getNumberOfTests(test, inventoryFile); @@ -43,20 +37,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.concurrent") - .setAbortIfOutOfMemory(false) + .addProjectToClasspath("openjdk.test.concurrent"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("concurrent") .setSuiteThreadCount(cpuCount - 2, 20) // Leave 1 cpu for the JIT. i for GC and set min 20 - .setSuiteInventory(inventoryFile) // Point at the file which lists the tests - .setSuiteNumTests(totalTests * 20) // Run for about 2 minutes with no -X options - .setSuiteRandomSelection(); // Randomly pick the next test each time + .setSuiteInventory(inventoryFile); // Point at the file which lists the tests + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * 20); // Run for about 2 minutes with no -X options + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); // Randomly pick the next test each time - //.setSuiteNumTests(totalTests * 50) // Run for about 5 minutes test.doRunForegroundProcess("Run concurrency unit tests", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("1h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/DirectByteBufferLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/DirectByteBufferLoadTest.java index b199b5c0..bcdc382f 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/DirectByteBufferLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/DirectByteBufferLoadTest.java @@ -14,10 +14,10 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.FileRef; 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; @@ -29,7 +29,7 @@ * * The DirectMemoryTest allocates direct memory ByteBuffers and dereferences them. */ -public class DirectByteBufferLoadTest implements StfPluginInterface { +public class DirectByteBufferLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { String testName = DirectByteBufferLoadTest.class.getSimpleName(); @@ -38,12 +38,6 @@ public void help(HelpTextGenerator help) throws StfException { help.outputText("This test is primarily aimed at stressing the Garbage Collector."); } - public void pluginInit(StfCoreExtension test) throws StfException { - } - - public void setUp(StfCoreExtension test) throws Exception { - } - public void execute(StfCoreExtension test) throws StfException { // The NIO workload has a dependency on filesystem.jar FileRef filesystemJar = test.env().findTestFile("openjdk.test.nio/bin/lib/filesystem.jar"); @@ -58,19 +52,26 @@ public void execute(StfCoreExtension test) throws StfException { .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) .addJarToClasspath(filesystemJar) .addProjectToClasspath("openjdk.test.gc") - .addProjectToClasspath("openjdk.test.nio") - .addSuite("DirectByteBuffer") + .addProjectToClasspath("openjdk.test.nio"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("DirectByteBuffer") .setSuiteThinkingTime("1ms", "1ms")// Waiting for 1ms between tests to give the system a chance to reclaim unused native memory. - .setSuiteThreadCount(cpuCount - 1, 2) - .setSuiteNumTests(numTests) - .setSuiteInventory(inventory) + .setSuiteThreadCount(cpuCount - 1, 2); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numTests); + } + + loadTestInvocation = loadTestInvocation.setSuiteInventory(inventory) .setSuiteRandomSelection(); test.doRunForegroundProcess("Run DirectByteBuffer load test", "DBLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("5m"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension test) throws StfException { - } } + diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LambdaLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LambdaLoadTest.java index f15fa28d..90cf0e19 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LambdaLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LambdaLoadTest.java @@ -14,26 +14,20 @@ package net.adoptopenjdk.stf; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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; -public class LambdaLoadTest implements StfPluginInterface { +public class LambdaLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("LambdaLoadTest runs unit tests for Lambda and Streams"); 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/lambda.xml"; int cpuCount = Runtime.getRuntime().availableProcessors(); @@ -41,20 +35,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.lambdasAndStreams") - .setInactivityLimit("60m") // Since this test is run using -Xint as well, set a larger inactivity limit than default + .addProjectToClasspath("openjdk.test.lambdasAndStreams"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setInactivityLimit("60m") // Since this test is run using -Xint as well, set a larger inactivity limit than default .addSuite("lambda") // Start args for the first suite .setSuiteThreadCount(cpuCount - 2, 2) // Leave 1 cpu for the JIT, 1 cpu for GC and set min 2 - .setSuiteInventory(inventoryFile) // Point at the file which lists the tests - .setSuiteNumTests(200) // Run this many tests - .setSuiteRandomSelection(); // Randomly pick the next test each time - + .setSuiteInventory(inventoryFile); // Point at the file which lists the tests + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(200); // Run this many tests + } + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); // Randomly pick the next test each time + test.doRunForegroundProcess("Run lambda and stream load test", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("60m"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension test) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LangLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LangLoadTest.java index d00bb80a..99568200 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LangLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/LangLoadTest.java @@ -15,9 +15,9 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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; @@ -27,18 +27,12 @@ * This is a test plugin for Java.lang related tests, it runs a workload of * invoke tests and project coin tests. */ -public class LangLoadTest implements StfPluginInterface { +public class LangLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("LangLoadTest runs a workload of Java.lang related tests."); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { String inventoryFile = "/openjdk.test.load/config/inventories/lang/lang.xml"; int numlangTests = InventoryData.getNumberOfTests(test, inventoryFile); @@ -47,18 +41,24 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.lang") - .addSuite("lang") - .setSuiteThreadCount(cpuCount - 1, 2) - .setSuiteNumTests(numlangTests * 100) - .setSuiteInventory(inventoryFile) + .addProjectToClasspath("openjdk.test.lang"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("lang") + .setSuiteThreadCount(cpuCount - 1, 2); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numlangTests * 100); + } + + loadTestInvocation = loadTestInvocation.setSuiteInventory(inventoryFile) .setSuiteRandomSelection(); test.doRunForegroundProcess("Run lang load test", "LLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("10m"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MathLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MathLoadTest.java index b469f61f..566adfd5 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MathLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MathLoadTest.java @@ -17,23 +17,23 @@ import java.util.Arrays; import net.adoptopenjdk.loadTest.InventoryData; -import net.adoptopenjdk.stf.environment.StfTestArguments; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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 net.adoptopenjdk.stf.util.TimeParser; /** * This is a test plugin for Math related tests, it runs workloads of BigDecimal * JUnit tests and AutoSIMD tests in random order. */ -public class MathLoadTest implements StfPluginInterface { +public class MathLoadTest extends TimeBasedLoadTest { private enum Workloads { //Workload Multiplier Timeout InventoryFile - math( 50, "2h", "math.xml"), + math( 50, "2h", "math.xml"), bigDecimal( 50, "1h", "bigdecimal.xml"), autoSimd( 4000, "5m", "autosimd.xml"); @@ -51,7 +51,7 @@ private Workloads(int multiplier, String timeout, String inventoryFile) { // This workload is calibrated for slow running load tests executed under special JIT modes such as -Xjit:count=0 private enum WorkloadsSpecial { //Workload Multiplier Timeout InventoryFile - math( 2, "1h", "math.xml"), + math( 2, "1h", "math.xml"), bigDecimal( 15, "1h", "bigdecimal.xml"), autoSimd( 4000, "5m", "autosimd.xml"); @@ -81,13 +81,10 @@ public void help(HelpTextGenerator help) throws StfException { + "the following workloads: " + Arrays.toString(Workloads.values()).replace("math", "math(default)")); } - - public void pluginInit(StfCoreExtension stf) throws StfException { - } public void execute(StfCoreExtension test) throws StfException { // Find out which workload we need to run - StfTestArguments testArgs = test.env().getTestProperties("workload=[math]"); + String jvmOptionsInUse = test.getJavaArgs(test.env().primaryJvm()); // If we are using JVM options that contains slow running JIT options, use reduced workload @@ -122,21 +119,32 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.math") - .addSuite("math") - .setSuiteThreadCount(cpuCount - 1, 2) - .setSuiteNumTests(numMathTests * multiplier) - .setSuiteInventory(inventoryFile) + .addProjectToClasspath("openjdk.test.math"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("math") + .setSuiteThreadCount(cpuCount - 1, 2); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMathTests * multiplier); + } + + loadTestInvocation = loadTestInvocation.setSuiteInventory(inventoryFile) .setSuiteRandomSelection(); + finalTimeout = timeout; + + if (isTimeBasedLoadTest) { + long finalTimeoutInSeconds = TimeParser.parseTimeSpecification(timeout).getSeconds() + + TimeParser.parseTimeSpecification(timeLimit).getSeconds(); + finalTimeout = finalTimeoutInSeconds + "s"; + } + test.doRunForegroundProcess("Run math load test", "MLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within(timeout), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoad.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoad.java index 50ea6487..153a9944 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoad.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoad.java @@ -15,29 +15,23 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.codeGeneration.Stage; import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.environment.JavaVersion; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; import net.adoptopenjdk.stf.processes.ExpectedOutcome; -import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; -public class MauveMultiThrdLoad implements StfPluginInterface { +public class MauveMultiThrdLoad extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MauveMultiThrdLoad"); help.outputText("The MauveMultiThrdLoad runs a subset of tests from the GNU mauve project. " + "All tests are thread safe."); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); @@ -77,18 +71,24 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addJvmOption(modularityOptions) - .addJarToClasspath(mauveJar) - .addSuite("mauve") + .addJarToClasspath(mauveJar); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("mauve") .setSuiteInventory(inventoryFile) - .setSuiteThreadCount(cpuCount - 1, 3) // Leave 1 cpu for the JIT and one for GC, but min 2 - .setSuiteNumTests(numMauveTests * multiplier) // Run each test about 1000 times - .setSuiteRandomSelection(); + .setSuiteThreadCount(cpuCount - 1, 3); // Leave 1 cpu for the JIT and one for GC, but min 2 + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMauveTests * multiplier); + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); test.doRunForegroundProcess("Run Mauve load test", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("2h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } } diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoadTrc.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoadTrc.java index 0c869871..bf6d18c0 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoadTrc.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveMultiThrdLoadTrc.java @@ -15,29 +15,23 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.codeGeneration.Stage; import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.environment.JavaVersion; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; import net.adoptopenjdk.stf.processes.ExpectedOutcome; -import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; -public class MauveMultiThrdLoadTrc implements StfPluginInterface { +public class MauveMultiThrdLoadTrc extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MauveMultiThrdLoadTrc"); help.outputText("The MauveMultiThrdLoadTrc runs a subset of tests from the GNU mauve project. " + "All tests are thread safe."); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); @@ -78,18 +72,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addJvmOption(modularityOptions) .addJvmOption("-Xdump:system:events=throw,filter=net/adoptopenjdk/loadTest/reporting/MauveTestFailureException,range=1..1,request=exclusive+prepwalk") - .addJarToClasspath(mauveJar) - .addSuite("mauve") + .addJarToClasspath(mauveJar); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("mauve") .setSuiteInventory(inventoryFile) - .setSuiteThreadCount(cpuCount - 1, 3) // Leave 1 cpu for the JIT and one for GC, but min 2 - .setSuiteNumTests(numMauveTests * multiplier) // Run each test about 1000 times - .setSuiteRandomSelection(); + .setSuiteThreadCount(cpuCount - 1, 3); // Leave 1 cpu for the JIT and one for GC, but min 2 + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMauveTests * multiplier); // Run each test about 1000 times + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); + test.doRunForegroundProcess("Run Mauve load test", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("2h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } } + diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleInvocLoad.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleInvocLoad.java index 0d45bb39..a3812f5e 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleInvocLoad.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleInvocLoad.java @@ -15,16 +15,16 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.environment.JavaVersion; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; import net.adoptopenjdk.stf.processes.ExpectedOutcome; -import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; -public class MauveSingleInvocLoad implements StfPluginInterface { +public class MauveSingleInvocLoad extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MauveSingleInvocLoad"); help.outputText("The MauveSingleInvocLoad runs a subset of tests from the GNU mauve project. " @@ -32,12 +32,6 @@ public void help(HelpTextGenerator help) throws StfException { + "(multi-invocation or multi-thread to reveal themselves"); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); @@ -67,19 +61,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addJvmOption(modularityOptions) - .addJarToClasspath(mauveJar) - .addSuite("mauve") + .addJarToClasspath(mauveJar); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("mauve") .setSuiteInventory(inventoryFile) - .setSuiteThreadCount(1) - .setSuiteNumTests(numMauveTests) // Run each test once times - .setSuiteSequentialSelection(); -// .setSuiteRandomSelection(); + .setSuiteThreadCount(1); + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMauveTests * 500); // Run each test 500 times + } + + loadTestInvocation = loadTestInvocation.setSuiteSequentialSelection(); + test.doRunForegroundProcess("Run Mauve load test", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("1h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } } + diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoad.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoad.java index 059133b2..420539d2 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoad.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoad.java @@ -15,16 +15,16 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.environment.JavaVersion; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; import net.adoptopenjdk.stf.processes.ExpectedOutcome; -import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; -public class MauveSingleThrdLoad implements StfPluginInterface { +public class MauveSingleThrdLoad extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MauveSingleThrdLoad"); help.outputText("The MauveSingleThrdLoad runs a subset of tests from the GNU mauve project. " @@ -32,12 +32,6 @@ public void help(HelpTextGenerator help) throws StfException { + "which are not thread safe"); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); @@ -67,19 +61,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addJvmOption(modularityOptions) - .addJarToClasspath(mauveJar) - .addSuite("mauve") + .addJarToClasspath(mauveJar); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("mauve") .setSuiteInventory(inventoryFile) - .setSuiteThreadCount(1) - .setSuiteNumTests(numMauveTests * 500) // Run each test 500 times - .setSuiteSequentialSelection(); -// .setSuiteRandomSelection(); + .setSuiteThreadCount(1); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMauveTests * 500); // Run each test 500 times + } + + loadTestInvocation = loadTestInvocation.setSuiteSequentialSelection(); test.doRunForegroundProcess("Run Mauve load test", "LT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("1h"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } } + diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoadTrc.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoadTrc.java index af45780e..4a48df06 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoadTrc.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MauveSingleThrdLoadTrc.java @@ -15,16 +15,16 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.environment.JavaVersion; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; import net.adoptopenjdk.stf.processes.ExpectedOutcome; -import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; -public class MauveSingleThrdLoadTrc implements StfPluginInterface { +public class MauveSingleThrdLoadTrc extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MauveSingleThrdLoadTrc"); help.outputText("The MauveSingleThrdLoadTrc runs a subset of tests from the GNU mauve project. " @@ -32,12 +32,6 @@ public void help(HelpTextGenerator help) throws StfException { + "which are not thread safe"); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); @@ -68,19 +62,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addJvmOption(modularityOptions) .addJvmOption("-Xdump:system:events=throw,filter=net/adoptopenjdk/loadTest/reporting/MauveTestFailureException,range=1..1,request=exclusive+prepwalk") - .addJarToClasspath(mauveJar) - .addSuite("mauve") + .addJarToClasspath(mauveJar); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.addSuite("mauve") .setSuiteInventory(inventoryFile) - .setSuiteThreadCount(1) - .setSuiteNumTests(numMauveTests * 500) // Run each test 500 times - .setSuiteSequentialSelection(); -// .setSuiteRandomSelection(); + .setSuiteThreadCount(1); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numMauveTests * 500); // Run each test 500 times + } + + loadTestInvocation = loadTestInvocation.setSuiteSequentialSelection(); test.doRunForegroundProcess("Run Mauve load test", "LT", Echo.ECHO_ON, ExpectedOutcome.cleanRun().within("1h"), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } } + diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MixedLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MixedLoadTest.java index 9864f627..ce0b9dd0 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MixedLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/MixedLoadTest.java @@ -14,49 +14,24 @@ package net.adoptopenjdk.stf; +import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; +import net.adoptopenjdk.stf.environment.FileRef; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; -import net.adoptopenjdk.stf.environment.FileRef; -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 net.adoptopenjdk.stf.util.TimeParser; -import net.adoptopenjdk.loadTest.InventoryData; -import net.adoptopenjdk.stf.environment.StfTestArguments; -public class MixedLoadTest implements StfPluginInterface { - - String timeLimit; - int testCountMultiplier; - boolean isTimeBasedLoadTest = true; - String defaultTimeout = "3h"; +public class MixedLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("MixedLoadTest runs workloads of math,mauve,nio,lang,concurrent unit tests"); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - // When used as a time based test, this STF test plugin accepts the following two parameters: - // (1) timeLimit : Time duration (e.g. 5s, 5m, 5h) for which the load should be run. - // (2) testCountMultiplier : Optional multiplier value to increase the workload externally. - StfTestArguments testArgs = stf.env().getTestProperties("timeLimit=[notset]","testCountMultiplier=[1]"); - timeLimit = testArgs.get("timeLimit"); - testCountMultiplier = Integer.parseInt(testArgs.get("testCountMultiplier")); - - // When We are using MixedLoadTest for default cases;. e.g. not in a time based load test scenario - if ( timeLimit.equals("notset")) { - isTimeBasedLoadTest = false; - } - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { - FileRef mauveJar = test.env().findPrereqFile("mauve/mauve.jar"); FileRef fileSystemJar = test.env().findTestFile("openjdk.test.nio/bin/lib/filesystem.jar"); @@ -83,38 +58,24 @@ public void execute(StfCoreExtension test) throws StfException { .addJarToClasspath(fileSystemJar); if (isTimeBasedLoadTest) { - loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration } + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("mix") .setSuiteThreadCount(cpuCount - 2, 10); // Leave 1 cpu for the JIT, 1 cpu for GC and set min 10 - if (isTimeBasedLoadTest) { - loadTestInvocation = loadTestInvocation - .setSuiteNumTests(totalTests * 80000000 * testCountMultiplier); // If it's a time based test, run a very large load - } else { - loadTestInvocation = loadTestInvocation - .setSuiteNumTests(totalTests * 200); + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * 200); } loadTestInvocation = loadTestInvocation .setSuiteInventory(inventoryFile) // Point at the file which lists the tests .setSuiteRandomSelection(); // Randomly pick the next test each time - String finalTimeout = defaultTimeout; - - // If it's a time-based test, set timeout for the test process to the default timeout(3h) + given timeLimit - if (isTimeBasedLoadTest) { - long finalTimeoutInSeconds = TimeParser.parseTimeSpecification(defaultTimeout).getSeconds() + - TimeParser.parseTimeSpecification(timeLimit).getSeconds(); - finalTimeout = finalTimeoutInSeconds + "s"; - } - test.doRunForegroundProcess("Run mixed unit tests", "LT", Echo.ECHO_ON, ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/NioLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/NioLoadTest.java index 1d9710b3..ed21b2d3 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/NioLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/NioLoadTest.java @@ -15,10 +15,10 @@ package net.adoptopenjdk.stf; import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; import net.adoptopenjdk.stf.environment.FileRef; 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; @@ -39,18 +39,12 @@ * For further info about the tests see the the test documentation attached to the * test.nio project (NioTestsDoc.md and ChatClient.md). */ -public class NioLoadTest implements StfPluginInterface { +public class NioLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("NioLoadTest runs the former JGrinder nio and nio2 tests"); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { // Specify the filesystem.jar which is required for the FileSystemsTest and ensure it exists FileRef fileSystemJar = test.env().findTestFile("openjdk.test.nio/bin/lib/filesystem.jar"); @@ -66,18 +60,27 @@ public void execute(StfCoreExtension test) throws StfException { .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) .addJarToClasspath(fileSystemJar) - .addProjectToClasspath("openjdk.test.nio") + .addProjectToClasspath("openjdk.test.nio"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("nio") - .setSuiteThreadCount(cpuCount - 2, 2) // Leave 1 cpu for the JIT, 1 cpu for GC and set min 2 - .setSuiteNumTests(numNioTests * 10) - .setSuiteInventory(inventoryFile) - .setSuiteRandomSelection(); + .setSuiteThreadCount(cpuCount - 2, 2); // Leave 1 cpu for the JIT, 1 cpu for GC and set min 2 + + if (!isTimeBasedLoadTest) { // If it's not a time-based run, set number of tests to run + loadTestInvocation = loadTestInvocation.setSuiteNumTests(numNioTests * 10); + } + + loadTestInvocation = loadTestInvocation + .setSuiteInventory(inventoryFile) // Point at the file which lists the tests + .setSuiteRandomSelection(); // Randomly pick the next test each time test.doRunForegroundProcess("Run nio load test", "NLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("30m"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } +} - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/SerializationLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/SerializationLoadTest.java index def4f01d..73adb051 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/SerializationLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/SerializationLoadTest.java @@ -14,27 +14,21 @@ package net.adoptopenjdk.stf; +import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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 net.adoptopenjdk.loadTest.InventoryData; -public class SerializationLoadTest implements StfPluginInterface { +public class SerializationLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("SerializationLoadTest runs a workload of Java util related tests"); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { String inventoryFile = "/openjdk.test.load/config/inventories/serialization/serialization.xml"; int totalTests = InventoryData.getNumberOfTests(test, inventoryFile); @@ -43,19 +37,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.serialization") - .setAbortIfOutOfMemory(false) + .addProjectToClasspath("openjdk.test.serialization"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("serialization") .setSuiteThreadCount(cpuCount - 1, 2) // Leave 1 cpu for the JIT and set min 2 - .setSuiteInventory(inventoryFile) // Point at the file which lists the tests - .setSuiteNumTests(totalTests * 10000) // Run for about 2 minutes with no -X options - .setSuiteRandomSelection(); // Randomly pick the next test each time + .setSuiteInventory(inventoryFile); // Point at the file which lists the tests + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * 10000); // Run for about 2 minutes with no -X options + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); // Randomly pick the next test each time test.doRunForegroundProcess("Run serialization tests", "SLT", Echo.ECHO_ON, - ExpectedOutcome.cleanRun().within("30m"), + ExpectedOutcome.cleanRun().within(finalTimeout), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +} diff --git a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/UtilLoadTest.java b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/UtilLoadTest.java index 33ef2965..6a11207f 100644 --- a/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/UtilLoadTest.java +++ b/openjdk.test.load/src/test.load/net/adoptopenjdk/stf/UtilLoadTest.java @@ -14,27 +14,21 @@ package net.adoptopenjdk.stf; +import net.adoptopenjdk.loadTest.InventoryData; +import net.adoptopenjdk.loadTest.TimeBasedLoadTest; 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 net.adoptopenjdk.loadTest.InventoryData; -public class UtilLoadTest implements StfPluginInterface { +public class UtilLoadTest extends TimeBasedLoadTest { public void help(HelpTextGenerator help) throws StfException { help.outputSection("UtilLoadTest runs a workload of Java util related tests"); help.outputText(""); } - public void pluginInit(StfCoreExtension stf) throws StfException { - } - - public void setUp(StfCoreExtension test) throws StfException { - } - public void execute(StfCoreExtension test) throws StfException { String inventoryFile = "/openjdk.test.load/config/inventories/util/util.xml"; int totalTests = InventoryData.getNumberOfTests(test, inventoryFile); @@ -43,19 +37,25 @@ public void execute(StfCoreExtension test) throws StfException { LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) - .addProjectToClasspath("openjdk.test.util") - .setAbortIfOutOfMemory(false) + .addProjectToClasspath("openjdk.test.util"); + + if (isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration + } + + loadTestInvocation = loadTestInvocation.setAbortIfOutOfMemory(false) .addSuite("util") .setSuiteThreadCount(cpuCount - 1, 2) // Leave 1 cpu for the JIT and set min 2 - .setSuiteInventory(inventoryFile) // Point at the file which lists the tests - .setSuiteNumTests(totalTests * 500) // Run for about 2 minutes with no -X options - .setSuiteRandomSelection(); // Randomly pick the next test each time + .setSuiteInventory(inventoryFile); // Point at the file which lists the tests + + if (!isTimeBasedLoadTest) { + loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * 500); // Run for about 2 minutes with no -X options + } + + loadTestInvocation = loadTestInvocation.setSuiteRandomSelection(); // Randomly pick the next test each time test.doRunForegroundProcess("Run util load tests", "ULT", Echo.ECHO_ON, ExpectedOutcome.cleanRun().within("1h"), loadTestInvocation); } - - public void tearDown(StfCoreExtension stf) throws StfException { - } -} \ No newline at end of file +}