Message ID | 20220728114258.30832-2-mdoucha@suse.cz |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] tst_rod: Use args[0] as the command name | expand |
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.
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
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?
> 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
Hi! Pushed now that df01.sh has been dealt with, thanks.
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",
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(+)