test block import in CI (#2290)

This commit is contained in:
Jacek Sieka 2024-06-05 21:56:43 +02:00 committed by GitHub
parent 8985535ab2
commit effed1a044
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 3 deletions

View File

@ -193,7 +193,7 @@ jobs:
run: |
gcc --version
DEFAULT_MAKE_FLAGS="-j${ncpu} ENABLE_EVMC=${ENABLE_EVMC} ENABLE_VMLOWMEM=${ENABLE_VMLOWMEM}"
mingw32-make ${DEFAULT_MAKE_FLAGS}
mingw32-make ${DEFAULT_MAKE_FLAGS} all test_import
build/nimbus.exe --help
# give us more space
# find . -type d -name ".git" -exec rm -rf {} +
@ -208,7 +208,7 @@ jobs:
run: |
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
DEFAULT_MAKE_FLAGS="-j${ncpu} USE_MIRACL=${USE_MIRACL} ENABLE_EVMC=${ENABLE_EVMC}"
env CC=gcc make ${DEFAULT_MAKE_FLAGS}
env CC=gcc make ${DEFAULT_MAKE_FLAGS} all test_import
build/nimbus --help
# CC, GOARCH, and CGO_ENABLED are needed to select correct compiler 32/64 bit
# pushd vendor/nimbus-eth2
@ -223,7 +223,7 @@ jobs:
run: |
export ZERO_AR_DATE=1 # avoid timestamps in binaries
DEFAULT_MAKE_FLAGS="-j${ncpu} ENABLE_EVMC=${ENABLE_EVMC}"
make ${DEFAULT_MAKE_FLAGS}
make ${DEFAULT_MAKE_FLAGS} all test_import
build/nimbus --help
# "-static" option will not work for osx unless static system libraries are provided
# pushd vendor/nimbus-eth2

View File

@ -239,6 +239,9 @@ test: | build deps rocksdb
$(ENV_SCRIPT) nim test_rocksdb $(NIM_PARAMS) nimbus.nims
$(ENV_SCRIPT) nim test $(NIM_PARAMS) nimbus.nims
test_import: nimbus
$(ENV_SCRIPT) nim test_import $(NIM_PARAMS) nimbus.nims
# builds and runs an EVM-related subset of the nimbus test suite
test-evm: | build deps rocksdb
$(ENV_SCRIPT) nim test_evm $(NIM_PARAMS) nimbus.nims

View File

@ -41,6 +41,8 @@ when declared(namedBin):
"nimbus_verified_proxy/nimbus_verified_proxy": "nimbus_verified_proxy",
}.toTable()
import std/os
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
@ -72,6 +74,27 @@ task test, "Run tests":
task test_rocksdb, "Run rocksdb tests":
test "tests/db", "test_kvstore_rocksdb", "-d:chronicles_log_level=ERROR -d:unittest2DisableParamFiltering"
task test_import, "Run block import test":
let tmp = getTempDir() / "nimbus-eth1-block-import"
if dirExists(tmp):
echo "Remove directory before running test: " & tmp
quit(QuitFailure)
const nimbus = when defined(windows):
"build/nimbus.exe"
else:
"build/nimbus"
if not fileExists(nimbus):
echo "Build nimbus before running this test"
quit(QuitFailure)
# Test that we can resume import
exec "build/nimbus import --data-dir:" & tmp & " --era1-dir:tests/replay --max-blocks:1"
exec "build/nimbus import --data-dir:" & tmp & " --era1-dir:tests/replay --max-blocks:1023"
# There should only be 8k blocks
exec "build/nimbus import --data-dir:" & tmp & " --era1-dir:tests/replay --max-blocks:10000"
task test_evm, "Run EVM tests":
test "tests", "evm_tests", "-d:chronicles_log_level=ERROR -d:unittest2DisableParamFiltering"