File: Makefile

package info (click to toggle)
golang-gopkg-lxc-go-lxc.v2 0.0+git20190625.f4822c6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 404 kB
  • sloc: ansic: 500; makefile: 81
file content (66 lines) | stat: -rw-r--r-- 1,990 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
NO_COLOR=\033[0m
OK_COLOR=\033[0;32m

all: format vet lint

format:
	@echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
	@gofmt -s -w *.go
	@goimports -w *.go || true

test-privileged:
	@echo "$(OK_COLOR)==> Running tests for privileged user $(NO_COLOR)"
	@sudo `which go` test -v -coverprofile=/tmp/priv.out
	@sudo `which go` test -tags static_build -v -coverprofile=/tmp/priv.out

test-privileged-race:
	@echo "$(OK_COLOR)==> Running tests with -race flag for privileged user $(NO_COLOR)"
	@sudo `which go` test -race -v
	@sudo `which go` test -tags static_build -race -v

test:
	@echo "$(OK_COLOR)==> Running tests for unprivileged user $(NO_COLOR)"
	@`which go` test -v -coverprofile=/tmp/unpriv.out
	@`which go` test -tags static_build -v -coverprofile=/tmp/unpriv.out

test-race:
	@echo "$(OK_COLOR)==> Running tests with -race flag for unprivileged user $(NO_COLOR)"
	@`which go` test -race -v
	@`which go` test -tags static_build -race -v

cover:
	@echo "$(OK_COLOR)==> Running cover for privileged user $(NO_COLOR)"
	@`which go` tool cover -func=/tmp/priv.out || true
	@echo "$(OK_COLOR)==> Running cover for unprivileged user $(NO_COLOR)"
	@`which go` tool cover -func=/tmp/unpriv.out || true

doc:
	@`which godoc` gopkg.in/lxc/go-lxc.v2 | less

vet:
	@echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
	@`which go` vet .

lint:
	@echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
	@`which golint` . || true

escape-analysis:
	@`which go` build -gcflags -m

ctags:
	@ctags -R --languages=c,go

scope:
	@echo "$(OK_COLOR)==> Exported container calls in container.go $(NO_COLOR)"
	@/bin/grep -E "\bc+\.([A-Z])\w+" container.go || true

setup-test-cgroup:
	for d in /sys/fs/cgroup/*; do \
	    [ -f $$d/cgroup.clone_children ] && echo 1 | sudo tee $$d/cgroup.clone_children; \
	    [ -f $$d/cgroup.use_hierarchy ] && echo 1 | sudo tee $$d/cgroup.use_hierarchy; \
	    sudo mkdir -p $$d/lxc; \
	    sudo chown -R $$USER: $$d/lxc; \
	done

.PHONY: all format test doc vet lint ctags