forked from gyuho/linux-inspect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (59 loc) · 1.97 KB
/
Makefile
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
67
68
# Example:
# make gen
# make build
# GO_VERSION=1.9.2 make build-docker-test
# make build-docker-test
# make compile-with-docker-test
# make test
# make docker-test
.PHONY: gen
gen:
go install -v ./cmd/generate-df && generate-df
go install -v ./cmd/generate-etc && generate-etc
go install -v ./cmd/generate-proc && generate-proc
go install -v ./cmd/generate-top && generate-top
.PHONY: build
build:
go build -o ./bin/linux-inspect -v ./cmd/linux-inspect
./bin/linux-inspect -h
clean:
rm -f ./*.log
rm -f ./.Dockerfile
_GO_VERSION = 1.9.2
ifdef GO_VERSION
_GO_VERSION = $(GO_VERSION)
endif
build-docker-test:
$(info GO_VERSION: $(_GO_VERSION))
@cat ./Dockerfile | sed s/REPLACE_ME_GO_VERSION/$(_GO_VERSION)/ \
> ./.Dockerfile
docker build \
--tag gyuho/linux-inspect:go$(_GO_VERSION) \
--file ./.Dockerfile .
compile-with-docker-test:
$(info GO_VERSION: $(_GO_VERSION))
docker run \
--rm \
--volume=`pwd`/:/go/src/github.com/gyuho/linux-inspect \
gyuho/linux-inspect:go$(_GO_VERSION) \
/bin/bash -c "cd /go/src/github.com/gyuho/linux-inspect && \
go build -o ./bin/linux-inspect -v ./cmd/linux-inspect && \
./bin/linux-inspect -h"
TEST_SUFFIX = $(shell date +%s | base64 | head -c 15)
.PHONY: test
test:
$(info GO_VERSION: $(_GO_VERSION))
$(info log-file: test-$(TEST_SUFFIX).log)
$(_TEST_OPTS) ./tests.sh 2>&1 | tee test-$(TEST_SUFFIX).log
! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log
docker-test:
$(info GO_VERSION: $(_GO_VERSION))
$(info log-file: test-$(TEST_SUFFIX).log)
docker run \
--rm \
--volume=`pwd`/:/go/src/github.com/gyuho/linux-inspect \
gyuho/linux-inspect:go$(_GO_VERSION) \
/bin/bash -c "cd /go/src/github.com/gyuho/linux-inspect && \
go build -o ./bin/linux-inspect -v ./cmd/linux-inspect && \
./tests.sh 2>&1 | tee test-$(TEST_SUFFIX).log"
! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log