mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
tests: add BAL specific tests
This commit is contained in:
parent
06b23b4293
commit
e2d5fd8e4f
4 changed files with 49 additions and 16 deletions
|
|
@ -1,10 +1,15 @@
|
||||||
# This file contains sha256 checksums of optional build dependencies.
|
# This file contains sha256 checksums of optional build dependencies.
|
||||||
|
|
||||||
# version:spec-tests tests@v20.0.0
|
# version:spec-tests tests@v20.0.0
|
||||||
# https://github.com/ethereum/execution-specs/releases
|
# https://github.com/ethereum/execution-spec-tests/releases
|
||||||
# https://github.com/ethereum/execution-specs/releases/download/tests%40v20.0.0
|
# https://github.com/ethereum/execution-specs/releases/download/tests%40v20.0.0
|
||||||
b183702a5b447b465873865357ced9eb342315922e52e31b714e2de115dd0bb4 fixtures.tar.gz
|
b183702a5b447b465873865357ced9eb342315922e52e31b714e2de115dd0bb4 fixtures.tar.gz
|
||||||
|
|
||||||
|
# version:spec-tests-bal glamsterdam-devnet@v7.1.0
|
||||||
|
# https://github.com/ethereum/execution-specs/releases
|
||||||
|
# https://github.com/ethereum/execution-specs/releases/download/tests-glamsterdam-devnet%40v7.1.0
|
||||||
|
ba833a4c0a956bcc7d00118cd9aa817b8715ea4357ded9d3393d37ba89b182a9 fixtures_glamsterdam-devnet.tar.gz
|
||||||
|
|
||||||
# version:golang 1.25.12
|
# version:golang 1.25.12
|
||||||
# https://go.dev/dl/
|
# https://go.dev/dl/
|
||||||
f90dcee4bd023fa376374ea0a5a6ebe553537b39c426ffd8c689469b45519932 go1.25.12.src.tar.gz
|
f90dcee4bd023fa376374ea0a5a6ebe553537b39c426ffd8c689469b45519932 go1.25.12.src.tar.gz
|
||||||
|
|
|
||||||
20
build/ci.go
20
build/ci.go
|
|
@ -160,6 +160,9 @@ var (
|
||||||
|
|
||||||
// This is where the tests should be unpacked.
|
// This is where the tests should be unpacked.
|
||||||
executionSpecTestsDir = "tests/spec-tests"
|
executionSpecTestsDir = "tests/spec-tests"
|
||||||
|
|
||||||
|
// This is where the bal-specific release of the tests should be unpacked.
|
||||||
|
executionSpecTestsBALDir = "tests/spec-tests-bal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
|
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
|
||||||
|
|
@ -398,6 +401,7 @@ func doTest(cmdline []string) {
|
||||||
// Get test fixtures.
|
// Get test fixtures.
|
||||||
if !*short {
|
if !*short {
|
||||||
downloadSpecTestFixtures(csdb, *cachedir)
|
downloadSpecTestFixtures(csdb, *cachedir)
|
||||||
|
downloadBALSpecTestFixtures(csdb, *cachedir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the toolchain.
|
// Configure the toolchain.
|
||||||
|
|
@ -452,7 +456,7 @@ func doTest(cmdline []string) {
|
||||||
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
|
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
|
||||||
func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
|
func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
|
||||||
ext := ".tar.gz"
|
ext := ".tar.gz"
|
||||||
base := "fixtures"
|
base := "fixtures_develop"
|
||||||
archivePath := filepath.Join(cachedir, base+ext)
|
archivePath := filepath.Join(cachedir, base+ext)
|
||||||
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
|
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
@ -463,6 +467,20 @@ func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string
|
||||||
return filepath.Join(cachedir, base)
|
return filepath.Join(cachedir, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// downloadBALSpecTestFixtures downloads and extracts the bal-specific execution-spec-tests fixtures.
|
||||||
|
func downloadBALSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
|
||||||
|
ext := ".tar.gz"
|
||||||
|
base := "fixtures_glamsterdam-devnet"
|
||||||
|
archivePath := filepath.Join(cachedir, base+ext)
|
||||||
|
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := build.ExtractArchive(archivePath, executionSpecTestsBALDir); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
return filepath.Join(cachedir, base)
|
||||||
|
}
|
||||||
|
|
||||||
// doCheckGenerate ensures that re-generating generated files does not cause
|
// doCheckGenerate ensures that re-generating generated files does not cause
|
||||||
// any mutations in the source file tree.
|
// any mutations in the source file tree.
|
||||||
func doCheckGenerate() {
|
func doCheckGenerate() {
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,17 @@ func TestBlockchain(t *testing.T) {
|
||||||
|
|
||||||
// TestExecutionSpecBlocktests runs the test fixtures from execution-spec-tests.
|
// TestExecutionSpecBlocktests runs the test fixtures from execution-spec-tests.
|
||||||
func TestExecutionSpecBlocktests(t *testing.T) {
|
func TestExecutionSpecBlocktests(t *testing.T) {
|
||||||
if !common.FileExist(executionSpecBlockchainTestDir) {
|
testExecutionSpecBlocktests(t, executionSpecBlockchainTestDir)
|
||||||
t.Skipf("directory %s does not exist", executionSpecBlockchainTestDir)
|
}
|
||||||
|
|
||||||
|
// TestExecutionSpecBlocktestsBAL runs the BAL release test fixtures from execution-spec-tests.
|
||||||
|
func TestExecutionSpecBlocktestsBAL(t *testing.T) {
|
||||||
|
testExecutionSpecBlocktests(t, executionSpecBALBlockchainTestDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testExecutionSpecBlocktests(t *testing.T, testDir string) {
|
||||||
|
if !common.FileExist(testDir) {
|
||||||
|
t.Skipf("directory %s does not exist", testDir)
|
||||||
}
|
}
|
||||||
bt := new(testMatcher)
|
bt := new(testMatcher)
|
||||||
|
|
||||||
|
|
@ -95,7 +104,7 @@ func TestExecutionSpecBlocktests(t *testing.T) {
|
||||||
bt.skipLoad(`.*eip7610_create_collision/initcollision/.*`)
|
bt.skipLoad(`.*eip7610_create_collision/initcollision/.*`)
|
||||||
bt.skipLoad(`.*eip7610_create_collision/revert_in_create/.*`)
|
bt.skipLoad(`.*eip7610_create_collision/revert_in_create/.*`)
|
||||||
|
|
||||||
bt.walk(t, executionSpecBlockchainTestDir, func(t *testing.T, name string, test *BlockTest) {
|
bt.walk(t, testDir, func(t *testing.T, name string, test *BlockTest) {
|
||||||
execBlockTest(t, bt, test)
|
execBlockTest(t, bt, test)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,17 +34,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
baseDir = filepath.Join(".", "testdata")
|
baseDir = filepath.Join(".", "testdata")
|
||||||
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
||||||
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
|
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
|
||||||
legacyStateTestDir = filepath.Join(baseDir, "LegacyTests", "Constantinople", "GeneralStateTests")
|
legacyStateTestDir = filepath.Join(baseDir, "LegacyTests", "Constantinople", "GeneralStateTests")
|
||||||
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
|
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
|
||||||
rlpTestDir = filepath.Join(baseDir, "RLPTests")
|
rlpTestDir = filepath.Join(baseDir, "RLPTests")
|
||||||
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
|
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
|
||||||
executionSpecBlockchainTestDir = filepath.Join(".", "spec-tests", "fixtures", "blockchain_tests")
|
executionSpecBlockchainTestDir = filepath.Join(".", "spec-tests", "fixtures", "blockchain_tests")
|
||||||
executionSpecStateTestDir = filepath.Join(".", "spec-tests", "fixtures", "state_tests")
|
executionSpecBALBlockchainTestDir = filepath.Join(".", "spec-tests-bal", "fixtures", "blockchain_tests")
|
||||||
executionSpecTransactionTestDir = filepath.Join(".", "spec-tests", "fixtures", "transaction_tests")
|
executionSpecStateTestDir = filepath.Join(".", "spec-tests", "fixtures", "state_tests")
|
||||||
benchmarksDir = filepath.Join(".", "evm-benchmarks", "benchmarks")
|
executionSpecTransactionTestDir = filepath.Join(".", "spec-tests", "fixtures", "transaction_tests")
|
||||||
|
benchmarksDir = filepath.Join(".", "evm-benchmarks", "benchmarks")
|
||||||
)
|
)
|
||||||
|
|
||||||
func readJSON(reader io.Reader, value interface{}) error {
|
func readJSON(reader io.Reader, value interface{}) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue