From 8956451b261e29a0a846834050ded06e9f49af4e Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 17 Jan 2019 15:11:09 -0800 Subject: [PATCH] test-runner: decouple --verbose with --valgrind When using --valgrind, you must also use --verbose iwd, and, depending on the tests you may also need to include pytests in the verbose flag. Since anyone using --valgrind definitely wants to see valgrind info printed they should not need to enable verbose printing. Also, manually parsing valgrind prints with IWD prints mixed throughout is a nightmare even for a single test. This patch uses valgrind's --log-file flag, which is directed to /tmp/valgrind.log. After the tests runs we can print out this file. --- autotests/util/iwd.py | 1 + tools/test-runner.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 9c15e78b..8a9954f0 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -851,6 +851,7 @@ class IWD(AsyncOpAbstract): if os.environ.get('IWD_TEST_VALGRIND', None) == 'on': args.append('valgrind') args.append('--leak-check=full') + args.append('--log-file=/tmp/valgrind.log') args.append('iwd') args.append('-c') diff --git a/tools/test-runner.c b/tools/test-runner.c index 415841c5..6d3e4574 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -1257,7 +1257,7 @@ done: static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list, const char *ext_options) { - char *argv[12]; + char *argv[13]; char *iwd_phys = NULL; pid_t ret; int idx = 0; @@ -1265,6 +1265,7 @@ static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list, if (valgrind) { argv[idx++] = "valgrind"; argv[idx++] = "--leak-check=full"; + argv[idx++] = "--log-file=/tmp/valgrind.log"; } if (strcmp(gdb_opt, "iwd") == 0) { @@ -1841,6 +1842,10 @@ static void create_network_and_run_tests(const void *key, void *value, if (iwd_pid > 0) terminate_iwd(iwd_pid); + if (valgrind) + if (system("cat /tmp/valgrind.log")) + l_info("cat /tmp/valgrind.log failed"); + if (ofono_req) { loopback_started = false; stop_ofono(ofono_pid);