Skip to content

Commit

Permalink
tests: update to upstream commit 2bb0c3da3b (ethereum#15806)
Browse files Browse the repository at this point in the history
Also raise traceLimit once again and print the VM
error and output on failure.
  • Loading branch information
fjl authored Jan 4, 2018
1 parent ae71da1 commit 1c2378b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
20 changes: 12 additions & 8 deletions core/vm/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ type StructLogger struct {

logs []StructLog
changedValues map[common.Address]Storage
output []byte
err error
}

// NewStructLogger returns a new logger
Expand Down Expand Up @@ -172,17 +174,19 @@ func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost ui
}

func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error {
fmt.Printf("0x%x", output)
if err != nil {
fmt.Printf(" error: %v\n", err)
}
l.output = output
l.err = err
return nil
}

// StructLogs returns a list of captured log entries
func (l *StructLogger) StructLogs() []StructLog {
return l.logs
}
// StructLogs returns the captured log entries.
func (l *StructLogger) StructLogs() []StructLog { return l.logs }

// Error returns the VM error captured by the trace.
func (l *StructLogger) Error() error { return l.err }

// Output returns the VM return value captured by the trace.
func (l *StructLogger) Output() []byte { return l.output }

// WriteTrace writes a formatted trace to the given writer
func WriteTrace(writer io.Writer, logs []StructLog) {
Expand Down
13 changes: 5 additions & 8 deletions tests/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ func TestState(t *testing.T) {
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`, "bug in test")
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/Byzantium`, "bug in test")
st.fails(`^stRandom/randomStatetest645\.json/EIP150/.*`, "known bug #15119")
st.fails(`^stRandom/randomStatetest645\.json/Frontier/.*`, "known bug #15119")
st.fails(`^stRandom/randomStatetest645\.json/Homestead/.*`, "known bug #15119")
st.fails(`^stRandom/randomStatetest644\.json/EIP150/.*`, "known bug #15119")
st.fails(`^stRandom/randomStatetest644\.json/Frontier/.*`, "known bug #15119")
st.fails(`^stRandom/randomStatetest644\.json/Homestead/.*`, "known bug #15119")
st.fails(`^stRandom2/randomStatetest64[45]\.json/(EIP150|Frontier|Homestead)/.*`, "known bug #15119")
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/2`, "known bug ")
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/3`, "known bug ")
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/2`, "known bug ")
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/3`, "known bug ")

st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
for _, subtest := range test.Subtests() {
subtest := subtest
Expand All @@ -68,8 +64,7 @@ func TestState(t *testing.T) {
}

// Transactions with gasLimit above this value will not get a VM trace on failure.
//const traceErrorLimit = 400000
const traceErrorLimit = 0
const traceErrorLimit = 400000

func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
err := test(vm.Config{})
Expand All @@ -93,4 +88,6 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
} else {
t.Log("EVM operation log:\n" + buf.String())
}
t.Logf("EVM output: 0x%x", tracer.Output())
t.Logf("EVM error: %v", tracer.Error())
}
2 changes: 1 addition & 1 deletion tests/testdata
Submodule testdata updated 15109 files

0 comments on commit 1c2378b

Please sign in to comment.