浏览代码

Require a first argument of test type

Taylor Gerring 10 年之前
父节点
当前提交
6415ed0730
共有 1 个文件被更改,包括 24 次插入4 次删除
  1. 24 4
      cmd/ethtest/main.go

+ 24 - 4
cmd/ethtest/main.go

@@ -225,9 +225,29 @@ func main() {
 	helper.Logger.SetLogLevel(5)
 	vm.Debug = true
 
-	if len(os.Args) > 1 {
-		os.Exit(RunVmTest(strings.NewReader(os.Args[1])))
-	} else {
-		os.Exit(RunVmTest(os.Stdin))
+	if len(os.Args) < 2 {
+		glog.Exit("Must specify test type")
 	}
+
+	test := os.Args[1]
+
+	var code int
+	switch test {
+	case "vm", "VMTests":
+		glog.Exit("VMTests not yet implemented")
+	case "state", "StateTest":
+		if len(os.Args) > 2 {
+			code = RunVmTest(strings.NewReader(os.Args[2]))
+		} else {
+			code = RunVmTest(os.Stdin)
+		}
+	case "tx", "TransactionTests":
+		glog.Exit("TransactionTests not yet implemented")
+	case "bc", "BlockChainTest":
+		glog.Exit("BlockChainTest not yet implemented")
+	default:
+		glog.Exit("Invalid test type specified")
+	}
+
+	os.Exit(code)
 }