1
0
mirror of https://github.com/golang/go synced 2024-11-21 20:34:40 -07:00

go/build: exclude cgo test from arm

go/build: include command output in error values
go/build: add syslist.go to .hgignore

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4550118
This commit is contained in:
Andrew Gerrand 2011-06-06 09:25:30 +10:00
parent b47a38dedb
commit eb72403bb6
3 changed files with 11 additions and 1 deletions

View File

@ -42,6 +42,7 @@ src/cmd/gc/yerr.h
src/cmd/goinstall/syslist.go src/cmd/goinstall/syslist.go
src/pkg/Make.deps src/pkg/Make.deps
src/pkg/exp/ogle/ogle src/pkg/exp/ogle/ogle
src/pkg/go/build/syslist.go
src/pkg/os/signal/unix.go src/pkg/os/signal/unix.go
src/pkg/runtime/*/asm.h src/pkg/runtime/*/asm.h
src/pkg/runtime/goc2c src/pkg/runtime/goc2c

View File

@ -6,6 +6,7 @@
package build package build
import ( import (
"bytes"
"exec" "exec"
"fmt" "fmt"
"os" "os"
@ -79,8 +80,11 @@ func (c *Cmd) String() string {
} }
func (c *Cmd) Run(dir string) os.Error { func (c *Cmd) Run(dir string) os.Error {
out := new(bytes.Buffer)
cmd := exec.Command(c.Args[0], c.Args[1:]...) cmd := exec.Command(c.Args[0], c.Args[1:]...)
cmd.Dir = dir cmd.Dir = dir
cmd.Stdout = out
cmd.Stderr = out
if c.Stdout != "" { if c.Stdout != "" {
f, err := os.Create(filepath.Join(dir, c.Stdout)) f, err := os.Create(filepath.Join(dir, c.Stdout))
if err != nil { if err != nil {
@ -90,7 +94,7 @@ func (c *Cmd) Run(dir string) os.Error {
cmd.Stdout = f cmd.Stdout = f
} }
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return fmt.Errorf("command %q: %v", c, err) return fmt.Errorf("command %q: %v\n%v", c, err, out)
} }
return nil return nil
} }

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings"
"testing" "testing"
) )
@ -24,6 +25,10 @@ func TestBuild(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
for _, d := range buildDirs { for _, d := range buildDirs {
if runtime.GOARCH == "arm" && strings.Contains(d, "/cgo") {
// no cgo for arm, yet.
continue
}
dir := filepath.Join(runtime.GOROOT(), "src", d) dir := filepath.Join(runtime.GOROOT(), "src", d)
testBuild(t, dir, out) testBuild(t, dir, out)
} }