diff options
author | 大彬 <hz_stb@163.com> | 2019-07-17 19:20:24 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2019-07-17 19:20:24 +0800 |
commit | 4ac04ae0feba560e93f0fad55772b8830b759d1b (patch) | |
tree | e3c966a6f538f7e7d4e4a9af9c35aad5386bd546 /eth | |
parent | 8f80cafa108cf0a762e0e34a6a4cd04021139bd1 (diff) | |
download | go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar.gz go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar.bz2 go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar.lz go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar.xz go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.tar.zst go-tangerine-4ac04ae0feba560e93f0fad55772b8830b759d1b.zip |
all: replace fmt.Print* calls with t.Log* in tests (#19670)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/downloader/downloader_test.go | 4 | ||||
-rw-r--r-- | eth/filters/bench_test.go | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index e1f0e03fc..b23043b1c 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -1614,8 +1614,8 @@ func TestRemoteHeaderRequestSpan(t *testing.T) { if failed { res := strings.Replace(fmt.Sprint(data), " ", ",", -1) exp := strings.Replace(fmt.Sprint(tt.expected), " ", ",", -1) - fmt.Printf("got: %v\n", res) - fmt.Printf("exp: %v\n", exp) + t.Logf("got: %v\n", res) + t.Logf("exp: %v\n", exp) t.Errorf("test %d: wrong values", i) } } diff --git a/eth/filters/bench_test.go b/eth/filters/bench_test.go index 434e6a44c..fc7e6f527 100644 --- a/eth/filters/bench_test.go +++ b/eth/filters/bench_test.go @@ -64,7 +64,7 @@ const benchFilterCnt = 2000 func benchmarkBloomBits(b *testing.B, sectionSize uint64) { benchDataDir := node.DefaultDataDir() + "/geth/chaindata" - fmt.Println("Running bloombits benchmark section size:", sectionSize) + b.Log("Running bloombits benchmark section size:", sectionSize) db, err := rawdb.NewLevelDBDatabase(benchDataDir, 128, 1024, "") if err != nil { @@ -76,7 +76,7 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { } clearBloomBits(db) - fmt.Println("Generating bloombits data...") + b.Log("Generating bloombits data...") headNum := rawdb.ReadHeaderNumber(db, head) if headNum == nil || *headNum < sectionSize+512 { b.Fatalf("not enough blocks for running a benchmark") @@ -111,16 +111,16 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { rawdb.WriteBloomBits(db, uint(i), sectionIdx, sectionHead, comp) } //if sectionIdx%50 == 0 { - // fmt.Println(" section", sectionIdx, "/", cnt) + // b.Log(" section", sectionIdx, "/", cnt) //} } d := time.Since(start) - fmt.Println("Finished generating bloombits data") - fmt.Println(" ", d, "total ", d/time.Duration(cnt*sectionSize), "per block") - fmt.Println(" data size:", dataSize, " compressed size:", compSize, " compression ratio:", float64(compSize)/float64(dataSize)) + b.Log("Finished generating bloombits data") + b.Log(" ", d, "total ", d/time.Duration(cnt*sectionSize), "per block") + b.Log(" data size:", dataSize, " compressed size:", compSize, " compression ratio:", float64(compSize)/float64(dataSize)) - fmt.Println("Running filter benchmarks...") + b.Log("Running filter benchmarks...") start = time.Now() mux := new(event.TypeMux) var backend *testBackend @@ -140,8 +140,8 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { } } d = time.Since(start) - fmt.Println("Finished running filter benchmarks") - fmt.Println(" ", d, "total ", d/time.Duration(benchFilterCnt), "per address", d*time.Duration(1000000)/time.Duration(benchFilterCnt*cnt*sectionSize), "per million blocks") + b.Log("Finished running filter benchmarks") + b.Log(" ", d, "total ", d/time.Duration(benchFilterCnt), "per address", d*time.Duration(1000000)/time.Duration(benchFilterCnt*cnt*sectionSize), "per million blocks") db.Close() } @@ -158,7 +158,7 @@ func clearBloomBits(db ethdb.Database) { func BenchmarkNoBloomBits(b *testing.B) { benchDataDir := node.DefaultDataDir() + "/geth/chaindata" - fmt.Println("Running benchmark without bloombits") + b.Log("Running benchmark without bloombits") db, err := rawdb.NewLevelDBDatabase(benchDataDir, 128, 1024, "") if err != nil { b.Fatalf("error opening database at %v: %v", benchDataDir, err) @@ -171,14 +171,14 @@ func BenchmarkNoBloomBits(b *testing.B) { clearBloomBits(db) - fmt.Println("Running filter benchmarks...") + b.Log("Running filter benchmarks...") start := time.Now() mux := new(event.TypeMux) backend := &testBackend{mux, db, 0, new(event.Feed), new(event.Feed), new(event.Feed), new(event.Feed)} filter := NewRangeFilter(backend, 0, int64(*headNum), []common.Address{{}}, nil) filter.Logs(context.Background()) d := time.Since(start) - fmt.Println("Finished running filter benchmarks") - fmt.Println(" ", d, "total ", d*time.Duration(1000000)/time.Duration(*headNum+1), "per million blocks") + b.Log("Finished running filter benchmarks") + b.Log(" ", d, "total ", d*time.Duration(1000000)/time.Duration(*headNum+1), "per million blocks") db.Close() } |