Commit c978a5a3 authored by Russ Cox's avatar Russ Cox

test: skip . files in directory

Xcode generates ._foo.go files.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5786055
parent 56cae1c2
...@@ -147,7 +147,7 @@ func goFiles(dir string) []string { ...@@ -147,7 +147,7 @@ func goFiles(dir string) []string {
check(err) check(err)
names := []string{} names := []string{}
for _, name := range dirnames { for _, name := range dirnames {
if strings.HasSuffix(name, ".go") { if !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") {
names = append(names, name) names = append(names, name)
} }
} }
...@@ -239,7 +239,7 @@ func (t *test) run() { ...@@ -239,7 +239,7 @@ func (t *test) run() {
if strings.HasPrefix(action, "//") { if strings.HasPrefix(action, "//") {
action = action[2:] action = action[2:]
} }
var args []string var args []string
f := strings.Fields(action) f := strings.Fields(action)
if len(f) > 0 { if len(f) > 0 {
...@@ -264,7 +264,7 @@ func (t *test) run() { ...@@ -264,7 +264,7 @@ func (t *test) run() {
err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644) err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644)
check(err) check(err)
// A few tests (of things like the environment) require these to be set. // A few tests (of things like the environment) require these to be set.
os.Setenv("GOOS", runtime.GOOS) os.Setenv("GOOS", runtime.GOOS)
os.Setenv("GOARCH", runtime.GOARCH) os.Setenv("GOARCH", runtime.GOARCH)
...@@ -283,7 +283,7 @@ func (t *test) run() { ...@@ -283,7 +283,7 @@ func (t *test) run() {
} }
long := filepath.Join(cwd, t.goFileName()) long := filepath.Join(cwd, t.goFileName())
switch action { switch action {
default: default:
t.err = fmt.Errorf("unimplemented action %q", action) t.err = fmt.Errorf("unimplemented action %q", action)
...@@ -291,19 +291,19 @@ func (t *test) run() { ...@@ -291,19 +291,19 @@ func (t *test) run() {
out, _ := runcmd("go", "tool", gc, "-e", "-o", "a."+letter, long) out, _ := runcmd("go", "tool", gc, "-e", "-o", "a."+letter, long)
t.err = t.errorCheck(string(out), long, t.gofile) t.err = t.errorCheck(string(out), long, t.gofile)
return return
case "compile": case "compile":
out, err := runcmd("go", "tool", gc, "-e", "-o", "a."+letter, long) out, err := runcmd("go", "tool", gc, "-e", "-o", "a."+letter, long)
if err != nil { if err != nil {
t.err = fmt.Errorf("%s\n%s", err, out) t.err = fmt.Errorf("%s\n%s", err, out)
} }
case "build": case "build":
out, err := runcmd("go", "build", "-o", "a.exe", long) out, err := runcmd("go", "build", "-o", "a.exe", long)
if err != nil { if err != nil {
t.err = fmt.Errorf("%s\n%s", err, out) t.err = fmt.Errorf("%s\n%s", err, out)
} }
case "run": case "run":
useTmp = false useTmp = false
out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...) out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
......
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