-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
111 lines (81 loc) · 2.71 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
ROOT:=$(shell pwd)
#----------------------------------------------------------------------------------------------
ifeq ($(DEBUG),1)
CONFIG_ARGS += --enable-debug
endif
all: build
export BUILD_DIR ?= build
apply_hiredis_patch:
@set -e ;\
cd src/dep/rmr/hiredis ;\
if [ ! -e applied_hiredis_patch ]; then \
echo "Apply hiredis patch..." ;\
git apply $(ROOT)/hiredis_patch && \
touch applied_hiredis_patch ;\
fi
configure: apply_hiredis_patch
mkdir -p $(BUILD_DIR)
set -e; cd $(BUILD_DIR); $(ROOT)/configure.py -j8 $(CONFIG_ARGS)
ifeq ($(wildcard $(BUILD_DIR)/Makefile),)
build: configure
else
build:
endif
$(MAKE) -C $(BUILD_DIR)
.PHONY: build apply_hiredis_patch
clean:
$(MAKE) -C src clean
.PHONY: clean
deepclean:
$(MAKE) -C src deepclean
#----------------------------------------------------------------------------------------------
test: build
$(MAKE) -C test
$(MAKE) -C src/dep/rmr/test test
$(MAKE) -C src/dep/RediSearch/src REDIS_MODULE_PATH=src/dep/RediSearch/src/redisearch.so redisearch.so test
$(MAKE) -C src module-oss.so
PYTHON ?= python2
_PYTEST_ARGS=\
-t ./src/dep/RediSearch/src/pytest/$(TEST) \
--env oss-cluster --env-reuse \
--clear-logs \
--module $(abspath $(BUILD_DIR)/module-oss.so) --module-args "$(strip PARTITIONS AUTO $(MODULE_ARGS))" \
$(PYTEST_ARGS)
ifeq ($(GDB),1)
_PYTEST_ARGS += -s --shards-count 1 --debugger gdb
else
_PYTEST_ARGS += --shards-count 3
ifneq ($(TEST),)
_PYTEST_ARGS += -s
endif
endif
pytest:
$(PYTHON) -m RLTest $(_PYTEST_ARGS)
#----------------------------------------------------------------------------------------------
BRANCH:=$(shell git branch | awk '/\*/{print $$2}')
docker:
docker build . -t rscoordinator
docker_test: docker
docker run -it --rm -v ~/.s3cfg:/root/.s3cfg -v `pwd`:/workspace rscoordinator make deepclean build test
# Create a package from the current branch and upload it to s3
docker_package: docker
docker run -e BRANCH=$(BRANCH) -it --rm -v ~/.s3cfg:/root/.s3cfg -v `pwd`:/workspace rscoordinator
# RELEASES ONLY: Create the "latest" package and a package for the current version, and upload them to s3
docker_release: docker
docker run -it --rm -v ~/.s3cfg:/root/.s3cfg -v -v `pwd`:/workspace rscoordinator make deepclean all test package_release upload
#----------------------------------------------------------------------------------------------
# Benchmark utility
ifneq ($(REMOTE),)
BENCHMARK_ARGS = run-remote
else
BENCHMARK_ARGS = run-local
endif
BENCHMARK_ARGS += --module_path $(abspath $(BUILD_DIR)/module-oss.so) \
--required-module search
ifneq ($(BENCHMARK),)
BENCHMARK_ARGS += --test $(BENCHMARK)
endif
bench benchmark: $(TARGET)
cd ./tests/benchmarks ;\
redisbench-admin $(BENCHMARK_ARGS)
.PHONY: bench benchmark