-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Enable time-based load test mechanism in openjdk-systemtest load tests #396
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we set |
||
|
||
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 { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have a simpler logic?
Same for the rest of PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done the way it is because STF framework enforces a particular sequence in which we can add methods in a process definition. For example, in the code snippet above, if instead we did the following:
We will have an error like this:
Please see here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, we can have a separate issue to investigate if we need to revisit this feature in STF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should. Please open an issue in STF. Thanks
Also, could you try one last thing? Could you try to move if-else code after
setAbortIfOutOfMemory
but beforeaddSuite
? According to STF code,setAbortIfOutOfMemory
is set toLOAD_TEST_ARGS
,setSuiteNumTests
is set toSUITE
,setTimeLimit
is set toLOAD_TEST_ARGS
andaddSuite
is set toSUITE
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This had the same error as before. But it worked if I moved the if-else after addSuite and before setSuiteThreadCount :
So, this simplifies the logic too. I will make similar update in the rest of the test classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Mesbah-Alam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New STF issue raised: adoptium/STF#101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to recap conversation with Lan about the above issue over slack:
I tried the change proposed above locally, and the if-else doesn't really work for both the scenarios when a timeLimit is provided (time-based test) and when it's no (iteration based test). Meaning, one particular sequence works when
isTimeBasedLoadTest==true
, and a different sequence is expected by STF whenisTimeBasedLoadTest=false
. Hence we have decided to stick to what the original change was.Further discussion to commence in adoptium/STF#101