From 89244981a8a9f190a6afc74ec2c584692f04dcdd Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 17:09:54 +0100 Subject: [PATCH] Additional checking on gas --- cmd/ethtest/main.go | 11 +++-- .../files/VMTests/RandomTests/randomTest.json | 46 ------------------- 2 files changed, 8 insertions(+), 49 deletions(-) delete mode 100644 tests/files/VMTests/RandomTests/randomTest.json diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 94ab779db..96ef94e40 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -95,10 +95,15 @@ func RunVmTest(js string) (failed int) { failed = 1 } - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - log.Printf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + if len(test.Gas) == 0 && err == nil { + log.Printf("0 gas indicates error but no error given by VM") failed = 1 + } else { + gexp := ethutil.Big(test.Gas) + if gexp.Cmp(gas) != 0 { + log.Printf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + failed = 1 + } } for addr, account := range test.Post { diff --git a/tests/files/VMTests/RandomTests/randomTest.json b/tests/files/VMTests/RandomTests/randomTest.json deleted file mode 100644 index dad2ee4a2..000000000 --- a/tests/files/VMTests/RandomTests/randomTest.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "randomVMtest" : { - "callcreates" : [ - ], - "env" : { - "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", - "currentDifficulty" : "256", - "currentGasLimit" : "1000000", - "currentNumber" : "0", - "currentTimestamp" : "1", - "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" - }, - "exec" : { - "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", - "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "code" : "0x675545", - "data" : "0x", - "gas" : "10000", - "gasPrice" : "100000000000000", - "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "value" : "1000000000000000000" - }, - "gas" : "9999", - "logs" : [ - ], - "out" : "0x", - "post" : { - "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", - "code" : "0x675545", - "nonce" : "0", - "storage" : { - } - } - }, - "pre" : { - "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", - "code" : "0x675545", - "nonce" : "0", - "storage" : { - } - } - } - } -} \ No newline at end of file