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
a86452d2
Commit
a86452d2
authored
10 years ago
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup
parent
49336675
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
main.go
cmd/ethtest/main.go
+23
-17
No files found.
cmd/ethtest/main.go
View file @
a86452d2
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
/**
/**
* @authors:
* @authors:
* Jeffrey Wilcke <i@jev.io>
* Jeffrey Wilcke <i@jev.io>
* Taylor Gerring <taylor.gerring@gmail.com>
*/
*/
package
main
package
main
...
@@ -52,7 +53,7 @@ var (
...
@@ -52,7 +53,7 @@ var (
}
}
ContinueOnErrorFlag
=
cli
.
BoolFlag
{
ContinueOnErrorFlag
=
cli
.
BoolFlag
{
Name
:
"continue"
,
Name
:
"continue"
,
Usage
:
"Continue running tests on error (true) or exit immediately (false)"
,
Usage
:
"Continue running tests on error (true) or
[default]
exit immediately (false)"
,
}
}
)
)
...
@@ -75,7 +76,7 @@ func runTest(test, file string) error {
...
@@ -75,7 +76,7 @@ func runTest(test, file string) error {
}
}
func
getFiles
(
path
string
)
([]
string
,
error
)
{
func
getFiles
(
path
string
)
([]
string
,
error
)
{
// glog.Infoln("getFiles
", path)
// glog.Infoln("getFiles", path)
var
files
[]
string
var
files
[]
string
f
,
err
:=
os
.
Open
(
path
)
f
,
err
:=
os
.
Open
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -96,7 +97,7 @@ func getFiles(path string) ([]string, error) {
...
@@ -96,7 +97,7 @@ func getFiles(path string) ([]string, error) {
// only go 1 depth and leave directory entires blank
// only go 1 depth and leave directory entires blank
if
!
v
.
IsDir
()
&&
v
.
Name
()[
len
(
v
.
Name
())
-
len
(
testExtension
)
:
len
(
v
.
Name
())]
==
testExtension
{
if
!
v
.
IsDir
()
&&
v
.
Name
()[
len
(
v
.
Name
())
-
len
(
testExtension
)
:
len
(
v
.
Name
())]
==
testExtension
{
files
[
i
]
=
filepath
.
Join
(
path
,
v
.
Name
())
files
[
i
]
=
filepath
.
Join
(
path
,
v
.
Name
())
// glog.Infoln(files[i])
// glog.Infoln(
"Found file",
files[i])
}
}
}
}
case
mode
.
IsRegular
()
:
case
mode
.
IsRegular
()
:
...
@@ -107,28 +108,24 @@ func getFiles(path string) ([]string, error) {
...
@@ -107,28 +108,24 @@ func getFiles(path string) ([]string, error) {
return
files
,
nil
return
files
,
nil
}
}
func
runSuite
(
c
*
cli
.
Context
)
{
func
runSuite
(
test
,
file
string
)
{
flagTest
:=
c
.
GlobalString
(
TestFlag
.
Name
)
flagFile
:=
c
.
GlobalString
(
FileFlag
.
Name
)
continueOnError
=
c
.
GlobalBool
(
ContinueOnErrorFlag
.
Name
)
var
tests
[]
string
var
tests
[]
string
if
flagT
est
==
defaultTest
{
if
t
est
==
defaultTest
{
tests
=
allTests
tests
=
allTests
}
else
{
}
else
{
tests
=
[]
string
{
flagT
est
}
tests
=
[]
string
{
t
est
}
}
}
for
_
,
curTest
:=
range
tests
{
for
_
,
curTest
:=
range
tests
{
// glog.Infoln("runSuite", curTest, f
lagF
ile)
// glog.Infoln("runSuite", curTest, file)
var
err
error
var
err
error
var
files
[]
string
var
files
[]
string
if
flagT
est
==
defaultTest
{
if
t
est
==
defaultTest
{
files
,
err
=
getFiles
(
filepath
.
Join
(
f
lagF
ile
,
curTest
))
files
,
err
=
getFiles
(
filepath
.
Join
(
file
,
curTest
))
}
else
{
}
else
{
files
,
err
=
getFiles
(
f
lagF
ile
)
files
,
err
=
getFiles
(
file
)
}
}
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalln
(
err
)
glog
.
Fatalln
(
err
)
...
@@ -159,15 +156,24 @@ func runSuite(c *cli.Context) {
...
@@ -159,15 +156,24 @@ func runSuite(c *cli.Context) {
}
}
}
}
func
setupApp
(
c
*
cli
.
Context
)
{
flagTest
:=
c
.
GlobalString
(
TestFlag
.
Name
)
flagFile
:=
c
.
GlobalString
(
FileFlag
.
Name
)
continueOnError
=
c
.
GlobalBool
(
ContinueOnErrorFlag
.
Name
)
runSuite
(
flagTest
,
flagFile
)
}
func
main
()
{
func
main
()
{
glog
.
SetToStderr
(
true
)
glog
.
SetToStderr
(
true
)
// vm.Debug = true
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Name
=
"ethtest"
app
.
Name
=
"ethtest"
app
.
Usage
=
"go-ethereum test interface"
app
.
Usage
=
"go-ethereum test interface"
app
.
Action
=
runSuite
app
.
Action
=
setupApp
app
.
Version
=
"0.2.0"
app
.
Author
=
"go-ethereum team"
app
.
Flags
=
[]
cli
.
Flag
{
app
.
Flags
=
[]
cli
.
Flag
{
TestFlag
,
TestFlag
,
FileFlag
,
FileFlag
,
...
...
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