summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2016-06-20 08:41:06 +0100
committerGitHub <noreply@github.com>2016-06-20 08:41:06 +0100
commitfbd9ec188ad19817729d08c1d9f91f2318ab626c (patch)
tree47f15c3f6236258e3754b3b0adc894ebfd6ec5f9
parentff74d2058152d0a9ed82346c16ec30b6694cbfa5 (diff)
parentb3d69149bd03b1b42ded4661bfd799778844e4c1 (diff)
Merge pull request #3564 from evverx/valgrind-tests-fixes
tests: fix memory leak, don't run test_get_process_cmdline_harder under valgrind
-rw-r--r--src/locale/test-keymap-util.c4
-rw-r--r--src/test/test-process-util.c11
2 files changed, 13 insertions, 2 deletions
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) {
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 <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#ifdef HAVE_VALGRIND_VALGRIND_H
+#include <valgrind/valgrind.h>
+#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;