aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-07 20:38:28 +0800
committerobscuren <geffobscura@gmail.com>2015-01-07 20:38:28 +0800
commit982c812e81304cad835796d4fa3d67c8f08141b6 (patch)
treed31bc7fbee9a511a2eb4fe79443378f335816473
parentc1908c7d91aec08e57208849b9a758f46dbfa9f5 (diff)
downloaddexon-982c812e81304cad835796d4fa3d67c8f08141b6.tar.gz
dexon-982c812e81304cad835796d4fa3d67c8f08141b6.tar.zst
dexon-982c812e81304cad835796d4fa3d67c8f08141b6.zip
Read directly from stdin
-rw-r--r--cmd/ethtest/main.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index 7d1c3de01..9e9eda450 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -24,10 +24,10 @@ package main
import (
"bytes"
"encoding/json"
+ "io"
"io/ioutil"
"log"
"os"
- "strings"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
@@ -65,10 +65,10 @@ type VmTest struct {
Pre map[string]Account
}
-func RunVmTest(js string) (failed int) {
+func RunVmTest(r io.Reader) (failed int) {
tests := make(map[string]VmTest)
- data, _ := ioutil.ReadAll(strings.NewReader(js))
+ data, _ := ioutil.ReadAll(r)
err := json.Unmarshal(data, &tests)
if err != nil {
log.Fatalln(err)
@@ -125,9 +125,6 @@ func RunVmTest(js string) (failed int) {
func main() {
helper.Logger.SetLogLevel(5)
- if len(os.Args) == 1 {
- log.Fatalln("no json supplied")
- }
- os.Exit(RunVmTest(os.Args[1]))
+ os.Exit(RunVmTest(os.Stdin))
}