All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test-runner: refactor/fix valgrind logging issue
@ 2019-11-05 23:22 James Prestwood
  2019-11-06 21:16 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2019-11-05 23:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

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.
---
 tools/test-runner.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 5ef9552e..a83e1252 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -564,7 +564,7 @@ static pid_t execute_program(char *argv[], char *envp[], bool wait,
 		int fd = -1;
 		L_AUTO_FREE_VAR(char *, log_file) = NULL;
 
-		verbose = check_verbosity(argv[0]);
+		verbose = check_verbosity(log_name);
 
 		/* No stdout and no logging */
 		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;
 
 	if (valgrind) {
+		L_AUTO_FREE_VAR(char *, valgrind_log);
 		int fd;
 
 		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
 		 */
-		if (log) {
-			L_AUTO_FREE_VAR(char *, valgrind_log);
-
+		if (log)
 			valgrind_log = l_strdup_printf("%s/%s/valgrind.log",
 							log_dir, test_name);
-			fd = open(valgrind_log, O_WRONLY | O_CREAT | O_APPEND,
+		else
+			valgrind_log = l_strdup("/tmp/valgrind.log");
+
+		fd = open(valgrind_log, O_WRONLY | O_CREAT | O_APPEND,
 					S_IRUSR | S_IWUSR);
 
+		if (log) {
 			if (fchown(fd, log_uid, log_gid) < 0)
 				l_error("chown failed");
+		}
 
-			fd_option = l_strdup_printf("--log-fd=%d", fd);
-			argv[idx++] = fd_option;
-		} else
-			argv[idx++] = "--log-file=/tmp/valgrind.log";
+		fd_option = l_strdup_printf("--log-fd=%d", fd);
+		argv[idx++] = fd_option;
 	}
 
 	if (strcmp(gdb_opt, "iwd") == 0) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test-runner: refactor/fix valgrind logging issue
  2019-11-05 23:22 [PATCH] test-runner: refactor/fix valgrind logging issue James Prestwood
@ 2019-11-06 21:16 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2019-11-06 21:16 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Hi James,

On 11/5/19 5:22 PM, James Prestwood wrote:
> 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.
> ---
>   tools/test-runner.c | 20 +++++++++++---------
>   1 file changed, 11 insertions(+), 9 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-06 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 23:22 [PATCH] test-runner: refactor/fix valgrind logging issue James Prestwood
2019-11-06 21:16 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.