mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
try a fix for test to pass on Windows
We try to solve the following error:
```
--- FAIL: TestSupplySelfdestruct (1.56s)
testing.go:1231: TempDir RemoveAll cleanup: remove C:\Users\appveyor\AppData\Local\Temp\1\TestSupplySelfdestruct3803137642\001\supply.jsonl: The process cannot access the file because it is being used by another process.
```
This commit is contained in:
parent
91260a7c29
commit
4320189830
1 changed files with 2 additions and 1 deletions
|
|
@ -530,13 +530,14 @@ func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockG
|
||||||
|
|
||||||
traceOutputPath := filepath.ToSlash(t.TempDir())
|
traceOutputPath := filepath.ToSlash(t.TempDir())
|
||||||
traceOutputFilename := path.Join(traceOutputPath, "supply.jsonl")
|
traceOutputFilename := path.Join(traceOutputPath, "supply.jsonl")
|
||||||
defer os.Remove(traceOutputFilename)
|
|
||||||
|
|
||||||
// Load supply tracer
|
// Load supply tracer
|
||||||
tracer, err := tracers.LiveDirectory.New("supply", json.RawMessage(fmt.Sprintf(`{"path":"%s"}`, traceOutputPath)))
|
tracer, err := tracers.LiveDirectory.New("supply", json.RawMessage(fmt.Sprintf(`{"path":"%s"}`, traceOutputPath)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to create call tracer: %v", err)
|
return nil, nil, fmt.Errorf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
// hack so as the supply log file handler closes, for tests to work on windows
|
||||||
|
defer func() { tracer = nil }()
|
||||||
|
|
||||||
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), core.DefaultCacheConfigWithScheme(rawdb.PathScheme), genesis, nil, engine, vm.Config{Tracer: tracer}, nil, nil)
|
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), core.DefaultCacheConfigWithScheme(rawdb.PathScheme), genesis, nil, engine, vm.Config{Tracer: tracer}, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue