aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-10-16 16:47:12 +0800
committerFelix Lange <fjl@twurst.com>2014-10-17 23:23:28 +0800
commitcbd785cfe8801c240bbaaa6f21ebf3ab7045e4a3 (patch)
tree48cdf93d9753b14816c961966c56e419969854fb
parent0165c1833017963a280f135a5733974a9fc3ec0b (diff)
downloaddexon-cbd785cfe8801c240bbaaa6f21ebf3ab7045e4a3.tar.gz
dexon-cbd785cfe8801c240bbaaa6f21ebf3ab7045e4a3.tar.zst
dexon-cbd785cfe8801c240bbaaa6f21ebf3ab7045e4a3.zip
ethvm, tests/*: use log level constants
-rw-r--r--ethvm/vm_test.go14
-rw-r--r--tests/helper/init.go2
-rw-r--r--tests/vm/gh_test.go4
3 files changed, 12 insertions, 8 deletions
diff --git a/ethvm/vm_test.go b/ethvm/vm_test.go
index c21008836..6b7cc2f5c 100644
--- a/ethvm/vm_test.go
+++ b/ethvm/vm_test.go
@@ -39,14 +39,14 @@ for i := 0; i < 10; i++ {
return x`
-func setup(level int, typ Type) (*Closure, VirtualMachine) {
+func setup(level ethlog.LogLevel, typ Type) (*Closure, VirtualMachine) {
code, err := ethutil.Compile(mutcode, true)
if err != nil {
log.Fatal(err)
}
// Pipe output to /dev/null
- ethlog.AddLogSystem(ethlog.NewStdLogSystem(ioutil.Discard, log.LstdFlags, ethlog.LogLevel(level)))
+ ethlog.AddLogSystem(ethlog.NewStdLogSystem(ioutil.Discard, log.LstdFlags, level))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
@@ -57,7 +57,7 @@ func setup(level int, typ Type) (*Closure, VirtualMachine) {
}
func TestDebugVm(t *testing.T) {
- closure, vm := setup(4, DebugVmTy)
+ closure, vm := setup(ethlog.DebugLevel, DebugVmTy)
ret, _, e := closure.Call(vm, nil)
if e != nil {
fmt.Println("error", e)
@@ -69,7 +69,7 @@ func TestDebugVm(t *testing.T) {
}
func TestVm(t *testing.T) {
- closure, vm := setup(4, StandardVmTy)
+ closure, vm := setup(ethlog.DebugLevel, StandardVmTy)
ret, _, e := closure.Call(vm, nil)
if e != nil {
fmt.Println("error", e)
@@ -81,7 +81,7 @@ func TestVm(t *testing.T) {
}
func BenchmarkDebugVm(b *testing.B) {
- closure, vm := setup(3, DebugVmTy)
+ closure, vm := setup(ethlog.InfoLevel, DebugVmTy)
b.ResetTimer()
@@ -91,7 +91,7 @@ func BenchmarkDebugVm(b *testing.B) {
}
func BenchmarkVm(b *testing.B) {
- closure, vm := setup(3, StandardVmTy)
+ closure, vm := setup(ethlog.InfoLevel, StandardVmTy)
b.ResetTimer()
@@ -106,7 +106,7 @@ func RunCode(mutCode string, typ Type) []byte {
log.Fatal(err)
}
- ethlog.AddLogSystem(ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.LogLevel(3)))
+ ethlog.AddLogSystem(ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.InfoLevel))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
diff --git a/tests/helper/init.go b/tests/helper/init.go
index a84a7749f..3de5c50eb 100644
--- a/tests/helper/init.go
+++ b/tests/helper/init.go
@@ -12,7 +12,7 @@ var Logger ethlog.LogSystem
var Log = ethlog.NewLogger("TEST")
func init() {
- Logger = ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.LogLevel(3))
+ Logger = ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.InfoLevel)
ethlog.AddLogSystem(Logger)
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go
index 5de5b6433..0e0c6aa49 100644
--- a/tests/vm/gh_test.go
+++ b/tests/vm/gh_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"testing"
+ "github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/tests/helper"
@@ -87,6 +88,9 @@ func RunVmTest(url string, t *testing.T) {
}
// 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 TestVMSha3(t *testing.T) {
+ helper.Logger.SetLogLevel(ethlog.Silence)
+ defer helper.Logger.SetLogLevel(ethlog.DebugLevel)
func TestVMArithmetic(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmArithmeticTest.json"