mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-05-03 23:27:33 +02:00
tools: add valgrind option to test-runner
Can now pass -V, --valgrind to test-runner to run valgrind on iwd during autotests. Note: the verbose option for iwd must also be passed in order to see output (-v iwd).
This commit is contained in:
parent
f3cc96499c
commit
bcf9ec5922
@ -73,6 +73,7 @@ static char **test_argv;
|
|||||||
static int test_argc;
|
static int test_argc;
|
||||||
static char **verbose_apps;
|
static char **verbose_apps;
|
||||||
static char *verbose_opt;
|
static char *verbose_opt;
|
||||||
|
static bool valgrind;
|
||||||
static bool enable_debug;
|
static bool enable_debug;
|
||||||
const char *debug_filter;
|
const char *debug_filter;
|
||||||
static const char *qemu_binary;
|
static const char *qemu_binary;
|
||||||
@ -377,14 +378,15 @@ static void start_qemu(void)
|
|||||||
"mac80211_hwsim.radios=0 init=%s TESTHOME=%s "
|
"mac80211_hwsim.radios=0 init=%s TESTHOME=%s "
|
||||||
"TESTVERBOUT=\'%s\' DEBUG_FILTER=\'%s\'"
|
"TESTVERBOUT=\'%s\' DEBUG_FILTER=\'%s\'"
|
||||||
"TEST_ACTION=%u TEST_ACTION_PARAMS=\'%s\' "
|
"TEST_ACTION=%u TEST_ACTION_PARAMS=\'%s\' "
|
||||||
"TESTARGS=\'%s\' PATH=\'%s\'",
|
"TESTARGS=\'%s\' PATH=\'%s\' VALGRIND=%u",
|
||||||
check_verbosity("kernel") ? "ignore_loglevel" : "quiet",
|
check_verbosity("kernel") ? "ignore_loglevel" : "quiet",
|
||||||
initcmd, cwd, verbose_opt ? verbose_opt : "none",
|
initcmd, cwd, verbose_opt ? verbose_opt : "none",
|
||||||
enable_debug ? debug_filter : "",
|
enable_debug ? debug_filter : "",
|
||||||
test_action,
|
test_action,
|
||||||
test_action_params ? test_action_params : "",
|
test_action_params ? test_action_params : "",
|
||||||
testargs,
|
testargs,
|
||||||
getenv("PATH"));
|
getenv("PATH"),
|
||||||
|
valgrind);
|
||||||
|
|
||||||
argv = alloca(sizeof(qemu_argv) + sizeof(char *) * 7);
|
argv = alloca(sizeof(qemu_argv) + sizeof(char *) * 7);
|
||||||
memcpy(argv, qemu_argv, sizeof(qemu_argv));
|
memcpy(argv, qemu_argv, sizeof(qemu_argv));
|
||||||
@ -1205,11 +1207,16 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings,
|
|||||||
static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list,
|
static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list,
|
||||||
const char *ext_options)
|
const char *ext_options)
|
||||||
{
|
{
|
||||||
char *argv[7];
|
char *argv[9];
|
||||||
char *iwd_phys = NULL;
|
char *iwd_phys = NULL;
|
||||||
pid_t ret;
|
pid_t ret;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
if (valgrind) {
|
||||||
|
argv[idx++] = "valgrind";
|
||||||
|
argv[idx++] = "--leak-check=full";
|
||||||
|
}
|
||||||
|
|
||||||
argv[idx++] = BIN_IWD;
|
argv[idx++] = BIN_IWD;
|
||||||
argv[idx++] = "-c";
|
argv[idx++] = "-c";
|
||||||
argv[idx++] = (char *) config_dir;
|
argv[idx++] = (char *) config_dir;
|
||||||
@ -2029,6 +2036,21 @@ static void run_tests(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr = strstr(cmdline, "VALGRIND=");
|
||||||
|
|
||||||
|
if (ptr) {
|
||||||
|
test_action_str = ptr + 9;
|
||||||
|
ptr += 1;
|
||||||
|
*ptr = '\0';
|
||||||
|
|
||||||
|
valgrind = (bool) atoi(test_action_str);
|
||||||
|
|
||||||
|
if (valgrind != true && valgrind != false) {
|
||||||
|
l_error("malformed valgrind option");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ptr = strstr(cmdline, "PATH=");
|
ptr = strstr(cmdline, "PATH=");
|
||||||
|
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
@ -2166,7 +2188,11 @@ static void usage(void)
|
|||||||
"\t-v, --verbose <apps> Comma separated list of "
|
"\t-v, --verbose <apps> Comma separated list of "
|
||||||
"applications to enable\n"
|
"applications to enable\n"
|
||||||
"\t\t\t\tverbose output\n"
|
"\t\t\t\tverbose output\n"
|
||||||
"\t-h, --help Show help options\n");
|
"\t-h, --help Show help options\n"
|
||||||
|
"\t-V, --valgrind Run valgrind on iwd. Note: \"-v"
|
||||||
|
" iwd\" is required\n"
|
||||||
|
"\t\t\t\tto see valgrind"
|
||||||
|
" output");
|
||||||
l_info("Commands:\n"
|
l_info("Commands:\n"
|
||||||
"\t-A, --auto-tests <dirs> Comma separated list of the "
|
"\t-A, --auto-tests <dirs> Comma separated list of the "
|
||||||
"test configuration\n\t\t\t\t"
|
"test configuration\n\t\t\t\t"
|
||||||
@ -2182,6 +2208,7 @@ static const struct option main_options[] = {
|
|||||||
{ "kernel", required_argument, NULL, 'k' },
|
{ "kernel", required_argument, NULL, 'k' },
|
||||||
{ "verbose", required_argument, NULL, 'v' },
|
{ "verbose", required_argument, NULL, 'v' },
|
||||||
{ "debug", optional_argument, NULL, 'd' },
|
{ "debug", optional_argument, NULL, 'd' },
|
||||||
|
{ "valgrind", no_argument, NULL, 'V' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -2207,7 +2234,7 @@ int main(int argc, char *argv[])
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
opt = getopt_long(argc, argv, "A:U:q:k:v:dh", main_options,
|
opt = getopt_long(argc, argv, "A:U:q:k:v:Vdh", main_options,
|
||||||
NULL);
|
NULL);
|
||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
@ -2243,6 +2270,9 @@ int main(int argc, char *argv[])
|
|||||||
verbose_opt = optarg;
|
verbose_opt = optarg;
|
||||||
verbose_apps = l_strsplit(verbose_opt, ',');
|
verbose_apps = l_strsplit(verbose_opt, ',');
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
valgrind = true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user