All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name
@ 2022-07-28 11:42 Martin Doucha
  2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
  2022-08-02 14:49 ` [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Cyril Hrubis
  0 siblings, 2 replies; 9+ messages in thread
From: Martin Doucha @ 2022-07-28 11:42 UTC (permalink / raw)
  To: ltp

Using argv[1] as the command name might fail if the first argument happens
to be I/O redirection. Use args[0] which is always the first argument not
processed by tst_rod.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/lib/tst_rod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_rod.c b/testcases/lib/tst_rod.c
index 2f0ff902c..24c1fb668 100644
--- a/testcases/lib/tst_rod.c
+++ b/testcases/lib/tst_rod.c
@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	execvp(argv[1], args);
+	execvp(args[0], args);
 
 	/* Fall back to shell if command wasn't found */
 	FILE *sin = popen("/bin/sh", "w");
-- 
2.36.1


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

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

* [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-07-28 11:42 [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Martin Doucha
@ 2022-07-28 11:42 ` Martin Doucha
  2022-07-28 11:49   ` Martin Doucha
                     ` (2 more replies)
  2022-08-02 14:49 ` [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Cyril Hrubis
  1 sibling, 3 replies; 9+ messages in thread
From: Martin Doucha @ 2022-07-28 11:42 UTC (permalink / raw)
  To: ltp

Using tst_rod to check directory change success doesn't work. The command
gets executed in a subprocess and will have no effect on the parent
shell where the directory change is desired.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/lib/tst_rod.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testcases/lib/tst_rod.c b/testcases/lib/tst_rod.c
index 24c1fb668..362471fa9 100644
--- a/testcases/lib/tst_rod.c
+++ b/testcases/lib/tst_rod.c
@@ -77,6 +77,13 @@ int main(int argc, char *argv[])
 
 	args[pos] = NULL;
 
+	if (!strcmp(args[0], "cd") || !strcmp(args[0], "pushd") ||
+		!strcmp(args[0], "popd")) {
+		fprintf(stderr, "\"%s %s\" has no effect on parent shell\n",
+			argv[0], args[0]);
+		return 1;
+	}
+
 	if (stdin_path) {
 		if (close(0)) {
 			fprintf(stderr, "%s: Failed to close stdin: %s\n",
-- 
2.36.1


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

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

* Re: [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
@ 2022-07-28 11:49   ` Martin Doucha
  2022-08-02 14:55     ` Cyril Hrubis
  2022-08-02 14:53   ` Cyril Hrubis
  2022-08-31 12:38   ` Cyril Hrubis
  2 siblings, 1 reply; 9+ messages in thread
From: Martin Doucha @ 2022-07-28 11:49 UTC (permalink / raw)
  To: ltp

On 28. 07. 22 13:42, Martin Doucha wrote:
> Using tst_rod to check directory change success doesn't work. The command
> gets executed in a subprocess and will have no effect on the parent
> shell where the directory change is desired.
> 
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---

Beware that this patch will cause a lot of broken shell tests to fail.
Another patchset fixing the incorrect ROD usage in shell tests is needed
before merging this patch.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

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

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

* Re: [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name
  2022-07-28 11:42 [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Martin Doucha
  2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
@ 2022-08-02 14:49 ` Cyril Hrubis
  2022-08-16 12:40   ` Petr Vorel
  1 sibling, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2022-08-02 14:49 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

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

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
  2022-07-28 11:49   ` Martin Doucha
@ 2022-08-02 14:53   ` Cyril Hrubis
  2022-08-31 12:38   ` Cyril Hrubis
  2 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-08-02 14:53 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

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

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-07-28 11:49   ` Martin Doucha
@ 2022-08-02 14:55     ` Cyril Hrubis
  2022-08-16 12:51       ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2022-08-02 14:55 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi!
> Beware that this patch will cause a lot of broken shell tests to fail.
> Another patchset fixing the incorrect ROD usage in shell tests is needed
> before merging this patch.

The only broken test I've found is du01.sh that does
"ROD_SILENT cd basedir" are there actually any other tests that does so?

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name
  2022-08-02 14:49 ` [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Cyril Hrubis
@ 2022-08-16 12:40   ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2022-08-16 12:40 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi all,

FYI this first patch merged.
Thanks!

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-08-02 14:55     ` Cyril Hrubis
@ 2022-08-16 12:51       ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2022-08-16 12:51 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

> Hi!
> > Beware that this patch will cause a lot of broken shell tests to fail.
> > Another patchset fixing the incorrect ROD usage in shell tests is needed
> > before merging this patch.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

I also wonder if we should care for pushd/popd which are bashism and should not
be used in LTP tests which use new shell API.

So far they are used in testcases/realtime/run.sh testscripts/test_realtime.sh,
which does not use shell API (and realtime should be removed after porting
anything useful to rt-tests).

> The only broken test I've found is du01.sh that does
> "ROD_SILENT cd basedir" are there actually any other tests that does so?

Indeed it looks just du01.sh.

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands
  2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
  2022-07-28 11:49   ` Martin Doucha
  2022-08-02 14:53   ` Cyril Hrubis
@ 2022-08-31 12:38   ` Cyril Hrubis
  2 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-08-31 12:38 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi!
Pushed now that df01.sh has been dealt with, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

end of thread, other threads:[~2022-08-31 12:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 11:42 [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Martin Doucha
2022-07-28 11:42 ` [LTP] [PATCH 2/2] tst_rod: Fail on directory change commands Martin Doucha
2022-07-28 11:49   ` Martin Doucha
2022-08-02 14:55     ` Cyril Hrubis
2022-08-16 12:51       ` Petr Vorel
2022-08-02 14:53   ` Cyril Hrubis
2022-08-31 12:38   ` Cyril Hrubis
2022-08-02 14:49 ` [LTP] [PATCH 1/2] tst_rod: Use args[0] as the command name Cyril Hrubis
2022-08-16 12:40   ` 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.