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.
This commit is contained in:
James Prestwood 2019-01-17 15:11:09 -08:00 committed by Denis Kenzior
parent 1927e40fd0
commit 8956451b26
2 changed files with 7 additions and 1 deletions

View File

@ -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')

View File

@ -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);