Add --skip option to CLI

Disassociates hardcoded tests to skip when running via CLI. Tests still
skipped when running `go test`
This commit is contained in:
Taylor Gerring 2015-06-19 11:38:23 +02:00
parent a9659e6dcf
commit 0743243dce
9 changed files with 96 additions and 81 deletions

@ -28,6 +28,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
@ -40,6 +41,7 @@ var (
defaultTest = "all" defaultTest = "all"
defaultDir = "." defaultDir = "."
allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests"} allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests"}
skipTests = []string{}
TestFlag = cli.StringFlag{ TestFlag = cli.StringFlag{
Name: "test", Name: "test",
@ -60,6 +62,10 @@ var (
Name: "stdin", Name: "stdin",
Usage: "Accept input from stdin instead of reading from file", Usage: "Accept input from stdin instead of reading from file",
} }
SkipTestsFlag = cli.StringFlag{
Name: "skip",
Usage: "Tests names to skip",
}
) )
func runTestWithReader(test string, r io.Reader) error { func runTestWithReader(test string, r io.Reader) error {
@ -67,13 +73,13 @@ func runTestWithReader(test string, r io.Reader) error {
var err error var err error
switch test { switch test {
case "bt", "BlockTest", "BlockTests", "BlockChainTest": case "bt", "BlockTest", "BlockTests", "BlockChainTest":
err = tests.RunBlockTestWithReader(r) err = tests.RunBlockTestWithReader(r, skipTests)
case "st", "state", "StateTest", "StateTests": case "st", "state", "StateTest", "StateTests":
err = tests.RunStateTestWithReader(r) err = tests.RunStateTestWithReader(r, skipTests)
case "tx", "TransactionTest", "TransactionTests": case "tx", "TransactionTest", "TransactionTests":
err = tests.RunTransactionTestsWithReader(r) err = tests.RunTransactionTestsWithReader(r, skipTests)
case "vm", "VMTest", "VMTests": case "vm", "VMTest", "VMTests":
err = tests.RunVmTestWithReader(r) err = tests.RunVmTestWithReader(r, skipTests)
default: default:
err = fmt.Errorf("Invalid test type specified: %v", test) err = fmt.Errorf("Invalid test type specified: %v", test)
} }
@ -174,6 +180,7 @@ func setupApp(c *cli.Context) {
flagFile := c.GlobalString(FileFlag.Name) flagFile := c.GlobalString(FileFlag.Name)
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), " ")
if !useStdIn { if !useStdIn {
runSuite(flagTest, flagFile) runSuite(flagTest, flagFile)
@ -200,6 +207,7 @@ func main() {
FileFlag, FileFlag,
ContinueOnErrorFlag, ContinueOnErrorFlag,
ReadStdInFlag, ReadStdInFlag,
SkipTestsFlag,
} }
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {

@ -6,67 +6,67 @@ import (
) )
func TestBcValidBlockTests(t *testing.T) { func TestBcValidBlockTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcValidBlockTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcValidBlockTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcUncleTests(t *testing.T) { func TestBcUncleTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
err = RunBlockTest(filepath.Join(blockTestDir, "bcBruncleTest.json")) err = RunBlockTest(filepath.Join(blockTestDir, "bcBruncleTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcUncleHeaderValidityTests(t *testing.T) { func TestBcUncleHeaderValidityTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleHeaderValiditiy.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleHeaderValiditiy.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcInvalidHeaderTests(t *testing.T) { func TestBcInvalidHeaderTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidHeaderTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidHeaderTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcInvalidRLPTests(t *testing.T) { func TestBcInvalidRLPTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidRLPTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidRLPTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcRPCAPITests(t *testing.T) { func TestBcRPCAPITests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcRPC_API_Test.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcRPC_API_Test.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcForkBlockTests(t *testing.T) { func TestBcForkBlockTests(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcForkBlockTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcForkBlockTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcTotalDifficulty(t *testing.T) { func TestBcTotalDifficulty(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcTotalDifficultyTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcTotalDifficultyTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestBcWallet(t *testing.T) { func TestBcWallet(t *testing.T) {
err := RunBlockTest(filepath.Join(blockTestDir, "bcWalletTest.json")) err := RunBlockTest(filepath.Join(blockTestDir, "bcWalletTest.json"), BlockSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

@ -86,7 +86,7 @@ type btTransaction struct {
Value string Value string
} }
func RunBlockTestWithReader(r io.Reader) error { func RunBlockTestWithReader(r io.Reader, skipTests []string) error {
btjs := make(map[string]*btJSON) btjs := make(map[string]*btJSON)
if err := readJson(r, &btjs); err != nil { if err := readJson(r, &btjs); err != nil {
return err return err
@ -97,13 +97,13 @@ func RunBlockTestWithReader(r io.Reader) error {
return err return err
} }
if err := runBlockTests(bt); err != nil { if err := runBlockTests(bt, skipTests); err != nil {
return err return err
} }
return nil return nil
} }
func RunBlockTest(file string) error { func RunBlockTest(file string, skipTests []string) error {
btjs := make(map[string]*btJSON) btjs := make(map[string]*btJSON)
if err := readJsonFile(file, &btjs); err != nil { if err := readJsonFile(file, &btjs); err != nil {
return err return err
@ -113,15 +113,15 @@ func RunBlockTest(file string) error {
if err != nil { if err != nil {
return err return err
} }
if err := runBlockTests(bt); err != nil { if err := runBlockTests(bt, skipTests); err != nil {
return err return err
} }
return nil return nil
} }
func runBlockTests(bt map[string]*BlockTest) error { func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
skipTest := make(map[string]bool, len(BlockSkipTests)) skipTest := make(map[string]bool, len(skipTests))
for _, name := range BlockSkipTests { for _, name := range skipTests {
skipTest[name] = true skipTest[name] = true
} }

@ -8,84 +8,84 @@ import (
func TestStateSystemOperations(t *testing.T) { func TestStateSystemOperations(t *testing.T) {
fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json") fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateExample(t *testing.T) { func TestStateExample(t *testing.T) {
fn := filepath.Join(stateTestDir, "stExample.json") fn := filepath.Join(stateTestDir, "stExample.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStatePreCompiledContracts(t *testing.T) { func TestStatePreCompiledContracts(t *testing.T) {
fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json") fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateRecursiveCreate(t *testing.T) { func TestStateRecursiveCreate(t *testing.T) {
fn := filepath.Join(stateTestDir, "stRecursiveCreate.json") fn := filepath.Join(stateTestDir, "stRecursiveCreate.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateSpecial(t *testing.T) { func TestStateSpecial(t *testing.T) {
fn := filepath.Join(stateTestDir, "stSpecialTest.json") fn := filepath.Join(stateTestDir, "stSpecialTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateRefund(t *testing.T) { func TestStateRefund(t *testing.T) {
fn := filepath.Join(stateTestDir, "stRefundTest.json") fn := filepath.Join(stateTestDir, "stRefundTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateBlockHash(t *testing.T) { func TestStateBlockHash(t *testing.T) {
fn := filepath.Join(stateTestDir, "stBlockHashTest.json") fn := filepath.Join(stateTestDir, "stBlockHashTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateInitCode(t *testing.T) { func TestStateInitCode(t *testing.T) {
fn := filepath.Join(stateTestDir, "stInitCodeTest.json") fn := filepath.Join(stateTestDir, "stInitCodeTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateLog(t *testing.T) { func TestStateLog(t *testing.T) {
fn := filepath.Join(stateTestDir, "stLogTests.json") fn := filepath.Join(stateTestDir, "stLogTests.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestStateTransaction(t *testing.T) { func TestStateTransaction(t *testing.T) {
fn := filepath.Join(stateTestDir, "stTransactionTest.json") fn := filepath.Join(stateTestDir, "stTransactionTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestCallCreateCallCode(t *testing.T) { func TestCallCreateCallCode(t *testing.T) {
fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestMemory(t *testing.T) { func TestMemory(t *testing.T) {
fn := filepath.Join(stateTestDir, "stMemoryTest.json") fn := filepath.Join(stateTestDir, "stMemoryTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -95,7 +95,7 @@ func TestMemoryStress(t *testing.T) {
t.Skip() t.Skip()
} }
fn := filepath.Join(stateTestDir, "stMemoryStressTest.json") fn := filepath.Join(stateTestDir, "stMemoryStressTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -105,21 +105,21 @@ func TestQuadraticComplexity(t *testing.T) {
t.Skip() t.Skip()
} }
fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json") fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestSolidity(t *testing.T) { func TestSolidity(t *testing.T) {
fn := filepath.Join(stateTestDir, "stSolidityTest.json") fn := filepath.Join(stateTestDir, "stSolidityTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestWallet(t *testing.T) { func TestWallet(t *testing.T) {
fn := filepath.Join(stateTestDir, "stWalletTest.json") fn := filepath.Join(stateTestDir, "stWalletTest.json")
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -127,7 +127,7 @@ func TestWallet(t *testing.T) {
func TestStateTestsRandom(t *testing.T) { func TestStateTestsRandom(t *testing.T) {
fns, _ := filepath.Glob("./files/StateTests/RandomTests/*") fns, _ := filepath.Glob("./files/StateTests/RandomTests/*")
for _, fn := range fns { for _, fn := range fns {
if err := RunStateTest(fn); err != nil { if err := RunStateTest(fn, StateSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }

@ -16,26 +16,26 @@ import (
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
) )
func RunStateTestWithReader(r io.Reader) error { func RunStateTestWithReader(r io.Reader, skipTests []string) error {
tests := make(map[string]VmTest) tests := make(map[string]VmTest)
if err := readJson(r, &tests); err != nil { if err := readJson(r, &tests); err != nil {
return err return err
} }
if err := runStateTests(tests); err != nil { if err := runStateTests(tests, skipTests); err != nil {
return err return err
} }
return nil return nil
} }
func RunStateTest(p string) error { func RunStateTest(p string, skipTests []string) error {
tests := make(map[string]VmTest) tests := make(map[string]VmTest)
if err := readJsonFile(p, &tests); err != nil { if err := readJsonFile(p, &tests); err != nil {
return err return err
} }
if err := runStateTests(tests); err != nil { if err := runStateTests(tests, skipTests); err != nil {
return err return err
} }
@ -43,9 +43,9 @@ func RunStateTest(p string) error {
} }
func runStateTests(tests map[string]VmTest) error { func runStateTests(tests map[string]VmTest, skipTests []string) error {
skipTest := make(map[string]bool, len(StateSkipTests)) skipTest := make(map[string]bool, len(skipTests))
for _, name := range StateSkipTests { for _, name := range skipTests {
skipTest[name] = true skipTest[name] = true
} }

@ -6,21 +6,21 @@ import (
) )
func TestTransactions(t *testing.T) { func TestTransactions(t *testing.T) {
err := RunTransactionTests(filepath.Join(transactionTestDir, "ttTransactionTest.json")) err := RunTransactionTests(filepath.Join(transactionTestDir, "ttTransactionTest.json"), TransSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestWrongRLPTransactions(t *testing.T) { func TestWrongRLPTransactions(t *testing.T) {
err := RunTransactionTests(filepath.Join(transactionTestDir, "ttWrongRLPTransaction.json")) err := RunTransactionTests(filepath.Join(transactionTestDir, "ttWrongRLPTransaction.json"), TransSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func Test10MBtx(t *testing.T) { func Test10MBtx(t *testing.T) {
err := RunTransactionTests(filepath.Join(transactionTestDir, "tt10mbDataField.json")) err := RunTransactionTests(filepath.Join(transactionTestDir, "tt10mbDataField.json"), TransSkipTests)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

@ -32,9 +32,9 @@ type TransactionTest struct {
Transaction TtTransaction Transaction TtTransaction
} }
func RunTransactionTestsWithReader(r io.Reader) error { func RunTransactionTestsWithReader(r io.Reader, skipTests []string) error {
skipTest := make(map[string]bool, len(TransSkipTests)) skipTest := make(map[string]bool, len(skipTests))
for _, name := range TransSkipTests { for _, name := range skipTests {
skipTest[name] = true skipTest[name] = true
} }
@ -59,18 +59,25 @@ func RunTransactionTestsWithReader(r io.Reader) error {
return nil return nil
} }
func RunTransactionTests(file string) error { func RunTransactionTests(file string, skipTests []string) error {
skipTest := make(map[string]bool, len(TransSkipTests)) tests := make(map[string]TransactionTest)
for _, name := range TransSkipTests { if err := readJsonFile(file, &tests); err != nil {
skipTest[name] = true
}
bt := make(map[string]TransactionTest)
if err := readJsonFile(file, &bt); err != nil {
return err return err
} }
for name, test := range bt { if err := runTransactionTests(tests, skipTests); err != nil {
return err
}
return nil
}
func runTransactionTests(tests map[string]TransactionTest, skipTests []string) error {
skipTest := make(map[string]bool, len(skipTests))
for _, name := range skipTests {
skipTest[name] = true
}
for name, test := range tests {
// if the test should be skipped, return // if the test should be skipped, return
if skipTest[name] { if skipTest[name] {
glog.Infoln("Skipping transaction test", name) glog.Infoln("Skipping transaction test", name)

@ -8,91 +8,91 @@ import (
// I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail.
func TestVMArithmetic(t *testing.T) { func TestVMArithmetic(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmArithmeticTest.json") fn := filepath.Join(vmTestDir, "vmArithmeticTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestBitwiseLogicOperation(t *testing.T) { func TestBitwiseLogicOperation(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmBitwiseLogicOperationTest.json") fn := filepath.Join(vmTestDir, "vmBitwiseLogicOperationTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestBlockInfo(t *testing.T) { func TestBlockInfo(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmBlockInfoTest.json") fn := filepath.Join(vmTestDir, "vmBlockInfoTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestEnvironmentalInfo(t *testing.T) { func TestEnvironmentalInfo(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmEnvironmentalInfoTest.json") fn := filepath.Join(vmTestDir, "vmEnvironmentalInfoTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestFlowOperation(t *testing.T) { func TestFlowOperation(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmIOandFlowOperationsTest.json") fn := filepath.Join(vmTestDir, "vmIOandFlowOperationsTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestLogTest(t *testing.T) { func TestLogTest(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmLogTest.json") fn := filepath.Join(vmTestDir, "vmLogTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestPerformance(t *testing.T) { func TestPerformance(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") fn := filepath.Join(vmTestDir, "vmPerformanceTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestPushDupSwap(t *testing.T) { func TestPushDupSwap(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmPushDupSwapTest.json") fn := filepath.Join(vmTestDir, "vmPushDupSwapTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestVMSha3(t *testing.T) { func TestVMSha3(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmSha3Test.json") fn := filepath.Join(vmTestDir, "vmSha3Test.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestVm(t *testing.T) { func TestVm(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmtests.json") fn := filepath.Join(vmTestDir, "vmtests.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestVmLog(t *testing.T) { func TestVmLog(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmLogTest.json") fn := filepath.Join(vmTestDir, "vmLogTest.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestInputLimits(t *testing.T) { func TestInputLimits(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmInputLimits.json") fn := filepath.Join(vmTestDir, "vmInputLimits.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
func TestInputLimitsLight(t *testing.T) { func TestInputLimitsLight(t *testing.T) {
fn := filepath.Join(vmTestDir, "vmInputLimitsLight.json") fn := filepath.Join(vmTestDir, "vmInputLimitsLight.json")
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -100,7 +100,7 @@ func TestInputLimitsLight(t *testing.T) {
func TestVMRandom(t *testing.T) { func TestVMRandom(t *testing.T) {
fns, _ := filepath.Glob(filepath.Join(baseDir, "RandomTests", "*")) fns, _ := filepath.Glob(filepath.Join(baseDir, "RandomTests", "*"))
for _, fn := range fns { for _, fn := range fns {
if err := RunVmTest(fn); err != nil { if err := RunVmTest(fn, VmSkipTests); err != nil {
t.Error(err) t.Error(err)
} }
} }

@ -14,7 +14,7 @@ import (
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
) )
func RunVmTestWithReader(r io.Reader) error { func RunVmTestWithReader(r io.Reader, skipTests []string) error {
tests := make(map[string]VmTest) tests := make(map[string]VmTest)
err := readJson(r, &tests) err := readJson(r, &tests)
if err != nil { if err != nil {
@ -25,14 +25,14 @@ func RunVmTestWithReader(r io.Reader) error {
return err return err
} }
if err := runVmTests(tests); err != nil { if err := runVmTests(tests, skipTests); err != nil {
return err return err
} }
return nil return nil
} }
func RunVmTest(p string) error { func RunVmTest(p string, skipTests []string) error {
tests := make(map[string]VmTest) tests := make(map[string]VmTest)
err := readJsonFile(p, &tests) err := readJsonFile(p, &tests)
@ -40,16 +40,16 @@ func RunVmTest(p string) error {
return err return err
} }
if err := runVmTests(tests); err != nil { if err := runVmTests(tests, skipTests); err != nil {
return err return err
} }
return nil return nil
} }
func runVmTests(tests map[string]VmTest) error { func runVmTests(tests map[string]VmTest, skipTests []string) error {
skipTest := make(map[string]bool, len(VmSkipTests)) skipTest := make(map[string]bool, len(skipTests))
for _, name := range VmSkipTests { for _, name := range skipTests {
skipTest[name] = true skipTest[name] = true
} }