plugeth/cmd/ethtest/main.go

84 lines
1.9 KiB
Go
Raw Normal View History

2014-11-11 22:14:22 +00:00
/*
This file is part of go-ethereum
go-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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
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/>.
*/
/**
2014-11-14 23:29:27 +00:00
* @authors:
2014-11-11 22:14:22 +00:00
* Jeffrey Wilcke <i@jev.io>
*/
2014-10-16 19:34:59 +00:00
package main
import (
"os"
2015-04-10 17:59:07 +00:00
"github.com/ethereum/go-ethereum/logger/glog"
2015-06-10 22:14:04 +00:00
"github.com/ethereum/go-ethereum/tests"
2014-10-16 19:34:59 +00:00
)
func main() {
2015-06-11 17:06:56 +00:00
glog.SetToStderr(true)
2015-06-10 22:14:04 +00:00
// vm.Debug = true
2014-10-16 19:34:59 +00:00
2015-06-08 20:03:21 +00:00
if len(os.Args) < 2 {
glog.Exit("Must specify test type")
2015-01-09 11:04:54 +00:00
}
2015-06-08 20:03:21 +00:00
test := os.Args[1]
2015-06-10 22:14:04 +00:00
// var code int
2015-06-08 20:03:21 +00:00
switch test {
case "vm", "VMTests":
2015-06-10 22:14:04 +00:00
if len(os.Args) > 2 {
if err := tests.RunVmTest(os.Args[2]); err != nil {
glog.Errorln(err)
}
} else {
glog.Exit("Must supply file argument")
}
2015-06-08 20:03:21 +00:00
case "state", "StateTest":
if len(os.Args) > 2 {
2015-06-10 22:14:04 +00:00
if err := tests.RunStateTest(os.Args[2]); err != nil {
glog.Errorln(err)
}
// code = RunVmTest(strings.NewReader(os.Args[2]))
2015-06-08 20:03:21 +00:00
} else {
2015-06-10 22:14:04 +00:00
glog.Exit("Must supply file argument")
// code = RunVmTest(os.Stdin)
2015-06-08 20:03:21 +00:00
}
case "tx", "TransactionTests":
2015-06-10 22:14:04 +00:00
if len(os.Args) > 2 {
if err := tests.RunTransactionTests(os.Args[2]); err != nil {
glog.Errorln(err)
}
} else {
glog.Exit("Must supply file argument")
}
2015-06-08 20:03:21 +00:00
case "bc", "BlockChainTest":
2015-06-10 22:14:04 +00:00
if len(os.Args) > 2 {
if err := tests.RunBlockTest(os.Args[2]); err != nil {
glog.Errorln(err)
}
} else {
glog.Exit("Must supply file argument")
}
2015-06-08 20:03:21 +00:00
default:
glog.Exit("Invalid test type specified")
}
2015-06-10 22:14:04 +00:00
// os.Exit(code)
2014-10-16 19:34:59 +00:00
}