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
6b985808
Unverified
Commit
6b985808
authored
4 years ago
by
Martin Holst Swende
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: improve les test on windows (#21860)
parent
db872232
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
les_test.go
cmd/geth/les_test.go
+26
-2
No files found.
cmd/geth/les_test.go
View file @
6b985808
...
...
@@ -2,7 +2,10 @@ package main
import
(
"context"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
...
...
@@ -95,6 +98,27 @@ func (g *gethrpc) waitSynced() {
}
}
// ipcEndpoint resolves an IPC endpoint based on a configured value, taking into
// account the set data folders as well as the designated platform we're currently
// running on.
func
ipcEndpoint
(
ipcPath
,
datadir
string
)
string
{
// On windows we can only use plain top-level pipes
if
runtime
.
GOOS
==
"windows"
{
if
strings
.
HasPrefix
(
ipcPath
,
`\\.\pipe\`
)
{
return
ipcPath
}
return
`\\.\pipe\`
+
ipcPath
}
// Resolve names into the data directory full paths otherwise
if
filepath
.
Base
(
ipcPath
)
==
ipcPath
{
if
datadir
==
""
{
return
filepath
.
Join
(
os
.
TempDir
(),
ipcPath
)
}
return
filepath
.
Join
(
datadir
,
ipcPath
)
}
return
ipcPath
}
func
startGethWithIpc
(
t
*
testing
.
T
,
name
string
,
args
...
string
)
*
gethrpc
{
g
:=
&
gethrpc
{
name
:
name
}
args
=
append
([]
string
{
"--networkid=42"
,
"--port=0"
,
"--nousb"
},
args
...
)
...
...
@@ -103,10 +127,10 @@ func startGethWithIpc(t *testing.T, name string, args ...string) *gethrpc {
// wait before we can attach to it. TODO: probe for it properly
time
.
Sleep
(
1
*
time
.
Second
)
var
err
error
ipcpath
:=
filepath
.
Join
(
g
.
geth
.
Datadir
,
"geth.ipc"
)
ipcpath
:=
ipcEndpoint
(
"geth.ipc"
,
g
.
geth
.
Datadir
)
g
.
rpc
,
err
=
rpc
.
Dial
(
ipcpath
)
if
err
!=
nil
{
t
.
Fatalf
(
"%v rpc connect
: %v"
,
name
,
err
)
t
.
Fatalf
(
"%v rpc connect
to %v: %v"
,
name
,
ipcpath
,
err
)
}
return
g
}
...
...
This diff is collapsed.
Click to expand it.
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