mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
test-runner: refactor/fix valgrind logging issue
After the logging changes verbose IWD with valgrind did not show any IWD output. This commit fixes this by checking the verbosity against log_name rather than argv[0] since log_name has a special case for valgrind/iwd. The valgrind logic in start_iwd was refactored to only use the --log-fd option rather than using --log-file in addition to --log-fd.
This commit is contained in:
parent
c6f9e89748
commit
8ec4a53adb
@ -564,7 +564,7 @@ static pid_t execute_program(char *argv[], char *envp[], bool wait,
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
L_AUTO_FREE_VAR(char *, log_file) = NULL;
|
L_AUTO_FREE_VAR(char *, log_file) = NULL;
|
||||||
|
|
||||||
verbose = check_verbosity(argv[0]);
|
verbose = check_verbosity(log_name);
|
||||||
|
|
||||||
/* No stdout and no logging */
|
/* No stdout and no logging */
|
||||||
if (!verbose && !log)
|
if (!verbose && !log)
|
||||||
@ -1493,6 +1493,7 @@ static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list,
|
|||||||
L_AUTO_FREE_VAR(char *, fd_option) = NULL;
|
L_AUTO_FREE_VAR(char *, fd_option) = NULL;
|
||||||
|
|
||||||
if (valgrind) {
|
if (valgrind) {
|
||||||
|
L_AUTO_FREE_VAR(char *, valgrind_log);
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
argv[idx++] = "valgrind";
|
argv[idx++] = "valgrind";
|
||||||
@ -1501,21 +1502,22 @@ static pid_t start_iwd(const char *config_dir, struct l_queue *wiphy_list,
|
|||||||
/*
|
/*
|
||||||
* Valgrind needs --log-fd if we want both stderr and stdout
|
* Valgrind needs --log-fd if we want both stderr and stdout
|
||||||
*/
|
*/
|
||||||
if (log) {
|
if (log)
|
||||||
L_AUTO_FREE_VAR(char *, valgrind_log);
|
|
||||||
|
|
||||||
valgrind_log = l_strdup_printf("%s/%s/valgrind.log",
|
valgrind_log = l_strdup_printf("%s/%s/valgrind.log",
|
||||||
log_dir, test_name);
|
log_dir, test_name);
|
||||||
|
else
|
||||||
|
valgrind_log = l_strdup("/tmp/valgrind.log");
|
||||||
|
|
||||||
fd = open(valgrind_log, O_WRONLY | O_CREAT | O_APPEND,
|
fd = open(valgrind_log, O_WRONLY | O_CREAT | O_APPEND,
|
||||||
S_IRUSR | S_IWUSR);
|
S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
|
if (log) {
|
||||||
if (fchown(fd, log_uid, log_gid) < 0)
|
if (fchown(fd, log_uid, log_gid) < 0)
|
||||||
l_error("chown failed");
|
l_error("chown failed");
|
||||||
|
}
|
||||||
|
|
||||||
fd_option = l_strdup_printf("--log-fd=%d", fd);
|
fd_option = l_strdup_printf("--log-fd=%d", fd);
|
||||||
argv[idx++] = fd_option;
|
argv[idx++] = fd_option;
|
||||||
} else
|
|
||||||
argv[idx++] = "--log-file=/tmp/valgrind.log";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(gdb_opt, "iwd") == 0) {
|
if (strcmp(gdb_opt, "iwd") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user