mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
try alternative tempdir
This commit is contained in:
parent
3a6cf0a4a0
commit
53f61525f2
1 changed files with 9 additions and 11 deletions
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -74,7 +73,7 @@ func TestSupplyGenesisAlloc(t *testing.T) {
|
||||||
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
}
|
}
|
||||||
|
|
||||||
out, _, err := testSupplyTracer(gspec, emptyBlockGenerationFunc)
|
out, _, err := testSupplyTracer(t, gspec, emptyBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to test supply tracer: %v", err)
|
t.Fatalf("failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +104,7 @@ func TestSupplyRewards(t *testing.T) {
|
||||||
ParentHash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
|
ParentHash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
|
||||||
}
|
}
|
||||||
|
|
||||||
out, _, err := testSupplyTracer(gspec, emptyBlockGenerationFunc)
|
out, _, err := testSupplyTracer(t, gspec, emptyBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to test supply tracer: %v", err)
|
t.Fatalf("failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +153,7 @@ func TestSupplyEip1559Burn(t *testing.T) {
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, chain, err := testSupplyTracer(gspec, eip1559BlockGenerationFunc)
|
out, chain, err := testSupplyTracer(t, gspec, eip1559BlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to test supply tracer: %v", err)
|
t.Fatalf("failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +196,7 @@ func TestSupplyWithdrawals(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
out, chain, err := testSupplyTracer(gspec, withdrawalsBlockGenerationFunc)
|
out, chain, err := testSupplyTracer(t, gspec, withdrawalsBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to test supply tracer: %v", err)
|
t.Fatalf("failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +279,7 @@ func TestSupplySelfdestruct(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Test pre Cancun
|
// 1. Test pre Cancun
|
||||||
preCancunOutput, preCancunChain, err := testSupplyTracer(gspec, testBlockGenerationFunc)
|
preCancunOutput, preCancunChain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Pre-cancun failed to test supply tracer: %v", err)
|
t.Fatalf("Pre-cancun failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -323,7 +322,7 @@ func TestSupplySelfdestruct(t *testing.T) {
|
||||||
gspec.Config.ShanghaiTime = &cancunTime
|
gspec.Config.ShanghaiTime = &cancunTime
|
||||||
gspec.Config.CancunTime = &cancunTime
|
gspec.Config.CancunTime = &cancunTime
|
||||||
|
|
||||||
postCancunOutput, postCancunChain, err := testSupplyTracer(gspec, testBlockGenerationFunc)
|
postCancunOutput, postCancunChain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Post-cancun failed to test supply tracer: %v", err)
|
t.Fatalf("Post-cancun failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -466,7 +465,7 @@ func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
output, chain, err := testSupplyTracer(gspec, testBlockGenerationFunc)
|
output, chain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to test supply tracer: %v", err)
|
t.Fatalf("failed to test supply tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -512,14 +511,13 @@ func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSupplyTracer(genesis *core.Genesis, gen func(*core.BlockGen)) ([]live.SupplyInfo, *core.BlockChain, error) {
|
func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockGen)) ([]live.SupplyInfo, *core.BlockChain, error) {
|
||||||
var (
|
var (
|
||||||
engine = beacon.New(ethash.NewFaker())
|
engine = beacon.New(ethash.NewFaker())
|
||||||
)
|
)
|
||||||
|
|
||||||
traceOutputPath := filepath.ToSlash(os.TempDir())
|
traceOutputPath := 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)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue