Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
7b425259
Commit
7b425259
authored
Apr 20, 2023
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing wait timeout check
parent
26d2ba05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
hints_test.go
op-program/preimage/hints_test.go
+20
-11
No files found.
op-program/preimage/hints_test.go
View file @
7b425259
...
...
@@ -49,16 +49,8 @@ func TestHints(t *testing.T) {
require
.
NoError
(
t
,
err
)
}
}()
done
:=
make
(
chan
struct
{})
go
func
()
{
wg
.
Wait
()
close
(
done
)
}()
select
{
case
<-
time
.
After
(
time
.
Second
*
30
)
:
t
.
Error
(
"reader/writer stuck"
)
case
<-
done
:
if
waitTimeout
(
&
wg
)
{
t
.
Error
(
"hint read/write stuck"
)
}
require
.
Equal
(
t
,
len
(
hints
),
len
(
got
),
"got all hints"
)
...
...
@@ -121,6 +113,23 @@ func TestHints(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
readHint
,
"two"
)
}()
wg
.
Wait
()
if
waitTimeout
(
&
wg
)
{
t
.
Error
(
"read/write hint stuck"
)
}
})
}
// waitTimeout returns true iff wg.Wait timed out
func
waitTimeout
(
wg
*
sync
.
WaitGroup
)
bool
{
done
:=
make
(
chan
struct
{})
go
func
()
{
wg
.
Wait
()
close
(
done
)
}()
select
{
case
<-
time
.
After
(
time
.
Second
*
30
)
:
return
true
case
<-
done
:
return
false
}
}
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