Revisit Java invocation build sequence logic in STF
- Dominant language
- Java
- Stars
- 10
- Forks
- 42
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
STF enforces a particular order in which we can define a `LoadTestProcessDefinition` instance. This enforcement can cause STF test plugins to become complicated (or less simple than what is desirable). For example:
```
LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
.addJvmOption("-Djava.classloading.dir=" + notonclasspathDirRoot) // Expose the bin_notonclasspath root directory to the deadlock test
.addJvmOption("-Djava.version.number=" + javaVersion)
.addModules(modulesAdd)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.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);
if (!isTimeBasedLoadTest) {
loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * testCountMultiplier);
}
loadTestInvocation = loadTestInvocation.setSuiteRandomSelection();
```
The above definition could be simpler, if STF allowed the following:
```
LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
.addJvmOption("-Djava.classloading.dir=" + notonclasspathDirRoot) // Expose the bin_notonclasspath root directory to the deadlock test
.addJvmOption("-Djava.version.number=" + javaVersion)
.addModules(modulesAdd)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.addProjectToClasspath("openjdk.test.classloading")
.setAbortIfOutOfMemory(false)
.addSuite("classloading");
if (isTimeBasedLoadTest) {
loadTestInvocation = loadTestInvocation.setTimeLimit(timeLimit); // If it's a time based test, stop execution after given time duration
} else {
loadTestInvocation = loadTestInvocation.setSuiteNumTests(totalTests * testCountMultiplier);
}
loadTestInvocation = loadTestInvocation.setSuiteThreadCount(cpuCount - 1, 10)
.setSuiteInventory(inventoryFile)
.setSuiteRandomSelection();
```
This issue is opened to revisit the design principles of these order enforcements and update the logic therein if possible.
FYI @llxia
Contributor guide
Research direction
Start at LoadTestProcessDefinition and the createLoadTestSpecification entry point. Review how the current method-order enforcement affects the example sequence, then assess whether the requested chaining and conditional configuration can be supported without breaking existing constraints. Done means the design is updated where possible and the example no longer needs order-driven reassignment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100