[LTP] [PATCH v4] Add PATH to tst_rhost_run.sh

Petr Vorel pvorel@suse.cz
Fri Jan 13 10:40:56 CET 2023


Hi Wei, all,

> From: coolgw <wegao@suse.com>
NOTE: could you run this command to fix your setup:
git config --global user.name "Wei Gao"

> When run single test case use command such as:
> LTP_SHELL_API_TESTS=shell/net/tst_rhost_run.sh make test-shell
> Error msg such as "ns_create: command not found" will popup, so
> need update PATH before call ns_create etc..

> More important:
> 1) LTP shell API tests depend on properly compiled LTP.
> Therefore this is just a workaround to make visible that some tool is missing.

> 2) I wonder if there is way to properly fix this dependency in make.
> I guess test-shell target should depend on (at least): ns_create ns_exec
> ns_ifmove.

@Li, @Richie, @Xu, @Cyril: anything against moving
testcases/kernel/containers/share/ content to testcases/lib? They are used
mainly for container tests, but since tst_net.sh depends on it, IMHO they should
be in library. This helps to fix make dependency for tst_rhost_run.sh.

Current LTP build system does not allow to add ns_exec as make dependency for
test-shell. Tests depends on lib-all, which does not include testcases/lib,
thus make dependency for tst_rhost_run.sh will not be solved, but at least it
will be on a common place. I wonder if testcases/lib/ could be somehow added as
a dependency to test make target.

---

@Wei I was going to improve the commit message and merged. But there is actually
much better solution for this problem (unless anybody from LTP maintainers is
against it).

Because these helpers are needed also for all LTP shell network tests
(everything which uses tst_net.sh), they should be moved to testcases/lib
directory (whole content of testcases/kernel/containers/share/), where are all
shell helpers.  Files there require to have tst_ prefix (e.g. ns_exec.c =>
tst_ns_exec.c, ...).

This will include to add these names without '.c' suffix to MAKE_TARGETS in
testcases/lib/Makefile and update paths everywhere (e.g runtest/containers,
netns_sysfs.sh, ...). This needs to be in a single commit.

Kind regards,
Petr

> Signed-off-by: WEI GAO <wegao@suse.com>
> ---
> v3 -> v4: update base Vorel's latest comments, remove unrelated change
> V2 -> V3: move path to test case itself 
> V1 -> V2: add tst_require_cmds for init_ltp_netspace()

>  lib/newlib_tests/shell/net/tst_rhost_run.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> index 773b8dd33..951551514 100755
> --- a/lib/newlib_tests/shell/net/tst_rhost_run.sh
> +++ b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> @@ -3,7 +3,8 @@
>  # Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>

>  TST_TESTFUNC=do_test
> -PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
> +root="$(dirname $0)/../../../../"
> +PATH="$root/testcases/lib/:$root/testcases/kernel/containers/share/:$PATH"

>  export TST_NET_RHOST_RUN_DEBUG=1


More information about the ltp mailing list