From b774852ae6442eb50ca6e098d19d486cbcc82a12 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sun, 19 Jun 2016 15:02:51 +0000 Subject: tests: fix memory leak in test-keymap-util Fixes: ==27917== 3 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==27917== at 0x4C28BF6: malloc (vg_replace_malloc.c:299) ==27917== by 0x55083D9: strdup (in /usr/lib64/libc-2.22.so) ==27917== by 0x1140DA: find_converted_keymap (keymap-util.c:524) ==27917== by 0x110844: test_find_converted_keymap (test-keymap-util.c:52) ==27917== by 0x1124FE: main (test-keymap-util.c:213) ==27917== --- src/locale/test-keymap-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/locale/test-keymap-util.c b/src/locale/test-keymap-util.c index 7e2c9e505a..2adda3da2b 100644 --- a/src/locale/test-keymap-util.c +++ b/src/locale/test-keymap-util.c @@ -58,8 +58,8 @@ static void test_find_converted_keymap(void) { assert_se(r == 1); assert_se(streq(ans, "pl")); - assert_se(find_converted_keymap("pl", "dvorak", &ans) == 1); - assert_se(streq(ans, "pl-dvorak")); + assert_se(find_converted_keymap("pl", "dvorak", &ans2) == 1); + assert_se(streq(ans2, "pl-dvorak")); } static void test_find_legacy_keymap(void) { -- cgit v1.2.3-54-g00ecf From b3d69149bd03b1b42ded4661bfd799778844e4c1 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sun, 19 Jun 2016 23:43:35 +0000 Subject: tests: don't run test_get_process_cmdline_harder under valgrind See https://github.com/systemd/systemd/pull/3555#issuecomment-226564908 --- src/test/test-process-util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index af2c9282d4..99c92780b8 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -26,6 +26,9 @@ #include #include #include +#ifdef HAVE_VALGRIND_VALGRIND_H +#include +#endif #include "alloc-util.h" #include "architecture.h" @@ -164,6 +167,14 @@ static void test_get_process_cmdline_harder(void) { if (geteuid() != 0) return; +#ifdef HAVE_VALGRIND_VALGRIND_H + /* valgrind patches open(/proc//cmdline) + * so, test_get_process_cmdline_harder fails always + * See https://github.com/systemd/systemd/pull/3555#issuecomment-226564908 */ + if (RUNNING_ON_VALGRIND) + return; +#endif + pid = fork(); if (pid > 0) { siginfo_t si; -- cgit v1.2.3-54-g00ecf