-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (75 loc) · 2.92 KB
/
Copy pathMakefile
File metadata and controls
95 lines (75 loc) · 2.92 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: test test-race cover cover-html lint lint-fix bench fuzz vet build clean testdata testdata-bench site-testdata site-benchdata snapshot
build:
@mkdir -p bin
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozainfo ./ozainfo/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozacat ./ozacat/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozaserve ./ozaserve/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozasearch ./ozasearch/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozaverify ./ozaverify/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozamcp ./ozamcp/
cd cmd && CGO_ENABLED=0 go build -o ../bin/ozacmp ./ozacmp/
cd cmd && CGO_ENABLED=0 go build -o ../bin/zim2oza ./zim2oza/
cd cmd && CGO_ENABLED=0 go build -o ../bin/epub2oza ./epub2oza/
cd cmd && CGO_ENABLED=0 go build -o ../bin/site2oza ./site2oza/
test:
go test ./... -count=1
cd cmd && go test ./... -count=1
test-race:
go test -race ./... -count=1
cd cmd && go test -race ./... -count=1
cover:
go test -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
cover-html: cover
go tool cover -html=coverage.out
bench:
go test -bench=. -benchmem -count=5 ./oza/ ./ozawrite/
fuzz:
go test -fuzz=FuzzParseHeader -fuzztime=30s ./oza/
go test -fuzz=FuzzParseVarEntryRecord -fuzztime=30s ./oza/
go test -fuzz=FuzzParseSectionDesc -fuzztime=30s ./oza/
go test -fuzz=FuzzParseMIMETable -fuzztime=30s ./oza/
go test -fuzz=FuzzParseMetadata -fuzztime=30s ./oza/
go test -fuzz=FuzzParseTrigramIndex -fuzztime=30s ./oza/
go test -fuzz=FuzzDecodePostingList -fuzztime=30s ./oza/
go test -fuzz=FuzzParseIndex -fuzztime=30s ./oza/
go test -fuzz=FuzzTrigramBuilder -fuzztime=30s ./ozawrite/
go test -fuzz=FuzzStringTableSerialize -fuzztime=30s ./ozawrite/
go test -fuzz=FuzzWriterRoundTrip -fuzztime=30s ./ozawrite/
lint:
golangci-lint run ./...
cd cmd && golangci-lint run ./...
lint-fix:
golangci-lint run --fix ./...
cd cmd && golangci-lint run --fix ./...
vet:
go vet ./...
cd cmd && go vet ./...
testdata: testdata/.stamp-tier1
testdata/.stamp-tier1:
@mkdir -p testdata
bash scripts/fetch-testdata.sh
@touch $@
testdata-bench: testdata
@mkdir -p testdata/bench
bash scripts/fetch-bench.sh
site-testdata:
bash scripts/fetch-site-testdata.sh
site-benchdata: site-testdata
bash scripts/fetch-site-benchdata.sh
bench-convert: build testdata
@echo "Converting small.zim to OZA..."
time ./bin/zim2oza --verbose testdata/small.zim /tmp/bench_output.oza
./bin/ozaverify --all /tmp/bench_output.oza
./bin/ozainfo /tmp/bench_output.oza
ZIM ?= $(error ZIM is not set. Usage: make bench-convert-large ZIM=/path/to/file.zim)
OZA_OUT ?= /tmp/bench_large.oza
bench-convert-large: build
@echo "Converting $(ZIM) to OZA..."
time ./bin/zim2oza --verbose "$(ZIM)" "$(OZA_OUT)"
./bin/ozaverify --all --quiet "$(OZA_OUT)"
./bin/ozainfo "$(OZA_OUT)"
snapshot:
goreleaser release --snapshot --clean
clean:
rm -rf bin/