@@ -317,7 +317,6 @@ var mtimeTick time.Duration = 1 * time.Second
317
317
type testgoData struct {
318
318
t * testing.T
319
319
temps []string
320
- wd string
321
320
env []string
322
321
tempdir string
323
322
ran bool
@@ -367,9 +366,6 @@ func (tg *testgoData) parallel() {
367
366
if tg .ran {
368
367
tg .t .Fatal ("internal testsuite error: call to parallel after run" )
369
368
}
370
- if tg .wd != "" {
371
- tg .t .Fatal ("internal testsuite error: call to parallel after cd" )
372
- }
373
369
for _ , e := range tg .env {
374
370
if strings .HasPrefix (e , "GOROOT=" ) || strings .HasPrefix (e , "GOPATH=" ) || strings .HasPrefix (e , "GOBIN=" ) {
375
371
val := e [strings .Index (e , "=" )+ 1 :]
@@ -680,15 +676,6 @@ func (tg *testgoData) creatingTemp(path string) {
680
676
if filepath .IsAbs (path ) && ! strings .HasPrefix (path , tg .tempdir ) {
681
677
tg .t .Fatalf ("internal testsuite error: creatingTemp(%q) with absolute path not in temporary directory" , path )
682
678
}
683
- // If we have changed the working directory, make sure we have
684
- // an absolute path, because we are going to change directory
685
- // back before we remove the temporary.
686
- if ! filepath .IsAbs (path ) {
687
- if tg .wd == "" || strings .HasPrefix (tg .wd , testGOROOT ) {
688
- tg .t .Fatalf ("internal testsuite error: creatingTemp(%q) within GOROOT/src" , path )
689
- }
690
- path = filepath .Join (tg .wd , path )
691
- }
692
679
tg .must (robustio .RemoveAll (path ))
693
680
tg .temps = append (tg .temps , path )
694
681
}
@@ -842,16 +829,6 @@ var testWork = flag.Bool("testwork", false, "")
842
829
// cleanup cleans up a test that runs testgo.
843
830
func (tg * testgoData ) cleanup () {
844
831
tg .t .Helper ()
845
- if tg .wd != "" {
846
- wd , _ := os .Getwd ()
847
- tg .t .Logf ("ended in %s" , wd )
848
-
849
- if err := os .Chdir (tg .wd ); err != nil {
850
- // We are unlikely to be able to continue.
851
- fmt .Fprintln (os .Stderr , "could not restore working directory, crashing:" , err )
852
- os .Exit (2 )
853
- }
854
- }
855
832
if * testWork {
856
833
tg .t .Logf ("TESTWORK=%s\n " , tg .path ("." ))
857
834
return
@@ -2093,27 +2070,6 @@ const (
2093
2070
okPattern = `(?m)^ok`
2094
2071
)
2095
2072
2096
- func TestLinkXImportPathEscape (t * testing.T ) {
2097
- // golang.org/issue/16710
2098
- skipIfGccgo (t , "gccgo does not support -ldflags -X" )
2099
- tg := testgo (t )
2100
- defer tg .cleanup ()
2101
- tg .parallel ()
2102
- tg .makeTempdir ()
2103
- tg .setenv ("GOPATH" , filepath .Join (tg .pwd (), "testdata" ))
2104
- exe := tg .path ("linkx" + exeSuffix )
2105
- tg .creatingTemp (exe )
2106
- tg .run ("build" , "-o" , exe , "-ldflags" , "-X=my.pkg.Text=linkXworked" , "my.pkg/main" )
2107
- out , err := exec .Command (exe ).CombinedOutput ()
2108
- if err != nil {
2109
- tg .t .Fatal (err )
2110
- }
2111
- if string (out ) != "linkXworked\n " {
2112
- tg .t .Log (string (out ))
2113
- tg .t .Fatal (`incorrect output: expected "linkXworked\n"` )
2114
- }
2115
- }
2116
-
2117
2073
// Issue 18044.
2118
2074
func TestLdBindNow (t * testing.T ) {
2119
2075
tg := testgo (t )
0 commit comments