mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
some docs, rename helper func, specify default value for indices (glob all)
This commit is contained in:
parent
46040cc544
commit
96fbf667c2
1 changed files with 6 additions and 5 deletions
|
|
@ -44,6 +44,7 @@ var (
|
||||||
Name: "subtest.index",
|
Name: "subtest.index",
|
||||||
Usage: "The index of the subtest to run",
|
Usage: "The index of the subtest to run",
|
||||||
Category: flags.VMCategory,
|
Category: flags.VMCategory,
|
||||||
|
Value: -1, // default to select all subtest indices
|
||||||
}
|
}
|
||||||
TestNameFlag = &cli.StringFlag{
|
TestNameFlag = &cli.StringFlag{
|
||||||
Name: "subtest.name",
|
Name: "subtest.name",
|
||||||
|
|
@ -114,7 +115,8 @@ type stateTestCase struct {
|
||||||
st tests.StateSubtest
|
st tests.StateSubtest
|
||||||
}
|
}
|
||||||
|
|
||||||
func aggregateSubtests(ctx *cli.Context, testsByName map[string]tests.StateTest) []stateTestCase {
|
// collectMatchedSubtests returns test cases which match against provided filtering CLI parameters
|
||||||
|
func collectMatchedSubtests(ctx *cli.Context, testsByName map[string]tests.StateTest) []stateTestCase {
|
||||||
res := []stateTestCase{}
|
res := []stateTestCase{}
|
||||||
|
|
||||||
subtestName := ctx.String(TestNameFlag.Name)
|
subtestName := ctx.String(TestNameFlag.Name)
|
||||||
|
|
@ -152,7 +154,7 @@ func runStateTest(ctx *cli.Context, fname string, cfg vm.Config, dump bool, benc
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
matchingTests := aggregateSubtests(ctx, testsByName)
|
matchingTests := collectMatchedSubtests(ctx, testsByName)
|
||||||
|
|
||||||
// Iterate over all the tests, run them and aggregate the results
|
// Iterate over all the tests, run them and aggregate the results
|
||||||
results := make([]StatetestResult, 0, len(testsByName))
|
results := make([]StatetestResult, 0, len(testsByName))
|
||||||
|
|
@ -189,10 +191,9 @@ func runStateTest(ctx *cli.Context, fname string, cfg vm.Config, dump bool, benc
|
||||||
var gasUsed uint64
|
var gasUsed uint64
|
||||||
result := testing.Benchmark(func(b *testing.B) {
|
result := testing.Benchmark(func(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for _, test := range matchingTests {
|
test := matchingTests[0]
|
||||||
_, _, gasUsed, _ = test.test.RunNoVerify(test.st, cfg, false, rawdb.HashScheme)
|
_, _, gasUsed, _ = test.test.RunNoVerify(test.st, cfg, false, rawdb.HashScheme)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
var stats execStats
|
var stats execStats
|
||||||
// Get the average execution time from the benchmarking result.
|
// Get the average execution time from the benchmarking result.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue