diff options
author | Russ Cox <rsc@golang.org> | 2008-11-19 12:52:30 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-11-19 12:52:30 -0800 |
commit | 7aa5a491ce56bf0fdc9c6fbf7c4d066d2055c25c (patch) | |
tree | 4a91d6743e36efd368a5fb4a842aabb4fcbf9ac1 | |
parent | 5c18aef91999e35197fb8b804378163b1f203c43 (diff) | |
download | golang-7aa5a491ce56bf0fdc9c6fbf7c4d066d2055c25c.tar.gz |
gobuild: add coverage rule, ignore files in package main.
R=r
DELTA=55 (41 added, 11 deleted, 3 changed)
OCL=19594
CL=19598
-rw-r--r-- | src/cmd/gobuild/gobuild.c | 9 | ||||
-rw-r--r-- | src/lib/fmt/Makefile | 4 | ||||
-rw-r--r-- | src/lib/http/Makefile | 21 | ||||
-rw-r--r-- | src/lib/math/Makefile | 4 | ||||
-rw-r--r-- | src/lib/net/Makefile | 4 | ||||
-rw-r--r-- | src/lib/os/Makefile | 4 | ||||
-rw-r--r-- | src/lib/reflect/Makefile | 4 | ||||
-rw-r--r-- | src/lib/strconv/Makefile | 4 | ||||
-rw-r--r-- | src/lib/syscall/Makefile | 4 |
9 files changed, 44 insertions, 14 deletions
diff --git a/src/cmd/gobuild/gobuild.c b/src/cmd/gobuild/gobuild.c index f0ba6f671..1056d883a 100644 --- a/src/cmd/gobuild/gobuild.c +++ b/src/cmd/gobuild/gobuild.c @@ -227,6 +227,9 @@ getpkg(char *file) return pkg[i]; } } + // don't put main in the package list + if(strcmp(p, "main") == 0) + return "main"; npkg++; pkg = erealloc(pkg, npkg*sizeof pkg[0]); pkg[i] = emalloc(strlen(p)+1); @@ -285,6 +288,10 @@ char preamble[] = "test: packages\n" "\tgotest\n" "\n" + "coverage: packages\n" + "\tgotest\n" + "\t6cov -g `pwd` | grep -v '^test.*\\.go:'\n" + "\n" "%%.$O: %%.go\n" "\t$(GC) $*.go\n" "\n" @@ -485,6 +492,8 @@ main(int argc, char **argv) job[njob].name = argv[i]; job[njob].pass = -1; job[njob].pkg = getpkg(argv[i]); + if(job[njob].pkg && strcmp(job[njob].pkg, "main") == 0) + continue; njob++; } diff --git a/src/lib/fmt/Makefile b/src/lib/fmt/Makefile index bdef02d69..394062235 100644 --- a/src/lib/fmt/Makefile +++ b/src/lib/fmt/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/http/Makefile b/src/lib/http/Makefile index 0827008f9..57b06192e 100644 --- a/src/lib/http/Makefile +++ b/src/lib/http/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go @@ -39,11 +43,7 @@ O3=\ O4=\ server.$O\ -O5=\ - triv.$O\ - -http.a: a1 a2 a3 a4 a5 -main.a: a1 a2 a3 a4 a5 +http.a: a1 a2 a3 a4 a1: $(O1) $(AR) grc http.a url.$O @@ -61,26 +61,19 @@ a4: $(O4) $(AR) grc http.a server.$O rm -f $(O4) -a5: $(O5) - $(AR) grc main.a triv.$O - rm -f $(O5) - newpkg: clean $(AR) grc http.a - $(AR) grc main.a $(O1): newpkg $(O2): a1 $(O3): a2 $(O4): a3 -$(O5): a4 nuke: clean - rm -f $(GOROOT)/pkg/http.a $(GOROOT)/pkg/main.a + rm -f $(GOROOT)/pkg/http.a -packages: http.a main.a +packages: http.a install: packages cp http.a $(GOROOT)/pkg/http.a - cp main.a $(GOROOT)/pkg/main.a diff --git a/src/lib/math/Makefile b/src/lib/math/Makefile index d5318a60a..0c5d5a1ee 100644 --- a/src/lib/math/Makefile +++ b/src/lib/math/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/net/Makefile b/src/lib/net/Makefile index 1670e5ac3..8910e3aa3 100644 --- a/src/lib/net/Makefile +++ b/src/lib/net/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/os/Makefile b/src/lib/os/Makefile index d359b232e..ad789c8b0 100644 --- a/src/lib/os/Makefile +++ b/src/lib/os/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/reflect/Makefile b/src/lib/reflect/Makefile index 90aadda42..68870a33a 100644 --- a/src/lib/reflect/Makefile +++ b/src/lib/reflect/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/strconv/Makefile b/src/lib/strconv/Makefile index 6718dc3f5..454ef142f 100644 --- a/src/lib/strconv/Makefile +++ b/src/lib/strconv/Makefile @@ -18,6 +18,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go diff --git a/src/lib/syscall/Makefile b/src/lib/syscall/Makefile index a35be213a..d74c0c24e 100644 --- a/src/lib/syscall/Makefile +++ b/src/lib/syscall/Makefile @@ -20,6 +20,10 @@ clean: test: packages gotest +coverage: packages + gotest + 6cov -g `pwd` | grep -v '^test.*\.go:' + %.$O: %.go $(GC) $*.go |