diff options
Diffstat (limited to 'cmd/ethtest/main.go')
-rw-r--r-- | cmd/ethtest/main.go | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 61276b177..67b965396 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -8,11 +8,11 @@ // // go-ethereum is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. // ethtest executes Ethereum JSON tests. package main @@ -26,6 +26,7 @@ import ( "strings" "github.com/codegangsta/cli" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/tests" ) @@ -35,7 +36,8 @@ var ( testExtension = ".json" defaultTest = "all" defaultDir = "." - allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests"} + allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests", "RLPTests"} + testDirMapping = map[string]string{"BlockTests": "BlockchainTests"} skipTests = []string{} TestFlag = cli.StringFlag{ @@ -61,6 +63,10 @@ var ( Name: "skip", Usage: "Tests names to skip", } + TraceFlag = cli.BoolFlag{ + Name: "trace", + Usage: "Enable VM tracing", + } ) func runTestWithReader(test string, r io.Reader) error { @@ -75,6 +81,8 @@ func runTestWithReader(test string, r io.Reader) error { err = tests.RunTransactionTestsWithReader(r, skipTests) case "vm", "vmtest", "vmtests": err = tests.RunVmTestWithReader(r, skipTests) + case "rlp", "rlptest", "rlptests": + err = tests.RunRLPTestWithReader(r, skipTests) default: err = fmt.Errorf("Invalid test type specified: %v", test) } @@ -133,8 +141,13 @@ func runSuite(test, file string) { var err error var files []string if test == defaultTest { - files, err = getFiles(filepath.Join(file, curTest)) - + // check if we have an explicit directory mapping for the test + if _, ok := testDirMapping[curTest]; ok { + files, err = getFiles(filepath.Join(file, testDirMapping[curTest])) + } else { + // otherwise assume test name + files, err = getFiles(filepath.Join(file, curTest)) + } } else { files, err = getFiles(file) } @@ -165,7 +178,6 @@ func runSuite(test, file string) { glog.Fatalln(err) } } - } } } @@ -176,6 +188,7 @@ func setupApp(c *cli.Context) { continueOnError = c.GlobalBool(ContinueOnErrorFlag.Name) useStdIn := c.GlobalBool(ReadStdInFlag.Name) skipTests = strings.Split(c.GlobalString(SkipTestsFlag.Name), " ") + vm.Debug = c.GlobalBool(TraceFlag.Name) if !useStdIn { runSuite(flagTest, flagFile) @@ -203,6 +216,7 @@ func main() { ContinueOnErrorFlag, ReadStdInFlag, SkipTestsFlag, + TraceFlag, } if err := app.Run(os.Args); err != nil { |