diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c5cc59a2..9fa58b0b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Makefile b/Makefile index 2a8725063..e3a153883 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/nimbus.nimble b/nimbus.nimble index c3cc624ae..4d00e48d7 100644 --- a/nimbus.nimble +++ b/nimbus.nimble @@ -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"