Commit 63f0aac5 authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

test: fix linkmain test

Change-Id: Ie8ec4cfc68abef51e52090a75245f96af874c74a
Reviewed-on: https://go-review.googlesource.com/18000Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent a7501495
...@@ -29,7 +29,7 @@ func run(cmdline string) { ...@@ -29,7 +29,7 @@ func run(cmdline string) {
cmd := exec.Command(args[0], args[1:]...) cmd := exec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
fmt.Printf("$ %s\n", strings.Join(args, " ")) fmt.Printf("$ %s\n", cmdline)
fmt.Println(string(out)) fmt.Println(string(out))
fmt.Println(err) fmt.Println(err)
cleanup() cleanup()
...@@ -37,11 +37,12 @@ func run(cmdline string) { ...@@ -37,11 +37,12 @@ func run(cmdline string) {
} }
} }
func runFail(args ...string) { func runFail(cmdline string) {
args := strings.Fields(cmdline)
cmd := exec.Command(args[0], args[1:]...) cmd := exec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err == nil { if err == nil {
fmt.Printf("$ %s\n", strings.Join(args, " ")) fmt.Printf("$ %s\n", cmdline)
fmt.Println(string(out)) fmt.Println(string(out))
fmt.Println("SHOULD HAVE FAILED!") fmt.Println("SHOULD HAVE FAILED!")
cleanup() cleanup()
...@@ -57,8 +58,8 @@ func main() { ...@@ -57,8 +58,8 @@ func main() {
run("go tool link -o linkmain.exe linkmain.a") run("go tool link -o linkmain.exe linkmain.a")
// linkmain.go is not // linkmain.go is not
run("go tool compile -o linkmain.o linkmain.go") run("go tool compile -o linkmain1.o linkmain.go")
run("go tool compile -pack -o linkmain.a linkmain.go") run("go tool compile -pack -o linkmain1.a linkmain.go")
runFail("go tool link -o linkmain.exe linkmain1.o") runFail("go tool link -o linkmain.exe linkmain1.o")
runFail("go tool link -o linkmain.exe linkmain1.a") runFail("go tool link -o linkmain.exe linkmain1.a")
cleanup() cleanup()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment