@@ -988,15 +988,15 @@ func TestGoexitCrash(t *testing.T) {
988988 name string
989989 want string
990990 }{
991- {"main" , "all goroutines are asleep - deadlock!" },
992- {"deadlock" , "all goroutines are asleep - deadlock!" },
993- {"exit" , "all goroutines are asleep - deadlock!" },
994- {"main-other" , "all goroutines are asleep - deadlock!" },
995- {"in-panic" , "all goroutines are asleep - deadlock!" },
991+ {"main" , "fatal error: all goroutines are asleep - deadlock!" },
992+ {"deadlock" , "fatal error: all goroutines are asleep - deadlock!" },
993+ {"exit" , "fatal error: all goroutines are asleep - deadlock!" },
994+ {"main-other" , "fatal error: all goroutines are asleep - deadlock!" },
995+ {"in-panic" , "fatal error: all goroutines are asleep - deadlock!" },
996996 {"panic" , "panic: panic after Goexit" },
997- {"recovered-panic" , "all goroutines are asleep - deadlock!" },
998- {"recover-before-panic" , "all goroutines are asleep - deadlock!" },
999- {"recover-before-panic-loop" , "all goroutines are asleep - deadlock!" },
997+ {"recovered-panic" , "fatal error: all goroutines are asleep - deadlock!" },
998+ {"recover-before-panic" , "fatal error: all goroutines are asleep - deadlock!" },
999+ {"recover-before-panic-loop" , "fatal error: all goroutines are asleep - deadlock!" },
10001000 } {
10011001 t .Run (tc .name , func (t * testing.T ) {
10021002 output := & bytes.Buffer {}
@@ -1017,6 +1017,34 @@ func TestGoexitCrash(t *testing.T) {
10171017 }
10181018}
10191019
1020+ func TestRuntimeFatal (t * testing.T ) {
1021+ t .Parallel ()
1022+
1023+ options := optionsFromTarget ("" , sema )
1024+ config , err := builder .NewConfig (& options )
1025+ if err != nil {
1026+ t .Fatal (err )
1027+ }
1028+
1029+ output := & bytes.Buffer {}
1030+ _ , err = buildAndRun ("testdata/runtimefatal.go" , config , output , nil , nil , time .Minute , func (cmd * exec.Cmd , result builder.BuildResult ) error {
1031+ cmd .Stdout = nil
1032+ cmd .Stderr = nil
1033+ data , err := cmd .CombinedOutput ()
1034+ output .Write (data )
1035+ return err
1036+ })
1037+ if err == nil {
1038+ t .Fatal ("program unexpectedly exited successfully" )
1039+ }
1040+ if want := "fatal error: sync: unlock of unlocked Mutex" ; ! strings .Contains (output .String (), want ) {
1041+ t .Fatalf ("output does not contain %q:\n %s" , want , output .String ())
1042+ }
1043+ if strings .Contains (output .String (), "recovered:" ) {
1044+ t .Fatalf ("fatal runtime error was recovered:\n %s" , output .String ())
1045+ }
1046+ }
1047+
10201048func TestTest (t * testing.T ) {
10211049 t .Parallel ()
10221050
0 commit comments