mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 21:07:17 +00:00
Minor cleanup
This commit is contained in:
parent
49336675f3
commit
a86452d22c
@ -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 (
|
|||||||
}
|
}
|
||||||
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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
|||||||
// 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) {
|
|||||||
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 flagTest == defaultTest {
|
if test == defaultTest {
|
||||||
tests = allTests
|
tests = allTests
|
||||||
} else {
|
} else {
|
||||||
tests = []string{flagTest}
|
tests = []string{test}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, curTest := range tests {
|
for _, curTest := range tests {
|
||||||
// glog.Infoln("runSuite", curTest, flagFile)
|
// glog.Infoln("runSuite", curTest, file)
|
||||||
var err error
|
var err error
|
||||||
var files []string
|
var files []string
|
||||||
if flagTest == defaultTest {
|
if test == defaultTest {
|
||||||
files, err = getFiles(filepath.Join(flagFile, curTest))
|
files, err = getFiles(filepath.Join(file, curTest))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
files, err = getFiles(flagFile)
|
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) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user