good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
cbd785cf
Commit
cbd785cf
authored
Oct 16, 2014
by
Felix Lange
Browse files
Options
Downloads
Patches
Plain Diff
ethvm, tests/*: use log level constants
parent
0165c183
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ethvm/vm_test.go
+7
-7
7 additions, 7 deletions
ethvm/vm_test.go
tests/helper/init.go
+1
-1
1 addition, 1 deletion
tests/helper/init.go
tests/vm/gh_test.go
+4
-0
4 additions, 0 deletions
tests/vm/gh_test.go
with
12 additions
and
8 deletions
ethvm/vm_test.go
+
7
−
7
View file @
cbd785cf
...
@@ -39,14 +39,14 @@ for i := 0; i < 10; i++ {
...
@@ -39,14 +39,14 @@ for i := 0; i < 10; i++ {
return x`
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
)
code
,
err
:=
ethutil
.
Compile
(
mutcode
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
// Pipe output to /dev/null
// 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"
,
""
)
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
...
@@ -57,7 +57,7 @@ func setup(level int, typ Type) (*Closure, VirtualMachine) {
...
@@ -57,7 +57,7 @@ func setup(level int, typ Type) (*Closure, VirtualMachine) {
}
}
func
TestDebugVm
(
t
*
testing
.
T
)
{
func
TestDebugVm
(
t
*
testing
.
T
)
{
closure
,
vm
:=
setup
(
4
,
DebugVmTy
)
closure
,
vm
:=
setup
(
ethlog
.
DebugLevel
,
DebugVmTy
)
ret
,
_
,
e
:=
closure
.
Call
(
vm
,
nil
)
ret
,
_
,
e
:=
closure
.
Call
(
vm
,
nil
)
if
e
!=
nil
{
if
e
!=
nil
{
fmt
.
Println
(
"error"
,
e
)
fmt
.
Println
(
"error"
,
e
)
...
@@ -69,7 +69,7 @@ func TestDebugVm(t *testing.T) {
...
@@ -69,7 +69,7 @@ func TestDebugVm(t *testing.T) {
}
}
func
TestVm
(
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
)
ret
,
_
,
e
:=
closure
.
Call
(
vm
,
nil
)
if
e
!=
nil
{
if
e
!=
nil
{
fmt
.
Println
(
"error"
,
e
)
fmt
.
Println
(
"error"
,
e
)
...
@@ -81,7 +81,7 @@ func TestVm(t *testing.T) {
...
@@ -81,7 +81,7 @@ func TestVm(t *testing.T) {
}
}
func
BenchmarkDebugVm
(
b
*
testing
.
B
)
{
func
BenchmarkDebugVm
(
b
*
testing
.
B
)
{
closure
,
vm
:=
setup
(
3
,
DebugVmTy
)
closure
,
vm
:=
setup
(
ethlog
.
InfoLevel
,
DebugVmTy
)
b
.
ResetTimer
()
b
.
ResetTimer
()
...
@@ -91,7 +91,7 @@ func BenchmarkDebugVm(b *testing.B) {
...
@@ -91,7 +91,7 @@ func BenchmarkDebugVm(b *testing.B) {
}
}
func
BenchmarkVm
(
b
*
testing
.
B
)
{
func
BenchmarkVm
(
b
*
testing
.
B
)
{
closure
,
vm
:=
setup
(
3
,
StandardVmTy
)
closure
,
vm
:=
setup
(
ethlog
.
InfoLevel
,
StandardVmTy
)
b
.
ResetTimer
()
b
.
ResetTimer
()
...
@@ -106,7 +106,7 @@ func RunCode(mutCode string, typ Type) []byte {
...
@@ -106,7 +106,7 @@ func RunCode(mutCode string, typ Type) []byte {
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
ethlog
.
AddLogSystem
(
ethlog
.
NewStdLogSystem
(
os
.
Stdout
,
log
.
LstdFlags
,
ethlog
.
Log
Level
(
3
)
))
ethlog
.
AddLogSystem
(
ethlog
.
NewStdLogSystem
(
os
.
Stdout
,
log
.
LstdFlags
,
ethlog
.
Info
Level
))
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
...
...
This diff is collapsed.
Click to expand it.
tests/helper/init.go
+
1
−
1
View file @
cbd785cf
...
@@ -12,7 +12,7 @@ var Logger ethlog.LogSystem
...
@@ -12,7 +12,7 @@ var Logger ethlog.LogSystem
var
Log
=
ethlog
.
NewLogger
(
"TEST"
)
var
Log
=
ethlog
.
NewLogger
(
"TEST"
)
func
init
()
{
func
init
()
{
Logger
=
ethlog
.
NewStdLogSystem
(
os
.
Stdout
,
log
.
LstdFlags
,
ethlog
.
Log
Level
(
3
)
)
Logger
=
ethlog
.
NewStdLogSystem
(
os
.
Stdout
,
log
.
LstdFlags
,
ethlog
.
Info
Level
)
ethlog
.
AddLogSystem
(
Logger
)
ethlog
.
AddLogSystem
(
Logger
)
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
...
...
This diff is collapsed.
Click to expand it.
tests/vm/gh_test.go
+
4
−
0
View file @
cbd785cf
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"bytes"
"bytes"
"testing"
"testing"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/tests/helper"
"github.com/ethereum/eth-go/tests/helper"
...
@@ -87,6 +88,9 @@ func RunVmTest(url string, t *testing.T) {
...
@@ -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.
// 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
)
{
func
TestVMArithmetic
(
t
*
testing
.
T
)
{
const
url
=
"https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmArithmeticTest.json"
const
url
=
"https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmArithmeticTest.json"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment