From 3337257fe24b67871406217e98862d34647dd725 Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Fri, 13 Aug 2021 16:31:04 -0500 Subject: Add colorized output and build traces --- adapters/gtest/results.go | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'adapters/gtest/results.go') diff --git a/adapters/gtest/results.go b/adapters/gtest/results.go index 88e4069..c556749 100644 --- a/adapters/gtest/results.go +++ b/adapters/gtest/results.go @@ -6,8 +6,6 @@ import ( "io" "log" "time" - - "golang.flu0r1ne.net/planr" ) type gFailure struct { @@ -48,8 +46,19 @@ type gResults struct { } type Result struct { - id string - result planr.TestResult + id string + pass bool + failureMsg string +} + +func failureMsg(failures []gFailure) string { + failure_msg := "" + + for _, failure := range failures { + failure_msg += failure.Failure + } + + return failure_msg } func decodeResults(r io.Reader) []Result { @@ -69,13 +78,15 @@ func decodeResults(r io.Reader) []Result { for _, test := range suite.Testsuite { n := len(test.Failures) - decoded = append(decoded, Result{ + + res := Result { id: suite.Name + "." + test.Name, - result: planr.TestResult { - Pass: n == 0, - }, - }) + pass: n == 0, + failureMsg: failureMsg(test.Failures), + } + + decoded = append(decoded, res) } } -- cgit v1.2.3 From 9954b5fa87f74c035739159f4bb831900e5e35be Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Fri, 13 Aug 2021 17:03:57 -0500 Subject: Fenced test & compilation output --- adapters/gtest/results.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'adapters/gtest/results.go') diff --git a/adapters/gtest/results.go b/adapters/gtest/results.go index c556749..0e96edc 100644 --- a/adapters/gtest/results.go +++ b/adapters/gtest/results.go @@ -55,7 +55,7 @@ func failureMsg(failures []gFailure) string { failure_msg := "" for _, failure := range failures { - failure_msg += failure.Failure + failure_msg += failure.Failure + "\n" } return failure_msg -- cgit v1.2.3 From 5d33040ab80b5cce7883b2e5965aa17db2e6515a Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Fri, 13 Aug 2021 18:25:17 -0500 Subject: Opt to show CLI output over JSON output --- adapters/gtest/results.go | 1 + 1 file changed, 1 insertion(+) (limited to 'adapters/gtest/results.go') diff --git a/adapters/gtest/results.go b/adapters/gtest/results.go index 0e96edc..2991823 100644 --- a/adapters/gtest/results.go +++ b/adapters/gtest/results.go @@ -49,6 +49,7 @@ type Result struct { id string pass bool failureMsg string + testOutput string } func failureMsg(failures []gFailure) string { -- cgit v1.2.3 From 24548e87decbdfea38bbf692cecad6d4eefc3ec0 Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Sun, 22 Aug 2021 23:27:53 -0500 Subject: Refactoring & Enhanced logging --- adapters/gtest/results.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'adapters/gtest/results.go') diff --git a/adapters/gtest/results.go b/adapters/gtest/results.go index 2991823..14f5d1d 100644 --- a/adapters/gtest/results.go +++ b/adapters/gtest/results.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "io" - "log" "time" ) @@ -62,19 +61,20 @@ func failureMsg(failures []gFailure) string { return failure_msg } -func decodeResults(r io.Reader) []Result { +func decodeResults(r io.Reader) ([]Result, error) { + decoded := make([]Result, 0) + var results gResults buf := bytes.Buffer{} if _, err := buf.ReadFrom(r); err != nil { - log.Fatal(err) + return decoded, err } if err := json.Unmarshal(buf.Bytes(), &results); err != nil { - log.Fatal(err) + return decoded, err } - decoded := make([]Result, 0) for _, suite := range results.Testsuites { for _, test := range suite.Testsuite { n := len(test.Failures) @@ -91,5 +91,5 @@ func decodeResults(r io.Reader) []Result { } } - return decoded + return decoded, nil } -- cgit v1.2.3