Merge pull request #1640 from obscuren/trace-flag-ethtest

cmd/ethtest: added trace flag for debugging
This commit is contained in:
Jeffrey Wilcke 2015-08-11 02:53:02 -07:00
commit c32d6fdf74

View File

@ -26,6 +26,7 @@ import (
"strings" "strings"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/tests" "github.com/ethereum/go-ethereum/tests"
) )
@ -62,6 +63,10 @@ var (
Name: "skip", Name: "skip",
Usage: "Tests names to skip", Usage: "Tests names to skip",
} }
TraceFlag = cli.BoolFlag{
Name: "trace",
Usage: "Enable VM tracing",
}
) )
func runTestWithReader(test string, r io.Reader) error { func runTestWithReader(test string, r io.Reader) error {
@ -173,7 +178,6 @@ func runSuite(test, file string) {
glog.Fatalln(err) glog.Fatalln(err)
} }
} }
} }
} }
} }
@ -184,6 +188,7 @@ func setupApp(c *cli.Context) {
continueOnError = c.GlobalBool(ContinueOnErrorFlag.Name) continueOnError = c.GlobalBool(ContinueOnErrorFlag.Name)
useStdIn := c.GlobalBool(ReadStdInFlag.Name) useStdIn := c.GlobalBool(ReadStdInFlag.Name)
skipTests = strings.Split(c.GlobalString(SkipTestsFlag.Name), " ") skipTests = strings.Split(c.GlobalString(SkipTestsFlag.Name), " ")
vm.Debug = c.GlobalBool(TraceFlag.Name)
if !useStdIn { if !useStdIn {
runSuite(flagTest, flagFile) runSuite(flagTest, flagFile)
@ -211,6 +216,7 @@ func main() {
ContinueOnErrorFlag, ContinueOnErrorFlag,
ReadStdInFlag, ReadStdInFlag,
SkipTestsFlag, SkipTestsFlag,
TraceFlag,
} }
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {