Allow valgrind_check to run in parallel

Summary:
Extend "J=<parallel>" to valgrind_check.
For DBTest, modify the script to run valgrind. For other tests, prefix launch command with valgrind.

Test Plan: Run valgrind_check with J=1 and J>1 and make sure tests run under valgrind. Manually change codes to introduce memory leak and make sure "make watch-log" correctly report it.

Reviewers: yhchiang, yiwu, andrewkr, kradhakrishnan, IslamAbdelRahman

Reviewed By: kradhakrishnan, IslamAbdelRahman

Subscribers: leveldb, andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D56727
main
sdong 9 years ago
parent c9d668c584
commit 3894603fef
  1. 30
      Makefile

@ -522,7 +522,7 @@ $(t_run): Makefile db_test
'#!/bin/sh' \ '#!/bin/sh' \
'd=$(TMPD)/$(@F)' \ 'd=$(TMPD)/$(@F)' \
'mkdir -p $$d' \ 'mkdir -p $$d' \
'TEST_TMPDIR=$$d ./db_test $(filter)' \ 'TEST_TMPDIR=$$d $(DRIVER) ./db_test $(filter)' \
> $@-t > $@-t
$(AM_V_at)chmod a=rx $@-t $(AM_V_at)chmod a=rx $@-t
$(AM_V_at)mv $@-t $@ $(AM_V_at)mv $@-t $@
@ -574,6 +574,23 @@ check_0: $(t_run)
| $(prioritize_long_running_tests) \ | $(prioritize_long_running_tests) \
| grep -E '$(tests-regexp)' \ | grep -E '$(tests-regexp)' \
| parallel -j$(J) --joblog=LOG $$eta --gnu '{} >& t/log-{/}' | parallel -j$(J) --joblog=LOG $$eta --gnu '{} >& t/log-{/}'
.PHONY: valgrind_check_0
valgrind_check_0: $(t_run)
$(AM_V_GEN)export TEST_TMPDIR=$(TMPD); \
printf '%s\n' '' \
'To monitor subtest <duration,pass/fail,name>,' \
' run "make watch-log" in a separate window' ''; \
test -t 1 && eta=--eta || eta=; \
{ \
printf './%s\n' $(filter-out db_test %skiplist_test options_settable_test, $(TESTS)); \
printf '%s\n' $(t_run); \
} \
| $(prioritize_long_running_tests) \
| grep -E '$(tests-regexp)' \
| parallel -j$(J) --joblog=LOG $$eta --gnu \
'if [[ "{}" == "./"* ]] ; then $(DRIVER) {} >& t/valgrind_log-{/}; ' \
'else {} >& t/valgrind_log-{/}; fi'
endif endif
CLEAN_FILES += t LOG $(TMPD) CLEAN_FILES += t LOG $(TMPD)
@ -645,13 +662,22 @@ ubsan_crash_test:
$(MAKE) clean $(MAKE) clean
valgrind_check: $(TESTS) valgrind_check: $(TESTS)
$(AM_V_GEN)if test "$(J)" != 1 \
&& (parallel --gnu --help 2>/dev/null) | \
grep -q 'GNU Parallel'; \
then \
t=$$($(test_names)); \
$(MAKE) T="$$t" TMPD=$(TMPD) \
DRIVER="$(VALGRIND_VER) $(VALGRIND_OPTS)" valgrind_check_0; \
else \
for t in $(filter-out %skiplist_test options_settable_test,$(TESTS)); do \ for t in $(filter-out %skiplist_test options_settable_test,$(TESTS)); do \
$(VALGRIND_VER) $(VALGRIND_OPTS) ./$$t; \ $(VALGRIND_VER) $(VALGRIND_OPTS) ./$$t; \
ret_code=$$?; \ ret_code=$$?; \
if [ $$ret_code -ne 0 ]; then \ if [ $$ret_code -ne 0 ]; then \
exit $$ret_code; \ exit $$ret_code; \
fi; \ fi; \
done done; \
fi
ifneq ($(PAR_TEST),) ifneq ($(PAR_TEST),)

Loading…
Cancel
Save