mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
build: download test fixtures to build/cache directory
This commit is contained in:
parent
141a307035
commit
d6ac6c8927
1 changed files with 24 additions and 19 deletions
19
build/ci.go
19
build/ci.go
|
|
@ -148,6 +148,13 @@ var (
|
||||||
// we need to switch over to a recursive builder to jumpt across supported
|
// we need to switch over to a recursive builder to jumpt across supported
|
||||||
// versions.
|
// versions.
|
||||||
gobootVersion = "1.19.6"
|
gobootVersion = "1.19.6"
|
||||||
|
|
||||||
|
// This is the version of execution-spec-tests that we are using.
|
||||||
|
// When updating, you must also update build/checksums.txt.
|
||||||
|
executionSpecTestsVersion = "0.2.4"
|
||||||
|
|
||||||
|
// This is where the tests should be unpacked.
|
||||||
|
executionSpecTestsDir = "tests/spec-tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
|
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
|
||||||
|
|
@ -294,11 +301,11 @@ func doTest(cmdline []string) {
|
||||||
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
|
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
|
||||||
verbose = flag.Bool("v", false, "Whether to log verbosely")
|
verbose = flag.Bool("v", false, "Whether to log verbosely")
|
||||||
race = flag.Bool("race", false, "Execute the race detector")
|
race = flag.Bool("race", false, "Execute the race detector")
|
||||||
stateTestDir = "tests/spec-tests"
|
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
|
||||||
)
|
)
|
||||||
flag.CommandLine.Parse(cmdline)
|
flag.CommandLine.Parse(cmdline)
|
||||||
|
|
||||||
downloadSpecTestFixtures(stateTestDir)
|
downloadSpecTestFixtures(*cachedir)
|
||||||
|
|
||||||
// Configure the toolchain.
|
// Configure the toolchain.
|
||||||
tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
|
tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
|
||||||
|
|
@ -335,19 +342,17 @@ func doTest(cmdline []string) {
|
||||||
build.MustRun(gotest)
|
build.MustRun(gotest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
|
||||||
func downloadSpecTestFixtures(cachedir string) string {
|
func downloadSpecTestFixtures(cachedir string) string {
|
||||||
// Download the execution-spec-tests
|
|
||||||
const version = "0.2.4"
|
|
||||||
|
|
||||||
csdb := build.MustLoadChecksums("build/checksums.txt")
|
csdb := build.MustLoadChecksums("build/checksums.txt")
|
||||||
ext := ".tar.gz"
|
ext := ".tar.gz"
|
||||||
base := "fixtures" // TODO(MariusVanDerWijden) rename once the version becomes part of the filename
|
base := "fixtures" // TODO(MariusVanDerWijden) rename once the version becomes part of the filename
|
||||||
url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/v%s/%s%s", version, base, ext)
|
url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/v%s/%s%s", executionSpecTestsVersion, base, ext)
|
||||||
archivePath := filepath.Join(cachedir, base+ext)
|
archivePath := filepath.Join(cachedir, base+ext)
|
||||||
if err := csdb.DownloadFile(url, archivePath); err != nil {
|
if err := csdb.DownloadFile(url, archivePath); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := build.ExtractArchive(archivePath, cachedir); err != nil {
|
if err := build.ExtractArchive(archivePath, executionSpecTestsDir); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
return filepath.Join(cachedir, base)
|
return filepath.Join(cachedir, base)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue