diff --git a/.github/workflows/reference-tests.yml b/.github/workflows/reference-tests.yml index 68310944af..84123b226d 100644 --- a/.github/workflows/reference-tests.yml +++ b/.github/workflows/reference-tests.yml @@ -41,7 +41,7 @@ jobs: with: cache-disabled: true - name: execute generate reference tests - run: ./gradlew ethereum:referencetests:blockchainReferenceTests ethereum:referencetests:generalstateReferenceTests ethereum:referencetests:generalstateRegressionReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true + run: ./gradlew ethereum:referencetests:referenceTestClasses -Dorg.gradle.parallel=true -Dorg.gradle.caching=true - name: list test files generated run: find ethereum/referencetests/build/generated/sources/reference-test -name "*.java" | sort >> filenames.txt - name: Split tests diff --git a/ethereum/referencetests/build.gradle b/ethereum/referencetests/build.gradle index 70841e62ff..9b3924ddd8 100644 --- a/ethereum/referencetests/build.gradle +++ b/ethereum/referencetests/build.gradle @@ -80,13 +80,22 @@ def executionSpecTests = tasks.register("executionSpecTests") { inputs.files fileTree(referenceTestsPath), fileTree(generatedTestsPath) outputs.files generatedTestsPath + // generate blockchain_tests: generateTestFiles( - fileTree(referenceTestsPath + "/fixtures"), - file("src/reference-test/templates/BlockchainReferenceTest.java.template"), + fileTree(referenceTestsPath + "/fixtures/blockchain_tests"), + file("src/reference-test/templates/ExecutionSpecTest.java.template"), + "fixtures", + "$generatedTestsPath/org/hyperledger/besu/ethereum/vm/executionspec", + "ExecutionSpecBlockchainTest" + ) + + // generate state_tests: + generateTestFiles( + fileTree(referenceTestsPath + "/fixtures/state_tests"), + file("src/reference-test/templates/ExecutionSpecStateTest.java.template"), "fixtures", "$generatedTestsPath/org/hyperledger/besu/ethereum/vm/executionspec", - "ExecutionSpecTest", - ("fixtures/example/example") // exclude test for test filling tool + "ExecutionSpecStateTest" ) } @@ -170,7 +179,7 @@ dependencies { referenceTestImplementation project(path: ':testutil') referenceTestImplementation project(path: ':util') // the following will be resolved via custom ivy repository declared in root build.gradle - referenceTestImplementation 'ethereum:execution-spec-tests:0.2.5:fixtures@tar.gz' + referenceTestImplementation 'ethereum:execution-spec-tests:2.1.1:fixtures@tar.gz' referenceTestImplementation 'com.fasterxml.jackson.core:jackson-databind' referenceTestImplementation 'com.google.guava:guava' referenceTestImplementation 'io.tmio:tuweni-bytes' diff --git a/ethereum/referencetests/src/reference-test/templates/ExecutionSpecStateTest.java.template b/ethereum/referencetests/src/reference-test/templates/ExecutionSpecStateTest.java.template new file mode 100644 index 0000000000..76da5d64f9 --- /dev/null +++ b/ethereum/referencetests/src/reference-test/templates/ExecutionSpecStateTest.java.template @@ -0,0 +1,37 @@ +package org.hyperledger.besu.ethereum.vm.executionspec; + +import static org.hyperledger.besu.ethereum.vm.GeneralStateReferenceTestTools.executeTest; +import static org.hyperledger.besu.ethereum.vm.GeneralStateReferenceTestTools.generateTestParametersForConfig; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +import org.hyperledger.besu.ethereum.referencetests.GeneralStateTestCaseEipSpec; + +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** The general state test operation testing framework entry point. */ +public class %%TESTS_NAME%% { + + private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%}; + + public static Stream getTestParametersForConfig() { + return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH).stream().map(params -> + Arguments.of(params[0], params[1], params[2]) + ); + } + + @ParameterizedTest(name = "Name: {0}") + @MethodSource("getTestParametersForConfig") + public void execution( + final String name, + final GeneralStateTestCaseEipSpec spec, + final boolean runTest) { + assumeTrue(runTest, "Test " + name + " was ignored"); + executeTest(spec); + } +} diff --git a/ethereum/referencetests/src/reference-test/templates/ExecutionSpecTest.java.template b/ethereum/referencetests/src/reference-test/templates/ExecutionSpecTest.java.template new file mode 100644 index 0000000000..d56115f123 --- /dev/null +++ b/ethereum/referencetests/src/reference-test/templates/ExecutionSpecTest.java.template @@ -0,0 +1,36 @@ +package org.hyperledger.besu.ethereum.vm.executionspec; + +import static org.hyperledger.besu.ethereum.vm.BlockchainReferenceTestTools.executeTest; +import static org.hyperledger.besu.ethereum.vm.BlockchainReferenceTestTools.generateTestParametersForConfig; + +import org.hyperledger.besu.ethereum.referencetests.BlockchainReferenceTestCaseSpec; + +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** The blockchain test operation testing framework entry point. */ +public class %%TESTS_NAME%% { + + private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%}; + + public static Stream getTestParametersForConfig() { + return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH).stream().map(params -> + Arguments.of(params[0], params[1], params[2]) + ); + } + + @ParameterizedTest(name = "Name: {0}") + @MethodSource("getTestParametersForConfig") + public void execution( + final String name, + final BlockchainReferenceTestCaseSpec spec, + final boolean runTest) { + assumeTrue(runTest, "Test " + name + " was ignored"); + executeTest(spec); + } +} diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 91dccd51cd..3bb5283d45 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1417,6 +1417,11 @@ + + + + +