aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-05-17 05:57:17 +0700
committerShulhan <ms@kilabit.info>2018-05-17 05:57:17 +0700
commitb6e72ab41aa1ab207cb255d38158271634e558ae (patch)
treedd10d2b3044990f99d6d310cd5370d65e07c6fee
parent7dfb98090b2256d87c34eb842ff669724694ecde (diff)
downloadbeku-b6e72ab41aa1ab207cb255d38158271634e558ae.tar.xz
make: add task to run test with cpu and memory profiling
-rw-r--r--.gitignore3
-rw-r--r--Makefile12
2 files changed, 12 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 2ad3c05..60e18ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
+/beku.test
/cover.html
/cover.out
+/cpu.prof
+/mem.prof
diff --git a/Makefile b/Makefile
index 18b1f80..d6894fc 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,13 @@
SRC:=$(shell go list -f '{{$$d:=.Dir}} {{ range .GoFiles }}{{$$d}}/{{.}} {{end}}' ./...)
SRC_TEST:=$(shell go list -f '{{$$d:=.Dir}} {{ range .TestGoFiles }}{{$$d}}/{{.}} {{end}}' ./...)
-COVER_OUT=cover.out
-COVER_HTML=cover.html
+COVER_OUT:=cover.out
+COVER_HTML:=cover.html
+CPU_PROF:=cpu.prof
+MEM_PROF:=mem.prof
-.PHONY: all install test coverbrowse lint
+.PHONY: all install lint
+.PHONE: test test.prof coverbrowse
all: install
@@ -17,6 +20,9 @@ install: test
test: $(COVER_HTML)
+test.prof:
+ go test -cpuprofile $(CPU_PROF) -memprofile $(MEM_PROF) .
+
$(COVER_HTML): $(COVER_OUT)
go tool cover -html=$< -o $@