Skip to contentSkip to conversation

Add containers/share to PATH when call init_ltp_netspace

PATCH Superseded coolgw 2 participants 2 messages Jan 6, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

coolgw

author
#0 lore raw

PATCH v2 1/1 Add containers/share to PATH when call init_ltp_netspace

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..

---
 testcases/lib/tst_net.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/lib/tst_net.sh +4 -1
index ceb45c98d..cd370e26f 100644
@@ -128,10 +128,13 @@ tst_net_require_ipv6()
 
 init_ltp_netspace()
 {
+	PATH="$PWD/../../testcases/kernel/containers/share/:$PATH"
+	tst_res TINFO "PATH='$PATH'"
+
 	local pid
 
 	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
-		tst_require_cmds ip
+		tst_require_cmds ip ns_create ns_exec ns_ifmov
 		tst_require_root
 
 		tst_require_drivers veth
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Wei,

Quoted 4 lines

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..

Once fixed, it should be here:

Fixes #991
Quoted 10 lines
---
 testcases/lib/tst_net.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/lib/tst_net.sh +0 -0
index ceb45c98d..cd370e26f 100644

testcases/lib/tst_net.sh tst_net_require_ipv6() · line 132

Quoted 5 lines
testcases/lib/tst_net.sh +2 -0
@@ -128,10 +128,13 @@ tst_net_require_ipv6()
 
 init_ltp_netspace()
 {
+	PATH="$PWD/../../testcases/kernel/containers/share/:$PATH"
+	tst_res TINFO "PATH='$PATH'"

This is not acceptable. The path should go to the test itself (tst_net.sh should be either proper installed, then it expect ns_clone and other binaries to be properly in /opt/ltp/testcases/bin and $PATH set to it. Or, if it's used for a development, user is required to set the correct $PATH already.)

The reason why it should be in tst_rhost_run.sh is to allow testing instead of make install. But user still needs to run make in required directories to have required binaries at least compiled (if not installed).

NOTE: there are only 2 network shell API tests and the other tst_ipaddr_un.sh does not use namespaces, that's why it goes just to this test.

testcases/lib/tst_net.sh tst_net_require_ipv6() · line 137

Quoted 6 lines
testcases/lib/tst_net.sh +2 -1
+
 	local pid
 
 	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
-		tst_require_cmds ip
+		tst_require_cmds ip ns_create ns_exec ns_ifmov

This is wrong:
s/ns_ifmov/ns_ifmove/

(copy & paste is your friend to prevent silly errors)

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp