]> Cypherpunks repositories - gostls13.git/commitdiff
gobuild: add coverage rule, ignore files in package main.
authorRuss Cox <rsc@golang.org>
Wed, 19 Nov 2008 20:52:30 +0000 (12:52 -0800)
committerRuss Cox <rsc@golang.org>
Wed, 19 Nov 2008 20:52:30 +0000 (12:52 -0800)
R=r
DELTA=55  (41 added, 11 deleted, 3 changed)
OCL=19594
CL=19598

src/cmd/gobuild/gobuild.c
src/lib/fmt/Makefile
src/lib/http/Makefile
src/lib/math/Makefile
src/lib/net/Makefile
src/lib/os/Makefile
src/lib/reflect/Makefile
src/lib/strconv/Makefile
src/lib/syscall/Makefile

index f0ba6f67190580ed3dabaf13a6725df2240bc946..1056d883adf820c6dead6956ccce6bf0dadb9d35 100644 (file)
@@ -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++;
        }
 
index bdef02d698b97a12acce209762fa431d5cf368cc..39406223525709932a0b772d98701b09f62f26df 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index 0827008f97acb651c24eb66ad53ce7e2fa9ab319..57b06192e0dd378dbffbd3939bb38158809740ed 100644 (file)
@@ -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
 
index d5318a60a57c7cecdb5ab38f74f914974f121a45..0c5d5a1ee56ab82964cc4b6b0b709e8d95d71e76 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index 1670e5ac305dea3164e0ffb36d16005fa8c7df05..8910e3aa39788128d85829a71c630298602f7867 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index d359b232e039cff2efb6ca9d4213e2c7da3eb646..ad789c8b0aeda30b92d80ff07c15024d4ae34e3a 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index 90aadda42f14fe1c5767e4d86b2565d2f1225fe4..68870a33a6ed23de43b066bdfbed1f9a299c135c 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index 6718dc3f5929f0a72132e4d2fe6ba3104eb7d4b3..454ef142fd33b1eb99f040a45a47ff59b0e4dddf 100644 (file)
@@ -18,6 +18,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go
 
index a35be213a313a698f3514175faa9958be201bab3..d74c0c24e4f26bff88e0079f1d6d017732b9775b 100644 (file)
@@ -20,6 +20,10 @@ clean:
 test: packages
        gotest
 
+coverage: packages
+       gotest
+       6cov -g `pwd` | grep -v '^test.*\.go:'
+
 %.$O: %.go
        $(GC) $*.go