@@ -12,15 +12,18 @@ MK_CUSTOM_CLEAN:=1
12
12
define HELP
13
13
make setup # install prerequisited (CAUTION: THIS WILL MODIFY YOUR SYSTEM)
14
14
make fetch # download and prepare dependant modules
15
+
15
16
make build # compile and link
17
+ DEBUG=1 # build for debugging
18
+ WHY=1 # explain CMake decisions (into /tmp/cmake.why)
16
19
make clean # remove build artifacts
17
20
ALL=1 # remove entire artifacts directory
18
21
19
22
make test # run tests
20
23
TEST=test # run only test `test` with Redis output
21
24
TEST_ARGS=args # add extra RLTest `args`
22
25
VERBOSE=1 # verbose tests output
23
- COVERAGE=1 # perform coverage analysis
26
+ COV=1 # perform coverage analysis
24
27
25
28
make pack # create installation packages
26
29
PACK_DEPS=0 # do not pack dependencies
@@ -68,19 +71,23 @@ TARGET=$(BINDIR)/redisai.so
68
71
69
72
BACKENDS_PATH ?= $(INSTALL_DIR ) /backends
70
73
74
+ # ----------------------------------------------------------------------------------------------
75
+
71
76
CMAKE_FILES += \
72
77
$(SRCDIR ) /CMakeLists.txt \
73
78
$(SRCDIR ) /src/CMakeLists.txt \
74
79
$(SRCDIR ) /libtorch_c/CMakeLists.txt
75
80
76
- ifeq ($(COVERAGE ) ,1)
77
- WITH_COVERAGE =on
81
+ ifeq ($(COV ) ,1)
82
+ USE_COVERAGE =on
83
+ else
84
+ USE_COVERAGE =off
78
85
endif
79
86
80
87
CMAKE_FLAGS += \
81
88
-DDEPS_PATH=$(abspath $(DEPS_DIR ) ) \
82
89
-DINSTALL_PATH=$(abspath $(INSTALL_DIR ) ) \
83
- -DENABLE_CODECOVERAGE =$(WITH_COVERAGE ) \
90
+ -DUSE_COVERAGE =$(USE_COVERAGE ) \
84
91
-DDEVICE=$(DEVICE )
85
92
86
93
ifeq ($(WITH_TF ) ,0)
@@ -149,6 +156,13 @@ endif
149
156
150
157
# ----------------------------------------------------------------------------------------------
151
158
159
+ define CHECK_REDIS_SERVER
160
+ $(SHOW ) if ! command -v redis-server > /dev/null; then \
161
+ echo "Cannot find redis-server. Aborting." ;\
162
+ exit 1 ;\
163
+ fi
164
+ endef
165
+
152
166
TEST_REPORT_DIR ?= $(PWD )
153
167
ifeq ($(VERBOSE ) ,1)
154
168
TEST_ARGS += -v
@@ -166,30 +180,52 @@ SLAVES ?= 1
166
180
AOF ?= 1
167
181
168
182
TEST_PREFIX =set -e; cd $(ROOT ) /test
183
+
184
+ define TEST_CMD
185
+ DEVICE=$(DEVICE ) PYDEBUG=$(PYDEBUG ) python3 -m RLTest $(TEST_ARGS ) --module $(INSTALL_DIR ) /redisai.so
186
+ endef
187
+
169
188
# TODO: --errors-for-leak-kinds=definite
170
- VALGRIND_OPTIONS="--leak-check =full -q --show-reachable=no --show-possibly-lost=no"
171
- TEST_CMD = DEVICE=$(DEVICE ) PYDEBUG=$(PYDEBUG ) python3 -m RLTest $(TEST_ARGS ) --module $(INSTALL_DIR ) /redisai.so
172
- VALGRIND_TEST_CMD = DEVICE=$(DEVICE ) PYDEBUG=$(PYDEBUG ) python3 -m RLTest $(TEST_ARGS ) --module $(INSTALL_DIR ) /redisai.so --no-output-catch --use-valgrind --vg-no-fail-on-errors --vg-verbose --vg-options $(VALGRIND_OPTIONS ) --vg-suppressions $(realpath $(REDIS_VALGRIND_SUPRESS ) )
189
+ VALGRIND_OPTIONS =\
190
+ -q \
191
+ --leak-check=full \
192
+ --show-reachable=no \
193
+ --show-possibly-lost=no
194
+
195
+ define VALGRIND_TEST_CMD
196
+ $(TEST_CMD ) \
197
+ --no-output-catch \
198
+ --use-valgrind \
199
+ --vg-no-fail-on-errors \
200
+ --vg-verbose
201
+ --vg-options "$(VALGRIND_OPTIONS ) " \
202
+ --vg-suppressions $(realpath $(REDIS_VALGRIND_SUPRESS ) )
203
+ endef
173
204
174
205
test :
206
+ $(CHECK_REDIS_SERVER )
175
207
ifneq ($(NO_LFS ) ,1)
176
208
$(SHOW)if [ "$(git lfs env > /dev/null 2>&1 ; echo $?)" != "0" ]; then cd $(ROOT); git lfs install; fi
177
209
$(SHOW)cd $(ROOT); git lfs pull
178
210
endif
211
+ ifeq ($(COV ) ,1)
212
+ $(COVERAGE_RESET)
213
+ endif
179
214
ifeq ($(GEN ) ,1)
180
215
$(SHOW)$(TEST_PREFIX); $(TEST_CMD)
181
216
endif
182
217
ifeq ($(AOF ) ,1)
183
- $(SHOW)$(TEST_PREFIX); printf "\nTests with --use-aof:\n\n" ;\
184
- $(TEST_CMD) --use-aof
218
+ $(SHOW)$(TEST_PREFIX); printf "\nTests with --use-aof:\n\n" ; $(TEST_CMD) --use-aof
185
219
endif
186
220
ifeq ($(SLAVES ) ,1)
187
- $(SHOW)$(TEST_PREFIX); printf "\nTests with --use-slaves:\n\n" ;\
188
- $(TEST_CMD) --use-slaves
221
+ $(SHOW)$(TEST_PREFIX); printf "\nTests with --use-slaves:\n\n" ; $(TEST_CMD) --use-slaves
189
222
endif
190
- ifeq ($(VALGRIND ) ,1)
191
- $(SHOW)$(TEST_PREFIX); printf "\nTests with valgrind:\n\n" ;\
192
- $(VALGRIND_TEST_CMD)
223
+ # ifeq ($(VALGRIND),1)
224
+ # $(SHOW)$(TEST_PREFIX); printf "\nTests with valgrind:\n\n" ;\
225
+ # $(VALGRIND_TEST_CMD)
226
+ # endif
227
+ ifeq ($(COV ) ,1)
228
+ $(COVERAGE_COLLECT_REPORT)
193
229
endif
194
230
195
231
# ----------------------------------------------------------------------------------------------
0 commit comments