diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-13 18:25:17 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-13 18:25:17 -0500 |
commit | 5d33040ab80b5cce7883b2e5965aa17db2e6515a (patch) | |
tree | effe42208df6f44933a057dcf8f999061359eed4 | |
parent | 4a808e5c97725b0fb4174b6961722a3f4600b9a7 (diff) | |
download | deb-planr-5d33040ab80b5cce7883b2e5965aa17db2e6515a.tar.xz deb-planr-5d33040ab80b5cce7883b2e5965aa17db2e6515a.zip |
Opt to show CLI output over JSON output
-rw-r--r-- | adapters/gtest/adapter.go | 6 | ||||
-rw-r--r-- | adapters/gtest/results.go | 1 | ||||
-rw-r--r-- | cmd/planr/sub/cli.go | 4 | ||||
-rw-r--r-- | testcase.go | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/adapters/gtest/adapter.go b/adapters/gtest/adapter.go index 3d769e3..8dc333d 100644 --- a/adapters/gtest/adapter.go +++ b/adapters/gtest/adapter.go @@ -85,7 +85,8 @@ func (adapter *GtestAdapter) execTests(cnames []string) ResultFromId { defer cancel() defer os.Remove(f.Name()) - if err := cmd.Run(); err != nil { + out, err := cmd.CombinedOutput() + if err != nil { var exiterr *exec.ExitError if !errors.As(err, &exiterr) { @@ -95,6 +96,7 @@ func (adapter *GtestAdapter) execTests(cnames []string) ResultFromId { } for _, r := range decodeResults(f) { + r.testOutput = string(out) lut[exe + "." + r.id] = r } } @@ -169,6 +171,6 @@ func (adapter *GtestAdapter) Evaluate(tcs []*planr.TestCase) { tc.Result.Status = planr.RUNTIME_FAILURE } - tc.Result.FailureMsg = result.failureMsg + tc.Result.TestOutput = result.testOutput } } 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 { diff --git a/cmd/planr/sub/cli.go b/cmd/planr/sub/cli.go index da888d9..dff9089 100644 --- a/cmd/planr/sub/cli.go +++ b/cmd/planr/sub/cli.go @@ -97,9 +97,9 @@ func tcPprint(tc planr.TestCase) { } else if res.Status == planr.RUNTIME_FAILURE { - if tc.Result.FailureMsg != "" { + if tc.Result.TestOutput != "" { fmt.Println() - pprintFenced("test output", tc.Result.FailureMsg); + pprintFenced("test output", tc.Result.TestOutput); } } diff --git a/testcase.go b/testcase.go index d3fe8ed..8506b84 100644 --- a/testcase.go +++ b/testcase.go @@ -11,8 +11,8 @@ const ( type TestResult struct { Id string Status TestStatus - FailureMsg string DebugOutput string + TestOutput string } type TestCase struct { |