All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first
@ 2026-05-15 13:36 Petr Vorel
  2026-05-15 15:16 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petr Vorel @ 2026-05-15 13:36 UTC (permalink / raw)
  To: ltp

LTP API changes the current working directory when TST_NEEDS_TMPDIR=1
(or .needs_tmpdir = 1S in C API) is set (even legacy shell API test.sh
does that). But this was not true for tst_rhost_run() function in
tst_net.sh, it executed command in the default directory (user home
directory in case of 2 host ssh based setup and / (root) in case of
single host netns based setup).

That is problem on it's own, but it causes problems on read-only root
filesystem.  Wireguard tests in wireguard_lib.sh write file as part of
tst_rhost_run() call:

    tst_rhost_run -s -c "echo '$(cat wg1.key)' > wg1.key"

Which obviously fails on RO /:

    2>&1: line 1: wg1.key: Read-only file system
    wireguard01 1 TBROK: 'echo 'MCqLzPqBbgU/4YOJCH1rrdbOiVFPCWgDpgYZ/hj622A=' > wg1.key' failed on NETNS: ''

While Wireguard tests looks to be the only one which redirect output to
a file in tst_rhost_run() command, it's better to fix the API behavior
instead passing full path ($TST_TMPDIR/wg1.key) to tst_rhost_run().

Reported-by: Petr Cervinka <pcervinka@suse.com>
Fixes: b3906f73cf ("lib: setup rhost TST_TMPDIR if net test sets TST_NEEDS_TMPDIR")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 38435dea74..4e5c1e854a 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -265,6 +265,9 @@ tst_rhost_run()
 		return 1
 	fi
 
+	# go to $TST_TMPDIR before executing the command (once directory created)
+	[ "$TST_TMPDIR_RHOST" = 1 ] && cmd="cd $TST_TMPDIR; $cmd"
+
 	sh_cmd="$pre_cmd $cmd $post_cmd"
 
 	if [ -n "${TST_USE_NETNS:-}" ]; then
-- 
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first
  2026-05-15 13:36 [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first Petr Vorel
@ 2026-05-15 15:16 ` linuxtestproject.agent
  2026-05-19  8:54 ` [LTP] [PATCH 1/1] " Andrea Cervesato via ltp
  2026-05-22 14:19 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: linuxtestproject.agent @ 2026-05-15 15:16 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp, LTP AI Reviewer

Hi Petr,

On Fri, 15 May 2026 15:36:13 +0200, Petr Vorel wrote:
> tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first

> +	[ "$TST_TMPDIR_RHOST" = 1 ] && cmd="cd $TST_TMPDIR; $cmd"

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

Pre-existing issues noticed in the surrounding code (not introduced
by this patch):

- testcases/lib/tst_net.sh:1216 — "workaround" keyword in tst_res_ TINFO
  message; not a G1 violation but worth a note if ever revisiting that path.

---
Note:

Our agent completed the review of the patch. The agent can sometimes
produce false positives although often its findings are genuine. If you
find issues with the review, please comment this email or ignore the
suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first
  2026-05-15 13:36 [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first Petr Vorel
  2026-05-15 15:16 ` [LTP] " linuxtestproject.agent
@ 2026-05-19  8:54 ` Andrea Cervesato via ltp
  2026-05-22 14:19 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-19  8:54 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first
  2026-05-15 13:36 [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first Petr Vorel
  2026-05-15 15:16 ` [LTP] " linuxtestproject.agent
  2026-05-19  8:54 ` [LTP] [PATCH 1/1] " Andrea Cervesato via ltp
@ 2026-05-22 14:19 ` Cyril Hrubis
  2026-05-24 19:22   ` Petr Vorel
  2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2026-05-22 14:19 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

Have you tested this change? If it does not cause any regression it
should be applied before the release.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first
  2026-05-22 14:19 ` Cyril Hrubis
@ 2026-05-24 19:22   ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2026-05-24 19:22 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

> Hi!
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> Have you tested this change? If it does not cause any regression it
> should be applied before the release.

Yes, I run most of the networking tests. It should be safe so I merged now, in
case of a potential regression is spot early next week.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2026-05-24 19:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 13:36 [LTP] [PATCH 1/1] tst_net.sh: tst_rhost_run(): Go to LTP temporary directory first Petr Vorel
2026-05-15 15:16 ` [LTP] " linuxtestproject.agent
2026-05-19  8:54 ` [LTP] [PATCH 1/1] " Andrea Cervesato via ltp
2026-05-22 14:19 ` Cyril Hrubis
2026-05-24 19:22   ` Petr Vorel

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.