Commit c0a01e96 authored by Rob Pike's avatar Rob Pike

refine gobuild: the files must be *_test.go not *test.go

this causes complications

R=rsc
DELTA=1724  (849 added, 856 deleted, 19 changed)
OCL=19667
CL=19667
parent 12254b6c
...@@ -290,7 +290,7 @@ char preamble[] = ...@@ -290,7 +290,7 @@ char preamble[] =
"\n" "\n"
"coverage: packages\n" "coverage: packages\n"
"\tgotest\n" "\tgotest\n"
"\t6cov -g `pwd` | grep -v '^.*test\\.go:'\n" "\t6cov -g `pwd` | grep -v '_test\\.go:'\n"
"\n" "\n"
"%%.$O: %%.go\n" "%%.$O: %%.go\n"
"\t$(GC) $*.go\n" "\t$(GC) $*.go\n"
...@@ -487,7 +487,7 @@ main(int argc, char **argv) ...@@ -487,7 +487,7 @@ main(int argc, char **argv)
njob = 0; njob = 0;
job = emalloc(argc*sizeof job[0]); job = emalloc(argc*sizeof job[0]);
for(i=0; i<argc; i++) { for(i=0; i<argc; i++) {
if(strstr(argv[i], "test.go") != nil) if(suffix(argv[i], "_test.go") != nil)
continue; continue;
job[njob].name = argv[i]; job[njob].name = argv[i];
job[njob].pass = -1; job[njob].pass = -1;
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^.*test\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^test.*\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^test.*\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^.*test\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^test.*\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -32,35 +32,29 @@ coverage: packages ...@@ -32,35 +32,29 @@ coverage: packages
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
fd_$(GOOS).$O\
ip.$O\ ip.$O\
O2=\ O2=\
fd_$(GOOS).$O\ fd.$O\
net_$(GOOS).$O\ net_$(GOOS).$O\
O3=\ O3=\
fd.$O\
O4=\
net.$O\ net.$O\
net.a: a1 a2 a3 a4 net.a: a1 a2 a3
a1: $(O1) a1: $(O1)
$(AR) grc net.a ip.$O $(AR) grc net.a fd_$(GOOS).$O ip.$O
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc net.a fd_$(GOOS).$O net_$(GOOS).$O $(AR) grc net.a fd.$O net_$(GOOS).$O
rm -f $(O2) rm -f $(O2)
a3: $(O3) a3: $(O3)
$(AR) grc net.a fd.$O
rm -f $(O3)
a4: $(O4)
$(AR) grc net.a net.$O $(AR) grc net.a net.$O
rm -f $(O4) rm -f $(O3)
newpkg: clean newpkg: clean
$(AR) grc net.a $(AR) grc net.a
...@@ -68,7 +62,6 @@ newpkg: clean ...@@ -68,7 +62,6 @@ newpkg: clean
$(O1): newpkg $(O1): newpkg
$(O2): a1 $(O2): a1
$(O3): a2 $(O3): a2
$(O4): a3
nuke: clean nuke: clean
rm -f $(GOROOT)/pkg/net.a rm -f $(GOROOT)/pkg/net.a
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^test.*\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -35,9 +35,9 @@ O1=\ ...@@ -35,9 +35,9 @@ O1=\
os_error.$O\ os_error.$O\
O2=\ O2=\
os_env.$O\
os_file.$O\ os_file.$O\
os_time.$O\ os_time.$O\
os_env.$O\
os.a: a1 a2 os.a: a1 a2
...@@ -46,7 +46,7 @@ a1: $(O1) ...@@ -46,7 +46,7 @@ a1: $(O1)
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc os.a os_env.$O os_file.$O os_time.$O $(AR) grc os.a os_file.$O os_time.$O os_env.$O
rm -f $(O2) rm -f $(O2)
newpkg: clean newpkg: clean
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^.*test\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -175,24 +175,24 @@ export func TestAll(tt *testing.T) { // TODO(r): wrap up better ...@@ -175,24 +175,24 @@ export func TestAll(tt *testing.T) { // TODO(r): wrap up better
type C chan *T; // TODO: should not be necessary type C chan *T; // TODO: should not be necessary
var tmp = new(C); var tmp = new(C);
value := reflect.NewValue(tmp); value := reflect.NewValue(tmp);
assert(reflect.ValueToString(value), "*reflect.C·test(@)"); assert(reflect.ValueToString(value), "*reflect.C·all_test(@)");
} }
{ {
type A [10]int; type A [10]int;
var tmp A = A{1,2,3,4,5,6,7,8,9,10}; var tmp A = A{1,2,3,4,5,6,7,8,9,10};
value := reflect.NewValue(&tmp); value := reflect.NewValue(&tmp);
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}"); assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·all_test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123); value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}"); assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·all_test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
} }
{ {
type AA []int; type AA []int;
tmp1 := [10]int{1,2,3,4,5,6,7,8,9,10}; // TODO: should not be necessary to use tmp1 tmp1 := [10]int{1,2,3,4,5,6,7,8,9,10}; // TODO: should not be necessary to use tmp1
var tmp *AA = &tmp1; var tmp *AA = &tmp1;
value := reflect.NewValue(tmp); value := reflect.NewValue(tmp);
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}"); assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·all_test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123); value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}"); assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·all_test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
} }
{ {
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^.*test\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -20,7 +20,7 @@ test: packages ...@@ -20,7 +20,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^.*test\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
...@@ -22,7 +22,7 @@ test: packages ...@@ -22,7 +22,7 @@ test: packages
coverage: packages coverage: packages
gotest gotest
6cov -g `pwd` | grep -v '^test.*\.go:' 6cov -g `pwd` | grep -v '_test\.go:'
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
......
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