-
Notifications
You must be signed in to change notification settings - Fork 22
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
Optimize reference tests run and report #1402
base: arith-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package net.consensys.linea.generated.blockchain; | |
import static net.consensys.linea.BlockchainReferenceTestTools.executeTest; | ||
import static net.consensys.linea.BlockchainReferenceTestTools.generateTestParametersForConfig; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.stream.Stream; | ||
|
||
|
@@ -49,15 +50,14 @@ public class %%TESTS_NAME%% { | |
|
||
public static Stream<Arguments> getTestParametersForConfig() | ||
throws ExecutionException, InterruptedException { | ||
if (FAILED_MODULE.isEmpty()) { | ||
return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH).stream().map(params -> | ||
Arguments.of(params[0], params[1], params[2]) | ||
); | ||
} else { | ||
return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH, FAILED_MODULE, FAILED_CONSTRAINT).stream().map(params -> | ||
Arguments.of(params[0], params[1], params[2]) | ||
); | ||
Collection<Object[]> testParameters = FAILED_MODULE.isEmpty() | ||
? generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH) | ||
: generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH, FAILED_MODULE, FAILED_CONSTRAINT); | ||
Collection<Object[]> filteredTestParameters = testParameters.stream().filter(params -> (Boolean) params[2]).toList(); | ||
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. This ensures that the test configs that were going to be skipped will be filtered here itself resulting in a cleaner test report without 10s of thousands of skipped tests. I still need to ensure if all test configs are filtered there is atleast one dummy test config returned. This is because junit expects atleast 1 set of parameters for parameterized test. |
||
if (filteredTestParameters.isEmpty()) { | ||
return Stream.of(Arguments.of("%%TESTS_NAME%%", null, false)); | ||
} | ||
return filteredTestParameters.stream().map(params -> Arguments.of(params[0], params[1], params[2])); | ||
} | ||
|
||
@ParameterizedTest(name = "Name: {0}") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import static net.consensys.linea.GeneralStateReferenceTestTools.executeTest; | |
import static net.consensys.linea.GeneralStateReferenceTestTools.generateTestParametersForConfig; | ||
import static org.junit.jupiter.api.Assumptions.assumeTrue; | ||
|
||
import java.util.Collection; | ||
import java.util.stream.Stream; | ||
|
||
import org.hyperledger.besu.ethereum.referencetests.GeneralStateTestCaseEipSpec; | ||
|
@@ -39,9 +40,13 @@ public class %%TESTS_NAME%% { | |
private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%}; | ||
|
||
public static Stream<Arguments> getTestParametersForConfig() { | ||
return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH).stream().map(params -> | ||
Arguments.of(params[0], params[1], params[2]) | ||
); | ||
Collection<Object[]> testParameters = generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH) | ||
.stream().filter(params -> (Boolean) params[2]).toList(); | ||
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. This ensures that the test configs that were going to be skipped will be filtered here itself resulting in a cleaner test report without 10s of thousands of skipped tests. I still need to ensure if all test configs are filtered there is atleast one dummy test config returned. This is because junit expects atleast 1 set of parameters for parameterized test. |
||
if (testParameters.isEmpty()) { | ||
return Stream.of(Arguments.of("%%TESTS_NAME%%", null, false)); | ||
} else { | ||
return testParameters.stream().map(params -> Arguments.of(params[0], params[1], params[2])); | ||
} | ||
} | ||
|
||
@ParameterizedTest(name = "Name: {0}") | ||
|
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.
Some tests consume a lot of heap space so it is not feasible to have tests run in parallel as the sum of heap usage of all concurrent tests will exceed the max heap size.