Skip to content

Commit f858dd9

Browse files
committed
clib test: Only fail with definite memory leak
Due to valgrind false alarm on tokio memory leak tokio-rs/tokio#6889 , this patch change the valgrind to only fail the test only when found definite memory leak. Signed-off-by: Gris Ge <[email protected]>
1 parent d9aa548 commit f858dd9

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

Makefile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ SPEC_FILE=packaging/nmstate.spec
4343
RPM_DATA=$(shell date +"%a %b %d %Y")
4444
RUST_SOURCES := $(shell find rust/ -name "*.rs" -print)
4545

46+
# Due to tokio bug https://github.com/tokio-rs/tokio/issues/6889
47+
# We only check for definite memory leak
48+
define VALGRIND_OPTS
49+
--errors-for-leak-kinds=definite --trace-children=yes \
50+
--leak-check=full --error-exitcode=1
51+
endef
52+
53+
4654
#outdir is used by COPR as well: https://docs.pagure.org/copr.copr/user_documentation.html
4755
outdir ?= $(ROOT_DIR)
4856

@@ -209,28 +217,22 @@ clib_check: $(CLIB_SO_DEV_DEBUG) $(CLIB_HEADER)
209217
-o $(TMPDIR)/nmstate_fmt_test \
210218
rust/src/clib/test/nmstate_fmt_test.c -lnmstate
211219
LD_LIBRARY_PATH=$(TMPDIR) \
212-
valgrind --trace-children=yes --leak-check=full \
213-
--error-exitcode=1 \
220+
valgrind $(VALGRIND_OPTS) \
214221
$(TMPDIR)/nmstate_json_test 1>/dev/null
215222
LD_LIBRARY_PATH=$(TMPDIR) \
216-
valgrind --trace-children=yes --leak-check=full \
217-
--error-exitcode=1 \
223+
valgrind $(VALGRIND_OPTS) \
218224
$(TMPDIR)/nmpolicy_json_test 1>/dev/null
219225
LD_LIBRARY_PATH=$(TMPDIR) \
220-
valgrind --trace-children=yes --leak-check=full \
221-
--error-exitcode=1 \
226+
valgrind $(VALGRIND_OPTS) \
222227
$(TMPDIR)/nmstate_yaml_test 1>/dev/null
223228
LD_LIBRARY_PATH=$(TMPDIR) \
224-
valgrind --trace-children=yes --leak-check=full \
225-
--error-exitcode=1 \
229+
valgrind $(VALGRIND_OPTS) \
226230
$(TMPDIR)/nmpolicy_yaml_test 1>/dev/null
227231
LD_LIBRARY_PATH=$(TMPDIR) \
228-
valgrind --trace-children=yes --leak-check=full \
229-
--error-exitcode=1 \
232+
valgrind $(VALGRIND_OPTS) \
230233
$(TMPDIR)/nmstate_gen_diff_test 1>/dev/null
231234
LD_LIBRARY_PATH=$(TMPDIR) \
232-
valgrind --trace-children=yes --leak-check=full \
233-
--error-exitcode=1 \
235+
valgrind $(VALGRIND_OPTS) \
234236
$(TMPDIR)/nmstate_fmt_test 1>/dev/null
235237
rm -rf $(TMPDIR)
236238

0 commit comments

Comments
 (0)