mirror of https://github.com/golang/go.git
test: move linkx and sinit to run.go
The remaining run-only tests will be migrated to run.go in another CL. This CL will break the build due to issues 8746 and 8806. Update #4139 Update #8746 Update #8806 LGTM=rsc R=rsc, bradfitz, iant CC=golang-codereviews https://golang.org/cl/144630044
This commit is contained in:
parent
5b110c7b08
commit
9b5444420c
|
|
@ -1,13 +1,11 @@
|
|||
// $G $D/$F.go && $L -X main.tbd hello -X main.overwrite trumped -X main.nosuchsymbol neverseen $F.$A && ./$A.out
|
||||
|
||||
// NOTE: This test is not run by 'run.go' and so not run by all.bash.
|
||||
// To run this test you must use the ./run shell script.
|
||||
// skip
|
||||
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test the -X facility of the gc linker (6l etc.).
|
||||
// This test is run by linkx_run.go.
|
||||
|
||||
package main
|
||||
|
||||
|
|
@ -15,10 +13,6 @@ var tbd string
|
|||
var overwrite string = "dibs"
|
||||
|
||||
func main() {
|
||||
if tbd != "hello" {
|
||||
println("BUG: test/linkx tbd", len(tbd), tbd)
|
||||
}
|
||||
if overwrite != "trumped" {
|
||||
println("BUG: test/linkx overwrite", len(overwrite), overwrite)
|
||||
}
|
||||
println(tbd)
|
||||
println(overwrite)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
// run
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Run the linkx test.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd := exec.Command("go", "run", "-ldflags=-X main.tbd hello -X main.overwrite trumped", "linkx.go")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Println(string(out))
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
want := "hello\ntrumped\n"
|
||||
got := string(out)
|
||||
if got != want {
|
||||
fmt.Printf("got %q want %q\n", got, want)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
@ -907,8 +907,6 @@ func (t *test) wantedErrors(file, short string) (errs []wantedError) {
|
|||
}
|
||||
|
||||
var skipOkay = map[string]bool{
|
||||
"linkx.go": true, // like "run" but wants linker flags
|
||||
"sinit.go": true,
|
||||
"fixedbugs/bug248.go": true, // combines errorcheckdir and rundir in the same dir.
|
||||
"fixedbugs/bug302.go": true, // tests both .$O and .a imports.
|
||||
"fixedbugs/bug345.go": true, // needs the appropriate flags in gc invocation.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
// $G -S $D/$F.go | egrep initdone >/dev/null && echo BUG sinit || true
|
||||
|
||||
// NOTE: This test is not run by 'run.go' and so not run by all.bash.
|
||||
// To run this test you must use the ./run shell script.
|
||||
// skip
|
||||
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
@ -9,6 +6,7 @@
|
|||
|
||||
// Test that many initializations can be done at link time and
|
||||
// generate no executable init functions.
|
||||
// This test is run by sinit_run.go.
|
||||
|
||||
package p
|
||||
|
||||
|
|
@ -106,12 +104,12 @@ var answers = [...]int{
|
|||
}
|
||||
|
||||
var (
|
||||
copy_zero = zero
|
||||
copy_one = one
|
||||
copy_pi = pi
|
||||
copy_slice = slice
|
||||
copy_zero = zero
|
||||
copy_one = one
|
||||
copy_pi = pi
|
||||
copy_slice = slice
|
||||
copy_sliceInt = sliceInt
|
||||
copy_hello = hello
|
||||
copy_hello = hello
|
||||
|
||||
// Could be handled without an initialization function, but
|
||||
// requires special handling for "a = []byte("..."); b = a"
|
||||
|
|
@ -121,12 +119,12 @@ var (
|
|||
// make this special case work.
|
||||
|
||||
copy_four, copy_five = four, five
|
||||
copy_x, copy_y = x, y
|
||||
copy_nilslice = nilslice
|
||||
copy_nilmap = nilmap
|
||||
copy_nilfunc = nilfunc
|
||||
copy_nilchan = nilchan
|
||||
copy_nilptr = nilptr
|
||||
copy_x, copy_y = x, y
|
||||
copy_nilslice = nilslice
|
||||
copy_nilmap = nilmap
|
||||
copy_nilfunc = nilfunc
|
||||
copy_nilchan = nilchan
|
||||
copy_nilptr = nilptr
|
||||
)
|
||||
|
||||
var copy_a = a
|
||||
|
|
@ -179,7 +177,7 @@ var sx []int
|
|||
var s0 = []int{0, 0, 0}
|
||||
var s1 = []int{1, 2, 3}
|
||||
|
||||
func fi() int
|
||||
func fi() int { return 1 }
|
||||
|
||||
var ax [10]int
|
||||
var a0 = [10]int{0, 0, 0}
|
||||
|
|
@ -281,6 +279,8 @@ type T1 int
|
|||
|
||||
func (t *T1) M() {}
|
||||
|
||||
type Mer interface { M() }
|
||||
type Mer interface {
|
||||
M()
|
||||
}
|
||||
|
||||
var _ Mer = (*T1)(nil)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
// run
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Run the sinit test.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/build"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func main() {
|
||||
letter, err := build.ArchChar(build.Default.GOARCH)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
cmd := exec.Command("go", "tool", letter+"g", "-S", "sinit.go")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Println(string(out))
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Remove("sinit." + letter)
|
||||
|
||||
if bytes.Contains(out, []byte("initdone")) {
|
||||
fmt.Println("sinit generated an init function")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue