All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] test-runner: fix --monitor option
@ 2021-09-01 23:38 James Prestwood
  2021-09-01 23:38 ` [PATCH 2/2] station: check for duplicate frequencies in debug scan James Prestwood
  2021-09-03 18:20 ` [PATCH 1/2] test-runner: fix --monitor option Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2021-09-01 23:38 UTC (permalink / raw)
  To: iwd

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

Two issues:
 - log-gid/uid was not being set
 - the log file was being appended if it already existed
---
 tools/test-runner | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/test-runner b/tools/test-runner
index fc57cd81..9e4d0780 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -183,7 +183,9 @@ class Process(subprocess.Popen):
 			args = ['ip', 'netns', 'exec', namespace] + args
 
 		if outfile:
-			self._append_outfile(outfile)
+			# outfile is only used by iwmon, in which case we don't want
+			# to append to an existing file.
+			self._append_outfile(outfile, append=False)
 
 		if self.ctx.args.log:
 			logfile = '%s/%s/%s' % (self.ctx.args.log,
@@ -240,7 +242,7 @@ class Process(subprocess.Popen):
 
 		return True
 
-	def _append_outfile(self, file):
+	def _append_outfile(self, file, append=True):
 		gid = int(self.ctx.args.log_gid)
 		uid = int(self.ctx.args.log_uid)
 		dir = os.path.dirname(file)
@@ -253,7 +255,7 @@ class Process(subprocess.Popen):
 
 		# If the out file exists, append. Useful for processes like
 		# hostapd_cli where it is called multiple times independently.
-		if os.path.isfile(file):
+		if os.path.isfile(file) and append:
 			mode = 'a'
 		else:
 			mode = 'w'
@@ -1708,6 +1710,9 @@ class Main:
 			self.args.monitor = os.path.abspath(self.args.monitor)
 			mon_parent_dir = os.path.abspath(os.path.join(self.args.monitor, os.pardir))
 
+			options += ' --log-gid %u' % int(os.environ['SUDO_GID'])
+			options += ' --log-uid %u' % int(os.environ['SUDO_UID'])
+
 		denylist = [
 			'auto_tests',
 			'sub_tests',
-- 
2.31.1

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

* [PATCH 2/2] station: check for duplicate frequencies in debug scan
  2021-09-01 23:38 [PATCH 1/2] test-runner: fix --monitor option James Prestwood
@ 2021-09-01 23:38 ` James Prestwood
  2021-09-03 18:20 ` [PATCH 1/2] test-runner: fix --monitor option Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2021-09-01 23:38 UTC (permalink / raw)
  To: iwd

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

---
 src/station.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/station.c b/src/station.c
index 9f00bfb3..2b4fa7bc 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3980,6 +3980,9 @@ static struct l_dbus_message *station_debug_scan(struct l_dbus *dbus,
 	freq_set = scan_freq_set_new();
 
 	for (i = 0; i < freqs_len; i++) {
+		if (scan_freq_set_contains(freq_set, (uint32_t)freqs[i]))
+			continue;
+
 		if (!scan_freq_set_add(freq_set, (uint32_t)freqs[i])) {
 			scan_freq_set_free(freq_set);
 			goto invalid_args;
-- 
2.31.1

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

* Re: [PATCH 1/2] test-runner: fix --monitor option
  2021-09-01 23:38 [PATCH 1/2] test-runner: fix --monitor option James Prestwood
  2021-09-01 23:38 ` [PATCH 2/2] station: check for duplicate frequencies in debug scan James Prestwood
@ 2021-09-03 18:20 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2021-09-03 18:20 UTC (permalink / raw)
  To: iwd

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

Hi James,

On 9/1/21 6:38 PM, James Prestwood wrote:
> Two issues:
>   - log-gid/uid was not being set
>   - the log file was being appended if it already existed
> ---
>   tools/test-runner | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 

Both applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2021-09-03 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 23:38 [PATCH 1/2] test-runner: fix --monitor option James Prestwood
2021-09-01 23:38 ` [PATCH 2/2] station: check for duplicate frequencies in debug scan James Prestwood
2021-09-03 18:20 ` [PATCH 1/2] test-runner: fix --monitor option 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.