Skip to content

Commit

Permalink
Fix a bug where exit code 101 and 102 would not cause go test to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotchance committed Aug 20, 2017
1 parent 7d8a7f2 commit 60de496
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func TestIntegrationScripts(t *testing.T) {
err = cmd.Run()
cProgram.isZero = err == nil

// Check for special exit codes that signal that tests have failed.
if exitError, ok := err.(*exec.ExitError); ok {
exitStatus := exitError.Sys().(syscall.WaitStatus).ExitStatus()
if exitStatus == 101 || exitStatus == 102 {
t.Fatal(cProgram.stdout.String())
}
}

mainFileName = "main_test.go"

programArgs := ProgramArgs{
Expand Down Expand Up @@ -136,14 +144,6 @@ func TestIntegrationScripts(t *testing.T) {
err = cmd.Run()
goProgram.isZero = err == nil

// Check for special exit codes that signal that tests have failed.
if exitError, ok := err.(*exec.ExitError); ok {
exitStatus := exitError.Sys().(syscall.WaitStatus).ExitStatus()
if exitStatus == 101 || exitStatus == 102 {
t.Fatal(goProgram.stdout.String())
}
}

// Check stderr. "go test" will produce warnings when packages are
// not referenced as dependencies. We need to strip out these
// warnings so it doesn't effect the comparison.
Expand Down

0 comments on commit 60de496

Please sign in to comment.