From 718d97b6115b00008db9b641f15864670fd1a23a Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Thu, 7 Nov 2024 15:23:56 +0000 Subject: [PATCH] Reduce dirty space (#12651) reduced ubuntu integration test time by 2 min but macOS integration time increased significantly --- .github/workflows/test-integration.yml | 2 +- Makefile | 2 +- erigon-lib/kv/mdbx/kv_mdbx.go | 2 +- erigon-lib/kv/memdb/memory_database.go | 1 - tests/block_test.go | 1 + tests/block_test_util.go | 1 + tests/exec_spec_test.go | 1 + tests/testdata | 2 +- turbo/stages/mock/mock_sentry.go | 1 + 9 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index c7462a8d262..3996897d84a 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -37,7 +37,7 @@ jobs: run: sudo apt update && sudo apt install build-essential - name: test-integration - run: make test-integration + run: GOGC=80 make test-integration tests-windows: strategy: diff --git a/Makefile b/Makefile index aab922d9e06..55e035f8362 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE} GOBUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS) GO_DBG_BUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs -GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... -p 2 +GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... default: all diff --git a/erigon-lib/kv/mdbx/kv_mdbx.go b/erigon-lib/kv/mdbx/kv_mdbx.go index 968a24e2fa7..3d44a72c97d 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx.go +++ b/erigon-lib/kv/mdbx/kv_mdbx.go @@ -140,7 +140,7 @@ func (opts MdbxOpts) InMem(tmpDir string) MdbxOpts { opts.flags = mdbx.UtterlyNoSync | mdbx.NoMetaSync | mdbx.NoMemInit opts.growthStep = 2 * datasize.MB opts.mapSize = 512 * datasize.MB - opts.dirtySpace = uint64(128 * datasize.MB) + opts.dirtySpace = uint64(64 * datasize.MB) opts.shrinkThreshold = 0 // disable opts.label = kv.InMem return opts diff --git a/erigon-lib/kv/memdb/memory_database.go b/erigon-lib/kv/memdb/memory_database.go index d33c870748b..f8f3c327a73 100644 --- a/erigon-lib/kv/memdb/memory_database.go +++ b/erigon-lib/kv/memdb/memory_database.go @@ -51,7 +51,6 @@ func NewSentryDB(tmpDir string) kv.RwDB { func NewTestDB(tb testing.TB) kv.RwDB { tb.Helper() tmpDir := tb.TempDir() - tb.Helper() db := New(tmpDir) tb.Cleanup(db.Close) return db diff --git a/tests/block_test.go b/tests/block_test.go index 269dde4ab78..3003fd707a0 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -53,6 +53,7 @@ func TestBlockchain(t *testing.T) { checkStateRoot := true bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) { + t.Parallel() // import pre accounts & construct test genesis block & state root if err := bt.checkFailure(t, test.Run(t, checkStateRoot)); err != nil { t.Error(err) diff --git a/tests/block_test_util.go b/tests/block_test_util.go index dddba742728..83e7f174e62 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -124,6 +124,7 @@ func (bt *BlockTest) Run(t *testing.T, checkStateRoot bool) error { if !ok { return UnsupportedForkError{bt.json.Network} } + engine := ethconsensusconfig.CreateConsensusEngineBareBones(context.Background(), config, log.New()) m := mock.MockWithGenesisEngine(t, bt.genesis(config), engine, false, checkStateRoot) defer m.Close() diff --git a/tests/exec_spec_test.go b/tests/exec_spec_test.go index d8ea375f79a..e93e660f97b 100644 --- a/tests/exec_spec_test.go +++ b/tests/exec_spec_test.go @@ -35,6 +35,7 @@ func TestExecutionSpec(t *testing.T) { checkStateRoot := true bt.walk(t, dir, func(t *testing.T, name string, test *BlockTest) { + t.Parallel() // import pre accounts & construct test genesis block & state root if err := bt.checkFailure(t, test.Run(t, checkStateRoot)); err != nil { t.Error(err) diff --git a/tests/testdata b/tests/testdata index 92010754908..e46e1db503e 160000 --- a/tests/testdata +++ b/tests/testdata @@ -1 +1 @@ -Subproject commit 9201075490807f58811078e9bb5ec895b4ac01a5 +Subproject commit e46e1db503ee2711ad02e1f5b3ea45d43e9cd8cb diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index 10408fe7904..95cdfa94e2f 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -612,6 +612,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK if err = mock.InsertChain(c); err != nil { tb.Fatal(err) } + return mock }