diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-06 15:25:43 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-06 15:25:53 -0500 |
commit | 4b842fb0d1d7f9f09a205550f4a58f894003bce5 (patch) | |
tree | be7d283e711e27539b0611ad690fa1cec94fc322 | |
parent | 7343fd274c37246ba449550cf29f638351794ba4 (diff) | |
download | planr-4b842fb0d1d7f9f09a205550f4a58f894003bce5.tar.xz planr-4b842fb0d1d7f9f09a205550f4a58f894003bce5.zip |
Show debug output if student links external main
-rw-r--r-- | adapters/gtest/executable.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/adapters/gtest/executable.go b/adapters/gtest/executable.go index 80560c5..bb47d9c 100644 --- a/adapters/gtest/executable.go +++ b/adapters/gtest/executable.go @@ -1,18 +1,20 @@ package gtest import ( - "os" + "context" "errors" - "time" + "fmt" "io/ioutil" "log" + "os" "os/exec" "path" "reflect" "sort" - "context" + "time" - "golang.flu0r1ne.net/planr") + "golang.flu0r1ne.net/planr" +) type executable struct { exeNm string @@ -159,7 +161,10 @@ func runGtest(exe string, tc planr.TestCase, builddir string) planr.TestResult { results, err := decodeResults(f) if err != nil { - log.Fatalf("Could not collect results from %s: %v", exe, err) + result.Status = planr.COMPILATION_FAILURE + result.DebugOutput += fmt.Sprintf("Could not collect results from %s: %v\n\nDid you mistakenly create a main?\n", exe, err) + + return result } if len(results) < 1 { |