Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
8cde2966
Unverified
Commit
8cde2966
authored
Dec 15, 2020
by
Martin Holst Swende
Committed by
GitHub
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth, core: speed up some tests (#22000)
parent
0fe66f8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
matcher_test.go
core/bloombits/matcher_test.go
+6
-0
scheduler_test.go
core/bloombits/scheduler_test.go
+3
-2
No files found.
core/bloombits/matcher_test.go
View file @
8cde2966
...
...
@@ -30,6 +30,7 @@ const testSectionSize = 4096
// Tests that wildcard filter rules (nil) can be specified and are handled well.
func
TestMatcherWildcards
(
t
*
testing
.
T
)
{
t
.
Parallel
()
matcher
:=
NewMatcher
(
testSectionSize
,
[][][]
byte
{
{
common
.
Address
{}
.
Bytes
(),
common
.
Address
{
0x01
}
.
Bytes
()},
// Default address is not a wildcard
{
common
.
Hash
{}
.
Bytes
(),
common
.
Hash
{
0x01
}
.
Bytes
()},
// Default hash is not a wildcard
...
...
@@ -56,6 +57,7 @@ func TestMatcherWildcards(t *testing.T) {
// Tests the matcher pipeline on a single continuous workflow without interrupts.
func
TestMatcherContinuous
(
t
*
testing
.
T
)
{
t
.
Parallel
()
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
10
,
20
,
30
}}},
0
,
100000
,
false
,
75
)
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
32
,
3125
,
100
}},
{{
40
,
50
,
10
}}},
0
,
100000
,
false
,
81
)
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
4
,
8
,
11
},
{
7
,
8
,
17
}},
{{
9
,
9
,
12
},
{
15
,
20
,
13
}},
{{
18
,
15
,
15
},
{
12
,
10
,
4
}}},
0
,
10000
,
false
,
36
)
...
...
@@ -64,6 +66,7 @@ func TestMatcherContinuous(t *testing.T) {
// Tests the matcher pipeline on a constantly interrupted and resumed work pattern
// with the aim of ensuring data items are requested only once.
func
TestMatcherIntermittent
(
t
*
testing
.
T
)
{
t
.
Parallel
()
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
10
,
20
,
30
}}},
0
,
100000
,
true
,
75
)
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
32
,
3125
,
100
}},
{{
40
,
50
,
10
}}},
0
,
100000
,
true
,
81
)
testMatcherDiffBatches
(
t
,
[][]
bloomIndexes
{{{
4
,
8
,
11
},
{
7
,
8
,
17
}},
{{
9
,
9
,
12
},
{
15
,
20
,
13
}},
{{
18
,
15
,
15
},
{
12
,
10
,
4
}}},
0
,
10000
,
true
,
36
)
...
...
@@ -71,6 +74,7 @@ func TestMatcherIntermittent(t *testing.T) {
// Tests the matcher pipeline on random input to hopefully catch anomalies.
func
TestMatcherRandom
(
t
*
testing
.
T
)
{
t
.
Parallel
()
for
i
:=
0
;
i
<
10
;
i
++
{
testMatcherBothModes
(
t
,
makeRandomIndexes
([]
int
{
1
},
50
),
0
,
10000
,
0
)
testMatcherBothModes
(
t
,
makeRandomIndexes
([]
int
{
3
},
50
),
0
,
10000
,
0
)
...
...
@@ -84,6 +88,7 @@ func TestMatcherRandom(t *testing.T) {
// shifter from a multiple of 8. This is needed to cover an optimisation with
// bitset matching https://github.com/ethereum/go-ethereum/issues/15309.
func
TestMatcherShifted
(
t
*
testing
.
T
)
{
t
.
Parallel
()
// Block 0 always matches in the tests, skip ahead of first 8 blocks with the
// start to get a potential zero byte in the matcher bitset.
...
...
@@ -97,6 +102,7 @@ func TestMatcherShifted(t *testing.T) {
// Tests that matching on everything doesn't crash (special case internally).
func
TestWildcardMatcher
(
t
*
testing
.
T
)
{
t
.
Parallel
()
testMatcherBothModes
(
t
,
nil
,
0
,
10000
,
0
)
}
...
...
core/bloombits/scheduler_test.go
View file @
8cde2966
...
...
@@ -35,6 +35,7 @@ func TestSchedulerMultiClientSingleFetcher(t *testing.T) { testScheduler(t, 10,
func
TestSchedulerMultiClientMultiFetcher
(
t
*
testing
.
T
)
{
testScheduler
(
t
,
10
,
10
,
5000
)
}
func
testScheduler
(
t
*
testing
.
T
,
clients
int
,
fetchers
int
,
requests
int
)
{
t
.
Parallel
()
f
:=
newScheduler
(
0
)
// Create a batch of handler goroutines that respond to bloom bit requests and
...
...
@@ -88,10 +89,10 @@ func testScheduler(t *testing.T, clients int, fetchers int, requests int) {
}
close
(
in
)
}()
b
:=
new
(
big
.
Int
)
for
j
:=
0
;
j
<
requests
;
j
++
{
bits
:=
<-
out
if
want
:=
new
(
big
.
Int
)
.
SetUint64
(
uint64
(
j
))
.
Bytes
();
!
bytes
.
Equal
(
bits
,
want
)
{
if
want
:=
b
.
SetUint64
(
uint64
(
j
))
.
Bytes
();
!
bytes
.
Equal
(
bits
,
want
)
{
t
.
Errorf
(
"vector %d: delivered content mismatch: have %x, want %x"
,
j
,
bits
,
want
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment