mirror of
https://github.com/golang/go
synced 2024-11-18 10:24:42 -07:00
debug/gosym: avoid calling the shell in test
Change-Id: I95bf62c0f2d77dd67515921e6aefa511cce8d95d Reviewed-on: https://go-review.googlesource.com/10633 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
48f2d30d43
commit
3e2fc94f04
@ -6,7 +6,6 @@ package gosym
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"debug/elf"
|
"debug/elf"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -30,10 +29,6 @@ func dotest(self bool) bool {
|
|||||||
if self && runtime.GOOS != "linux" {
|
if self && runtime.GOOS != "linux" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// Command below expects "sh", so Unix.
|
|
||||||
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if pclinetestBinary != "" {
|
if pclinetestBinary != "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -49,9 +44,14 @@ func dotest(self bool) bool {
|
|||||||
// the resulting binary looks like it was built from pclinetest.s,
|
// the resulting binary looks like it was built from pclinetest.s,
|
||||||
// but we have renamed it to keep it away from the go tool.
|
// but we have renamed it to keep it away from the go tool.
|
||||||
pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest")
|
pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest")
|
||||||
command := fmt.Sprintf("go tool asm -o %s.o pclinetest.asm && go tool link -H linux -E main -o %s %s.o",
|
cmd := exec.Command("go", "tool", "asm", "-o", pclinetestBinary+".o", "pclinetest.asm")
|
||||||
pclinetestBinary, pclinetestBinary, pclinetestBinary)
|
cmd.Stdout = os.Stdout
|
||||||
cmd := exec.Command("sh", "-c", command)
|
cmd.Stderr = os.Stderr
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
cmd = exec.Command("go", "tool", "link", "-H", "linux", "-E", "main",
|
||||||
|
"-o", pclinetestBinary, pclinetestBinary+".o")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user