aboutsummaryrefslogtreecommitdiffstats
path: root/tests/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/init.go')
-rw-r--r--tests/init.go75
1 files changed, 52 insertions, 23 deletions
diff --git a/tests/init.go b/tests/init.go
index 164924ab8..326387341 100644
--- a/tests/init.go
+++ b/tests/init.go
@@ -8,6 +8,8 @@ import (
"net/http"
"os"
"path/filepath"
+
+ // "github.com/ethereum/go-ethereum/logger/glog"
)
var (
@@ -17,13 +19,40 @@ var (
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
vmTestDir = filepath.Join(baseDir, "VMTests")
- blockSkipTests = []string{"SimpleTx3"}
- transSkipTests = []string{"TransactionWithHihghNonce256"}
- stateSkipTests = []string{"mload32bitBound_return", "mload32bitBound_return2"}
- vmSkipTests = []string{}
+ BlockSkipTests = []string{"SimpleTx3"}
+ TransSkipTests = []string{"TransactionWithHihghNonce256"}
+ StateSkipTests = []string{"mload32bitBound_return", "mload32bitBound_return2"}
+ VmSkipTests = []string{}
)
-func readJSON(reader io.Reader, value interface{}) error {
+// type TestRunner interface {
+// // LoadTest()
+// RunTest() error
+// }
+
+// func RunTests(bt map[string]TestRunner, skipTests []string) error {
+// // map skipped tests to boolean set
+// skipTest := make(map[string]bool, len(skipTests))
+// for _, name := range skipTests {
+// skipTest[name] = true
+// }
+
+// for name, test := range bt {
+// // if the test should be skipped, return
+// if skipTest[name] {
+// glog.Infoln("Skipping block test", name)
+// return nil
+// }
+// // test the block
+// if err := test.RunTest(); err != nil {
+// return err
+// }
+// glog.Infoln("Block test passed: ", name)
+// }
+// return nil
+// }
+
+func readJson(reader io.Reader, value interface{}) error {
data, err := ioutil.ReadAll(reader)
if err != nil {
return fmt.Errorf("Error reading JSON file", err.Error())
@@ -39,44 +68,44 @@ func readJSON(reader io.Reader, value interface{}) error {
return nil
}
-// findLine returns the line number for the given offset into data.
-func findLine(data []byte, offset int64) (line int) {
- line = 1
- for i, r := range string(data) {
- if int64(i) >= offset {
- return
- }
- if r == '\n' {
- line++
- }
- }
- return
-}
-
-func readHttpFile(uri string, value interface{}) error {
+func readJsonHttp(uri string, value interface{}) error {
resp, err := http.Get(uri)
if err != nil {
return err
}
defer resp.Body.Close()
- err = readJSON(resp.Body, value)
+ err = readJson(resp.Body, value)
if err != nil {
return err
}
return nil
}
-func readTestFile(fn string, value interface{}) error {
+func readJsonFile(fn string, value interface{}) error {
file, err := os.Open(fn)
if err != nil {
return err
}
defer file.Close()
- err = readJSON(file, value)
+ err = readJson(file, value)
if err != nil {
return fmt.Errorf("%s in file %s", err.Error(), fn)
}
return nil
}
+
+// findLine returns the line number for the given offset into data.
+func findLine(data []byte, offset int64) (line int) {
+ line = 1
+ for i, r := range string(data) {
+ if int64(i) >= offset {
+ return
+ }
+ if r == '\n' {
+ line++
+ }
+ }
+ return
+}