Merge pull request #3359 from austinabell/runner/returnval

Add in return value check in test-vector runner
This commit is contained in:
Łukasz Magiera 2020-08-28 00:19:32 +02:00 committed by GitHub
commit 22bdc43023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"context" "context"
"encoding/base64"
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"os" "os"
@ -195,6 +196,9 @@ func executeMessageVector(t *testing.T, vector *schema.TestVector) {
if expected, actual := receipt.GasUsed, ret.GasUsed; expected != actual { if expected, actual := receipt.GasUsed, ret.GasUsed; expected != actual {
t.Errorf("gas used of msg %d did not match; expected: %d, got: %d", i, expected, actual) t.Errorf("gas used of msg %d did not match; expected: %d, got: %d", i, expected, actual)
} }
if expected, actual := []byte(receipt.ReturnValue), ret.Return; !bytes.Equal(expected, actual) {
t.Errorf("return value of msg %d did not match; expected: %s, got: %s", i, base64.StdEncoding.EncodeToString(expected), base64.StdEncoding.EncodeToString(actual))
}
} }
// Once all messages are applied, assert that the final state root matches // Once all messages are applied, assert that the final state root matches