From b9d67296ef775bbdcc9548476f25dd217d49254c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Sun, 16 Aug 2020 22:15:12 +0100 Subject: [PATCH] small adjustments to runner. --- conformance/runner_test.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/conformance/runner_test.go b/conformance/runner_test.go index c2519a3f8..edccc2a78 100644 --- a/conformance/runner_test.go +++ b/conformance/runner_test.go @@ -25,7 +25,7 @@ const ( // // When running this test, the corpus root can be overridden through the // -corpus.root CLI flag to run an alternate corpus. - defaultCorpusRoot = "../extern/conformance-vectors" + defaultCorpusRoot = "../extern/test-vectors/corpus" ) var ( @@ -97,20 +97,20 @@ func TestConformance(t *testing.T) { // Run a test for each vector. for _, v := range vectors { - v := v + path := filepath.Join(corpusRoot, v) + raw, err := ioutil.ReadFile(path) + if err != nil { + t.Fatalf("failed to read test raw file: %s", path) + } + + var vector TestVector + err = json.Unmarshal(raw, &vector) + if err != nil { + t.Errorf("failed to parse test vector %s: %s; skipping", path, err) + continue + } + t.Run(v, func(t *testing.T) { - path := filepath.Join(corpusRoot, v) - raw, err := ioutil.ReadFile(path) - if err != nil { - t.Fatalf("failed to read test raw file: %s", path) - } - - var vector TestVector - err = json.Unmarshal(raw, &vector) - if err != nil { - t.Fatalf("failed to parse test raw: %s", err) - } - // dispatch the execution depending on the vector class. switch vector.Class { case "message": @@ -181,6 +181,7 @@ func executeMessageVector(t *testing.T, vector *TestVector) { // Once all messages are applied, assert that the final state root matches // the expected postcondition root. if root != vector.Post.StateTree.RootCID { + // TODO trigger state diff on failure (@willscott) t.Errorf("wrong post root cid; expected %vector , but got %vector", vector.Post.StateTree.RootCID, root) } }