@@ -991,76 +991,76 @@ func TestTraceDirRecursion(t *testing.T) {
991991}
992992
993993func TestTraceNestDefer (t * testing.T ) {
994- dlvbin := protest .GetDlvBinary (t )
994+ dlvbin := protest .GetDlvBinary (t )
995995
996- expected := []byte ("> goroutine(1):frame(1) main.A()\n >> goroutine(1):frame(1) main.A => ()\n > goroutine(1):frame(2) runtime.deferreturn()\n > goroutine(1):frame(3) main.C()\n >> goroutine(1):frame(3) main.C => ()\n > goroutine(1):frame(4) runtime.deferreturn()\n > goroutine(1):frame(5) main.D()\n > goroutine(1):frame(6) main.B()\n >> goroutine(1):frame(6) main.B => ()\n >> goroutine(1):frame(5) main.D => ()\n >> goroutine(1):frame(4) runtime.deferreturn => ()\n >> goroutine(1):frame(3) main.C => ()\n >> goroutine(1):frame(2) runtime.deferreturn => ()\n >> goroutine(1):frame(1) main.A => ()\n " )
996+ expected := []byte ("> goroutine(1):frame(1) main.A()\n >> goroutine(1):frame(1) main.A => ()\n > goroutine(1):frame(2) runtime.deferreturn()\n > goroutine(1):frame(3) main.C()\n >> goroutine(1):frame(3) main.C => ()\n > goroutine(1):frame(4) runtime.deferreturn()\n > goroutine(1):frame(5) main.D()\n > goroutine(1):frame(6) main.B()\n >> goroutine(1):frame(6) main.B => ()\n >> goroutine(1):frame(5) main.D => ()\n >> goroutine(1):frame(4) runtime.deferreturn => ()\n >> goroutine(1):frame(3) main.C => ()\n >> goroutine(1):frame(2) runtime.deferreturn => ()\n >> goroutine(1):frame(1) main.A => ()\n " )
997997
998- fixtures := protest .FindFixturesDir ()
999- cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "nestdefer.go" ), "main.A" , "--follow-calls" , "6" )
1000- rdr , err := cmd .StderrPipe ()
1001- assertNoError (err , t , "stderr pipe" )
1002- defer rdr .Close ()
998+ fixtures := protest .FindFixturesDir ()
999+ cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "nestdefer.go" ), "main.A" , "--follow-calls" , "6" )
1000+ rdr , err := cmd .StderrPipe ()
1001+ assertNoError (err , t , "stderr pipe" )
1002+ defer rdr .Close ()
10031003
1004- cmd .Dir = filepath .Join (fixtures , "buildtest" )
1004+ cmd .Dir = filepath .Join (fixtures , "buildtest" )
10051005
1006- assertNoError (cmd .Start (), t , "running trace" )
1006+ assertNoError (cmd .Start (), t , "running trace" )
10071007
1008- output , err := io .ReadAll (rdr )
1009- assertNoError (err , t , "ReadAll" )
1008+ output , err := io .ReadAll (rdr )
1009+ assertNoError (err , t , "ReadAll" )
10101010
1011- if ! bytes .Contains (output , expected ) {
1012- t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1013- }
1014- cmd .Wait ()
1011+ if ! bytes .Contains (output , expected ) {
1012+ t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1013+ }
1014+ cmd .Wait ()
10151015}
10161016
10171017func TestTraceUnnamedDeferLoop (t * testing.T ) {
1018- dlvbin := protest .GetDlvBinary (t )
1018+ dlvbin := protest .GetDlvBinary (t )
10191019
1020- expected := []byte (
1021- "> goroutine(1):frame(1) main.main()\n > goroutine(1):frame(2) main.A(2)\n >> goroutine(1):frame(2) main.A => ()\n > goroutine(1):frame(3) runtime.deferreturn()\n > goroutine(1):frame(4) main.A.func1()\n >> goroutine(1):frame(4) main.A.func1 => ()\n > goroutine(1):frame(4) main.A.func1()\n >> goroutine(1):frame(4) main.A.func1 => ()\n >> goroutine(1):frame(3) runtime.deferreturn => ()\n >> goroutine(1):frame(2) main.A => ()\n >> goroutine(1):frame(1) main.main => ()" )
1020+ expected := []byte (
1021+ "> goroutine(1):frame(1) main.main()\n > goroutine(1):frame(2) main.A(2)\n >> goroutine(1):frame(2) main.A => ()\n > goroutine(1):frame(3) runtime.deferreturn()\n > goroutine(1):frame(4) main.A.func1()\n >> goroutine(1):frame(4) main.A.func1 => ()\n > goroutine(1):frame(4) main.A.func1()\n >> goroutine(1):frame(4) main.A.func1 => ()\n >> goroutine(1):frame(3) runtime.deferreturn => ()\n >> goroutine(1):frame(2) main.A => ()\n >> goroutine(1):frame(1) main.main => ()" )
10221022
1023- fixtures := protest .FindFixturesDir ()
1024- cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "deferloop.go" ), "main.main" , "--follow-calls" , "5" )
1025- rdr , err := cmd .StderrPipe ()
1026- assertNoError (err , t , "stderr pipe" )
1027- defer rdr .Close ()
1023+ fixtures := protest .FindFixturesDir ()
1024+ cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "deferloop.go" ), "main.main" , "--follow-calls" , "5" )
1025+ rdr , err := cmd .StderrPipe ()
1026+ assertNoError (err , t , "stderr pipe" )
1027+ defer rdr .Close ()
10281028
1029- cmd .Dir = filepath .Join (fixtures , "buildtest" )
1029+ cmd .Dir = filepath .Join (fixtures , "buildtest" )
10301030
1031- assertNoError (cmd .Start (), t , "running trace" )
1031+ assertNoError (cmd .Start (), t , "running trace" )
10321032
1033- output , err := io .ReadAll (rdr )
1034- assertNoError (err , t , "ReadAll" )
1033+ output , err := io .ReadAll (rdr )
1034+ assertNoError (err , t , "ReadAll" )
10351035
1036- if ! bytes .Contains (output , expected ) {
1037- t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1038- }
1039- cmd .Wait ()
1036+ if ! bytes .Contains (output , expected ) {
1037+ t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1038+ }
1039+ cmd .Wait ()
10401040}
1041- func TestTraceNamedDeferLoop (t * testing.T ) {
1042- dlvbin := protest .GetDlvBinary (t )
1041+ func TestTraceNamedDeferLoop (t * testing.T ) {
1042+ dlvbin := protest .GetDlvBinary (t )
10431043
1044- expected := []byte (
1045- "> goroutine(1):frame(1) main.main()\n > goroutine(1):frame(2) main.A(2)\n >> goroutine(1):frame(2) main.A => ()\n > goroutine(1):frame(3) runtime.deferreturn()\n > goroutine(1):frame(4) main.B()\n >> goroutine(1):frame(4) main.B => ()\n > goroutine(1):frame(4) main.B()\n >> goroutine(1):frame(4) main.B => ()\n >> goroutine(1):frame(3) runtime.deferreturn => ()\n >> goroutine(1):frame(2) main.A => ()\n >> goroutine(1):frame(1) main.main => ()" )
1044+ expected := []byte (
1045+ "> goroutine(1):frame(1) main.main()\n > goroutine(1):frame(2) main.A(2)\n >> goroutine(1):frame(2) main.A => ()\n > goroutine(1):frame(3) runtime.deferreturn()\n > goroutine(1):frame(4) main.B()\n >> goroutine(1):frame(4) main.B => ()\n > goroutine(1):frame(4) main.B()\n >> goroutine(1):frame(4) main.B => ()\n >> goroutine(1):frame(3) runtime.deferreturn => ()\n >> goroutine(1):frame(2) main.A => ()\n >> goroutine(1):frame(1) main.main => ()" )
10461046
1047- fixtures := protest .FindFixturesDir ()
1048- cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "namedeferloop.go" ), "main.main" , "--follow-calls" , "5" )
1049- rdr , err := cmd .StderrPipe ()
1050- assertNoError (err , t , "stderr pipe" )
1051- defer rdr .Close ()
1047+ fixtures := protest .FindFixturesDir ()
1048+ cmd := exec .Command (dlvbin , "trace" , "--output" , filepath .Join (t .TempDir (), "__debug" ), filepath .Join (fixtures , "namedeferloop.go" ), "main.main" , "--follow-calls" , "5" )
1049+ rdr , err := cmd .StderrPipe ()
1050+ assertNoError (err , t , "stderr pipe" )
1051+ defer rdr .Close ()
10521052
1053- cmd .Dir = filepath .Join (fixtures , "buildtest" )
1053+ cmd .Dir = filepath .Join (fixtures , "buildtest" )
10541054
1055- assertNoError (cmd .Start (), t , "running trace" )
1055+ assertNoError (cmd .Start (), t , "running trace" )
10561056
1057- output , err := io .ReadAll (rdr )
1058- assertNoError (err , t , "ReadAll" )
1057+ output , err := io .ReadAll (rdr )
1058+ assertNoError (err , t , "ReadAll" )
10591059
1060- if ! bytes .Contains (output , expected ) {
1061- t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1062- }
1063- cmd .Wait ()
1060+ if ! bytes .Contains (output , expected ) {
1061+ t .Fatalf ("expected:\n %s\n got:\n %s" , string (expected ), string (output ))
1062+ }
1063+ cmd .Wait ()
10641064}
10651065func TestTraceMultipleGoroutines (t * testing.T ) {
10661066 dlvbin := protest .GetDlvBinary (t )
0 commit comments