Skip to content

Commit

Permalink
test template refactor, bump besu-native to 0.9.2 (hyperledger#7315)
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
  • Loading branch information
garyschulte authored and daniellehrner committed Jul 16, 2024
1 parent f1c22df commit ae457bc
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 241 deletions.
2 changes: 1 addition & 1 deletion ethereum/evmtool/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

plugins {
id 'org.graalvm.buildtools.native' version '0.9.17'
id 'org.graalvm.buildtools.native' version '0.10.2'
}

apply plugin: 'java-library'
Expand Down
32 changes: 24 additions & 8 deletions ethereum/referencetests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def blockchainReferenceTests = tasks.register("blockchainReferenceTests") {
"BlockchainTests",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/blockchain",
"BlockchainReferenceTest",
"org.hyperledger.besu.ethereum.vm.blockchain",
("BlockchainTests/InvalidBlocks/bcExpectSection") // exclude test for test filling tool
)
}
Expand All @@ -50,6 +51,7 @@ def eipBlockchainReferenceTests = tasks.register("eipBlockchainReferenceTests")
"EIPTests${File.separatorChar}BlockchainTests",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/eip",
"EIPBlockchainReferenceTest",
"org.hyperledger.besu.ethereum.vm.eip",
)
}

Expand All @@ -65,6 +67,7 @@ def eipStateReferenceTests = tasks.register("eipStateReferenceTests") {
"EIPTests${File.separatorChar}StateTests",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/eip",
"EIPStateReferenceTest",
"org.hyperledger.besu.ethereum.vm.eip",
)
}

Expand All @@ -83,19 +86,21 @@ def executionSpecTests = tasks.register("executionSpecTests") {
// generate blockchain_tests:
generateTestFiles(
fileTree(referenceTestsPath + "/fixtures/blockchain_tests"),
file("src/reference-test/templates/ExecutionSpecTest.java.template"),
file("src/reference-test/templates/BlockchainReferenceTest.java.template"),
"fixtures",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/executionspec",
"ExecutionSpecBlockchainTest"
"ExecutionSpecBlockchainTest",
"org.hyperledger.besu.ethereum.vm.executionspec",
)

// generate state_tests:
generateTestFiles(
fileTree(referenceTestsPath + "/fixtures/state_tests"),
file("src/reference-test/templates/ExecutionSpecStateTest.java.template"),
file("src/reference-test/templates/GeneralStateReferenceTest.java.template"),
"fixtures",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/executionspec",
"ExecutionSpecStateTest"
"ExecutionSpecStateTest",
"org.hyperledger.besu.ethereum.vm.executionspec",
)
}

Expand All @@ -110,7 +115,8 @@ def generalstateReferenceTests = tasks.register("generalstateReferenceTests") {
file("src/reference-test/templates/GeneralStateReferenceTest.java.template"),
"GeneralStateTests",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/generalstate",
"GeneralStateReferenceTest"
"GeneralStateReferenceTest",
"org.hyperledger.besu.ethereum.vm.generalstate",
)
}

Expand All @@ -125,7 +131,8 @@ def generalstateRegressionReferenceTests = tasks.register("generalstateRegressio
file("src/reference-test/templates/GeneralStateReferenceTest.java.template"),
"regressions",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/generalstate",
"GeneralStateRegressionReferenceTest"
"GeneralStateRegressionReferenceTest",
"org.hyperledger.besu.ethereum.vm.generalstate"
)
}

Expand All @@ -140,7 +147,8 @@ def eofReferenceTests = tasks.register("eofReferenceTests") {
file("src/reference-test/templates/EOFReferenceTest.java.template"),
"EOFTests",
"$generatedTestsPath/org/hyperledger/besu/ethereum/vm/eof",
"EOFReferenceTest"
"EOFReferenceTest",
"org.hyperledger.besu.ethereum.vm.eof"
)
}

Expand Down Expand Up @@ -259,7 +267,14 @@ following commands:
}
processResources.dependsOn('validateReferenceTestSubmodule')

def generateTestFiles(FileTree jsonPath, File templateFile, String pathstrip, String destination, String namePrefix, String ... excludedPath) {
def generateTestFiles(
FileTree jsonPath,
File templateFile,
String pathstrip,
String destination,
String namePrefix,
String packageString,
String ... excludedPath) {
mkdir(destination)
def referenceTestTemplate = templateFile.text

Expand All @@ -281,6 +296,7 @@ def generateTestFiles(FileTree jsonPath, File templateFile, String pathstrip, St
def testFileContents = referenceTestTemplate
.replaceAll("%%TESTS_FILE%%", allPaths)
.replaceAll("%%TESTS_NAME%%", namePrefix + "_" + idx)
.replaceAll("%%PACKAGE_NAME%%", packageString)
testFile.newWriter().withWriter { w -> w << testFileContents }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hyperledger.besu.ethereum.vm.blockchain;
package %%PACKAGE_NAME%%;

import static org.hyperledger.besu.ethereum.vm.BlockchainReferenceTestTools.executeTest;
import static org.hyperledger.besu.ethereum.vm.BlockchainReferenceTestTools.generateTestParametersForConfig;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hyperledger.besu.ethereum.vm.generalstate;
package %%PACKAGE_NAME%%;

import static org.hyperledger.besu.ethereum.vm.GeneralStateReferenceTestTools.executeTest;
import static org.hyperledger.besu.ethereum.vm.GeneralStateReferenceTestTools.generateTestParametersForConfig;
Expand Down
1 change: 1 addition & 0 deletions evm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies {
implementation 'io.tmio:tuweni-units'
implementation 'org.hyperledger.besu:arithmetic'
implementation 'org.hyperledger.besu:bls12-381'
implementation'org.hyperledger.besu:gnark'
implementation 'tech.pegasys:jc-kzg-4844'

compileOnly 'com.fasterxml.jackson.core:jackson-databind'
Expand Down
Loading

0 comments on commit ae457bc

Please sign in to comment.