From fed3e6a808921fb8274b50043c5c39a24a1bbccf Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 7 Jan 2015 13:17:48 +0100 Subject: Refactored ethutil.Config.Db out --- tests/vm/gh_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 698b0aefc..2aece215e 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" @@ -38,8 +39,8 @@ func (self Log) Topics() [][]byte { return t } -func StateObjectFromAccount(addr string, account Account) *state.StateObject { - obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) +func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject { + obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db) obj.SetBalance(ethutil.Big(account.Balance)) if ethutil.IsHex(account.Code) { @@ -84,9 +85,10 @@ func RunVmTest(p string, t *testing.T) { continue } */ - statedb := state.New(helper.NewTrie()) + db, _ := ethdb.NewMemDatabase() + statedb := state.New(nil, db) for addr, account := range test.Pre { - obj := StateObjectFromAccount(addr, account) + obj := StateObjectFromAccount(db, addr, account) statedb.SetStateObject(obj) for a, v := range account.Storage { obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v))) -- cgit v1.2.3 From 491c23a728e4f5cdedfa040aded6a6b136f6bee0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 9 Jan 2015 22:42:36 +0100 Subject: Moved the TD method from block processor. --- tests/vm/gh_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 2aece215e..47b588268 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -81,7 +81,7 @@ func RunVmTest(p string, t *testing.T) { for name, test := range tests { /* helper.Logger.SetLogLevel(5) - if name != "jump0_jumpdest2" { + if name != "createNameRegistratorZeroMem" { continue } */ -- cgit v1.2.3 From 750d70c2024784227c8ac920d651c337c2de207e Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 00:25:45 +0100 Subject: updated tests --- tests/vm/gh_test.go | 6 ------ 1 file changed, 6 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 47b588268..699225e90 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,12 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - /* - helper.Logger.SetLogLevel(5) - if name != "createNameRegistratorZeroMem" { - continue - } - */ db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { -- cgit v1.2.3 From 4704a0a288af89795e251db98eb253de117ff031 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 10:30:52 +0100 Subject: remove pre compiled for tests --- tests/vm/gh_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 699225e90..7b41411de 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,6 +79,7 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + //helper.Log.Infoln("Running", name) db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { @@ -116,12 +117,6 @@ func RunVmTest(p string, t *testing.T) { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) } - // Log the error if there is one. Error does not mean failing test. - // A test fails if err != nil and post params are specified in the test. - if err != nil { - helper.Log.Infof("%s's: %v\n", name, err) - } - rexp := helper.FromHex(test.Out) if bytes.Compare(rexp, ret) != 0 { t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) @@ -129,10 +124,14 @@ func RunVmTest(p string, t *testing.T) { if isVmTest { if len(test.Gas) == 0 && err == nil { + // Log VM err + helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull", name) } else { gexp := ethutil.Big(test.Gas) if gexp.Cmp(gas) != 0 { + // Log VM err + helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) } } -- cgit v1.2.3 From 82beaabf6a8b5a146a38e1d6a31a78157c79a0cf Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 14:57:51 +0100 Subject: Fixed consensus issue --- tests/vm/gh_test.go | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7b41411de..e1fdcd658 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,7 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - //helper.Log.Infoln("Running", name) db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { -- cgit v1.2.3 From d5f38f5690caeb30794e62d4a1b2683a6107cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 22 Jan 2015 18:00:15 +0100 Subject: JitVM: the EVM JIT bridge --- tests/vm/gh_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index e1fdcd658..41ebba957 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -172,47 +172,47 @@ func RunVmTest(p 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 TestVMArithmetic(t *testing.T) { - const fn = "../files/vmtests/vmArithmeticTest.json" + const fn = "../files/VMTests/vmArithmeticTest.json" RunVmTest(fn, t) } func TestBitwiseLogicOperation(t *testing.T) { - const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" + const fn = "../files/VMTests/vmBitwiseLogicOperationTest.json" RunVmTest(fn, t) } func TestBlockInfo(t *testing.T) { - const fn = "../files/vmtests/vmBlockInfoTest.json" + const fn = "../files/VMTests/vmBlockInfoTest.json" RunVmTest(fn, t) } func TestEnvironmentalInfo(t *testing.T) { - const fn = "../files/vmtests/vmEnvironmentalInfoTest.json" + const fn = "../files/VMTests/vmEnvironmentalInfoTest.json" RunVmTest(fn, t) } func TestFlowOperation(t *testing.T) { - const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" + const fn = "../files/VMTests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } func TestPushDupSwap(t *testing.T) { - const fn = "../files/vmtests/vmPushDupSwapTest.json" + const fn = "../files/VMTests/vmPushDupSwapTest.json" RunVmTest(fn, t) } func TestVMSha3(t *testing.T) { - const fn = "../files/vmtests/vmSha3Test.json" + const fn = "../files/VMTests/vmSha3Test.json" RunVmTest(fn, t) } func TestVm(t *testing.T) { - const fn = "../files/vmtests/vmtests.json" + const fn = "../files/VMTests/vmtests.json" RunVmTest(fn, t) } func TestVmLog(t *testing.T) { - const fn = "../files/vmtests/vmLogTest.json" + const fn = "../files/VMTests/vmLogTest.json" RunVmTest(fn, t) } -- cgit v1.2.3 From 6fecb150d6f2bb36d3f1b7b9095cac428df2ce5a Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 2 Feb 2015 19:55:38 -0800 Subject: Updated tests --- tests/vm/gh_test.go | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 41ebba957..d9b1ded7a 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,6 +79,10 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + helper.Logger.SetLogLevel(4) + if name != "TransactionNonceCheck2" { + continue + } db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { @@ -123,14 +127,10 @@ func RunVmTest(p string, t *testing.T) { if isVmTest { if len(test.Gas) == 0 && err == nil { - // Log VM err - helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull", name) } else { gexp := ethutil.Big(test.Gas) if gexp.Cmp(gas) != 0 { - // Log VM err - helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) } } @@ -176,6 +176,11 @@ func TestVMArithmetic(t *testing.T) { RunVmTest(fn, t) } +func TestSystemOperations(t *testing.T) { + const fn = "../files/VMTests/vmSystemOperationsTest.json" + RunVmTest(fn, t) +} + func TestBitwiseLogicOperation(t *testing.T) { const fn = "../files/VMTests/vmBitwiseLogicOperationTest.json" RunVmTest(fn, t) @@ -240,3 +245,23 @@ func TestStateRefund(t *testing.T) { const fn = "../files/StateTests/stRefundTest.json" RunVmTest(fn, t) } + +func TestStateBlockHash(t *testing.T) { + const fn = "../files/StateTests/stBlockHashTest.json" + RunVmTest(fn, t) +} + +func TestStateInitCode(t *testing.T) { + const fn = "../files/StateTests/stInitCodeTest.json" + RunVmTest(fn, t) +} + +func TestStateLog(t *testing.T) { + const fn = "../files/StateTests/stLogTests.json" + RunVmTest(fn, t) +} + +func TestStateTransaction(t *testing.T) { + const fn = "../files/StateTests/stTransactionTest.json" + RunVmTest(fn, t) +} -- cgit v1.2.3