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
Jun 12, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup
parent
49336675
Changes
1
Hide 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 @@
/**
* @authors:
* Jeffrey Wilcke <i@jev.io>
* Taylor Gerring <taylor.gerring@gmail.com>
*/
package
main
...
...
@@ -52,7 +53,7 @@ var (
}
ContinueOnErrorFlag
=
cli
.
BoolFlag
{
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 {
}
func
getFiles
(
path
string
)
([]
string
,
error
)
{
// glog.Infoln("getFiles
", path)
// glog.Infoln("getFiles", path)
var
files
[]
string
f
,
err
:=
os
.
Open
(
path
)
if
err
!=
nil
{
...
...
@@ -96,7 +97,7 @@ func getFiles(path string) ([]string, error) {
// only go 1 depth and leave directory entires blank
if
!
v
.
IsDir
()
&&
v
.
Name
()[
len
(
v
.
Name
())
-
len
(
testExtension
)
:
len
(
v
.
Name
())]
==
testExtension
{
files
[
i
]
=
filepath
.
Join
(
path
,
v
.
Name
())
// glog.Infoln(files[i])
// glog.Infoln(
"Found file",
files[i])
}
}
case
mode
.
IsRegular
()
:
...
...
@@ -107,28 +108,24 @@ func getFiles(path string) ([]string, error) {
return
files
,
nil
}
func
runSuite
(
c
*
cli
.
Context
)
{
flagTest
:=
c
.
GlobalString
(
TestFlag
.
Name
)
flagFile
:=
c
.
GlobalString
(
FileFlag
.
Name
)
continueOnError
=
c
.
GlobalBool
(
ContinueOnErrorFlag
.
Name
)
func
runSuite
(
test
,
file
string
)
{
var
tests
[]
string
if
flagT
est
==
defaultTest
{
if
t
est
==
defaultTest
{
tests
=
allTests
}
else
{
tests
=
[]
string
{
flagT
est
}
tests
=
[]
string
{
t
est
}
}
for
_
,
curTest
:=
range
tests
{
// glog.Infoln("runSuite", curTest, f
lagF
ile)
// glog.Infoln("runSuite", curTest, file)
var
err
error
var
files
[]
string
if
flagT
est
==
defaultTest
{
files
,
err
=
getFiles
(
filepath
.
Join
(
f
lagF
ile
,
curTest
))
if
t
est
==
defaultTest
{
files
,
err
=
getFiles
(
filepath
.
Join
(
file
,
curTest
))
}
else
{
files
,
err
=
getFiles
(
f
lagF
ile
)
files
,
err
=
getFiles
(
file
)
}
if
err
!=
nil
{
glog
.
Fatalln
(
err
)
...
...
@@ -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
()
{
glog
.
SetToStderr
(
true
)
// vm.Debug = true
app
:=
cli
.
NewApp
()
app
.
Name
=
"ethtest"
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
{
TestFlag
,
FileFlag
,
...
...
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