All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] test-runner: run iwmon if --log is used
@ 2019-11-06 21:38 James Prestwood
  2019-11-06 21:38 ` [PATCH 2/2] test-runner: fix logging directory name James Prestwood
  0 siblings, 1 reply; 3+ messages in thread
From: James Prestwood @ 2019-11-06 21:38 UTC (permalink / raw)
  To: iwd

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

Now that execute_program handles logging automatically its trivial
to add iwmon to the test and get monitor logs as well as normal
process output.
---
 tools/test-runner.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 00989391..1c807aea 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -1592,6 +1592,18 @@ static void terminate_iwd(pid_t iwd_pid)
 	kill_process(iwd_pid);
 }
 
+static pid_t start_monitor(const char *test_name)
+{
+	char *argv[4];
+
+	argv[0] = "iwmon";
+	argv[1] = "--nortnl";
+	argv[2] = "--nowiphy";
+	argv[3] = NULL;
+
+	return execute_program(argv, environ, false, test_name);
+}
+
 static bool create_tmpfs_extra_stuff(char **tmpfs_extra_stuff)
 {
 	size_t i = 0;
@@ -2004,6 +2016,7 @@ static void create_network_and_run_tests(void *data, void *user_data)
 	pid_t medium_pid = -1;
 	pid_t ofono_pid = -1;
 	pid_t phonesim_pid = -1;
+	pid_t monitor_pid = -1;
 	char *config_dir_path;
 	char *iwd_config_dir;
 	char **tmpfs_extra_stuff = NULL;
@@ -2149,6 +2162,9 @@ static void create_network_and_run_tests(void *data, void *user_data)
 		l_queue_foreach(wiphy_list, wiphy_up, NULL);
 	}
 
+	if (log)
+		monitor_pid = start_monitor(test_name);
+
 	if (check_verbosity("tls"))
 		setenv("IWD_TLS_DEBUG", "on", true);
 
@@ -2233,6 +2249,9 @@ static void create_network_and_run_tests(void *data, void *user_data)
 		stop_phonesim(phonesim_pid);
 	}
 
+	if (monitor_pid > 0)
+		kill_process(monitor_pid);
+
 exit_hostapd:
 	destroy_hostapd_instances(hostapd_pids);
 
-- 
2.17.1

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

* [PATCH 2/2] test-runner: fix logging directory name
  2019-11-06 21:38 [PATCH 1/2] test-runner: run iwmon if --log is used James Prestwood
@ 2019-11-06 21:38 ` James Prestwood
  2019-11-06 21:41   ` James Prestwood
  0 siblings, 1 reply; 3+ messages in thread
From: James Prestwood @ 2019-11-06 21:38 UTC (permalink / raw)
  To: iwd

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

localtime indexes month starting at zero so adding 1 gives us a folder
name with the correct month.
---
 tools/test-runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 1c807aea..163f53e7 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -3184,7 +3184,7 @@ int main(int argc, char *argv[])
 
 			snprintf(log_dir, sizeof(log_dir), "%s/run-%d-%d-%d-%d",
 					optarg, timeinfo->tm_year,
-					timeinfo->tm_mon, timeinfo->tm_mday,
+					timeinfo->tm_mon + 1, timeinfo->tm_mday,
 					getpid());
 			mkdir(log_dir, 0755);
 
-- 
2.17.1

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

* Re: [PATCH 2/2] test-runner: fix logging directory name
  2019-11-06 21:38 ` [PATCH 2/2] test-runner: fix logging directory name James Prestwood
@ 2019-11-06 21:41   ` James Prestwood
  0 siblings, 0 replies; 3+ messages in thread
From: James Prestwood @ 2019-11-06 21:41 UTC (permalink / raw)
  To: iwd

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

On Wed, 2019-11-06 at 13:38 -0800, James Prestwood wrote:
> localtime indexes month starting at zero so adding 1 gives us a
> folder
> name with the correct month.
> ---
>  tools/test-runner.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/test-runner.c b/tools/test-runner.c
> index 1c807aea..163f53e7 100644
> --- a/tools/test-runner.c
> +++ b/tools/test-runner.c
> @@ -3184,7 +3184,7 @@ int main(int argc, char *argv[])
>  
>  			snprintf(log_dir, sizeof(log_dir), "%s/run-%d-
> %d-%d-%d",
>  					optarg, timeinfo->tm_year,
> -					timeinfo->tm_mon, timeinfo-
> >tm_mday,
> +					timeinfo->tm_mon + 1, timeinfo-
> >tm_mday,
>  					getpid());

I just realized that the year is not really correct either. localtime
uses years since 1900, so e.g. for 2019 you get 119. Will fix this in
v2.

>  			mkdir(log_dir, 0755);
>  

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-06 21:38 [PATCH 1/2] test-runner: run iwmon if --log is used James Prestwood
2019-11-06 21:38 ` [PATCH 2/2] test-runner: fix logging directory name James Prestwood
2019-11-06 21:41   ` James Prestwood

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.