Skip to contentSkip to conversation

Fix Network Namespace container test scripts

PATCH In review Sachin Sant 2 participants 2 messages Apr 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix Network Namespace container test scripts

NETNS tests from containers fails to execute with following message

Running netns tests.
--: childns.sh '/opt/ltp': No such file or directory

LTP infrastructure fails to locate the childns.sh script. Fix this. There were few hardcoded paths within various tests which are not available during runtime.

eg : %s/testcases/kernel/containers/netns/paripv6.sh

Fix those occurences by specifying proper paths (%s/testcases/bin/paripv6.sh)

The following patch allows the test to be executed properly on my Fedora 12 system.

---

testcases/kernel/containers/netns/common.c +2 -2
diff -Naurp 1/testcases/kernel/containers/netns/common.c 2/testcases/kernel/containers/netns/common.c
@@ -92,7 +92,7 @@ int create_net_namespace(char *p1, char 
 	}
 
 	/* We need to pass the child pid to the parentns.sh script */
-	sprintf(par, "parentns.sh '%s' %s %" PRId32 , ltproot, p1, pid);
+	sprintf(par, "%s/testcases/bin/parentns.sh %s %" PRId32 , ltproot, p1, pid);
 
 	ret = system(par);
 	status = WEXITSTATUS(ret);
@@ -141,7 +141,7 @@ int child_fn(void *c1)
 		exit(1);
 	}
 
-	sprintf(child, "childns.sh '%s'", ltproot);
+	sprintf(child, "%s/testcases/bin/childns.sh", ltproot);
 
 	/* Unshare the network namespace in the child */
 #if HAVE_UNSHARE
testcases/kernel/containers/netns/par_chld_ipv6.c +2 -4
diff -Naurp 1/testcases/kernel/containers/netns/par_chld_ipv6.c 2/testcases/kernel/containers/netns/par_chld_ipv6.c
@@ -74,10 +74,8 @@ int main()
         tst_resm(TFAIL, "error while allocating mem");
         exit(1);
     }
-    sprintf(par, "%s/testcases/kernel/containers/netns/paripv6.sh" ,     \
-ltproot);
-    sprintf(child, "%s/testcases/kernel/containers/netns/childipv6.sh" , \
-ltproot);
+    sprintf(par, "%s/testcases/bin/paripv6.sh", ltproot);
+    sprintf(child, "%s/testcases/bin/childipv6.sh", ltproot);
 
     if ((pid = fork()) == 0) {
 
testcases/kernel/containers/netns/sysfsview.c +1 -1
diff -Naurp 1/testcases/kernel/containers/netns/sysfsview.c 2/testcases/kernel/containers/netns/sysfsview.c
@@ -56,7 +56,7 @@ int main()
         exit(1);
     }
 
-    sprintf(script, "%s/testcases/kernel/containers/netns/parent_share.sh" , ltproot);
+    sprintf(script, "%s/testcases/bin/parent_share.sh" , ltproot);
 
     /* Parent should be able to view child sysfs and vice versa */
     ret = system(script);
testcases/kernel/containers/netns/two_children_ns.c +4 -4
diff -Naurp 1/testcases/kernel/containers/netns/two_children_ns.c 2/testcases/kernel/containers/netns/two_children_ns.c
@@ -85,10 +85,10 @@ int main()
         	exit(1);
     }
 
-    sprintf(child[0], "%s/testcases/kernel/containers/netns/child_1.sh" , ltproot);
-    sprintf(child[1], "%s/testcases/kernel/containers/netns/child_2.sh" , ltproot);
-    sprintf(par[0], "%s/testcases/kernel/containers/netns/parent_1.sh" , ltproot);
-    sprintf(par[1], "%s/testcases/kernel/containers/netns/parent_2.sh" , ltproot);
+    sprintf(child[0], "%s/testcases/bin/child_1.sh" , ltproot);
+    sprintf(child[1], "%s/testcases/bin/child_2.sh" , ltproot);
+    sprintf(par[0], "%s/testcases/bin/parent_1.sh" , ltproot);
+    sprintf(par[1], "%s/testcases/bin/parent_2.sh" , ltproot);
 
     /* Loop for creating two child Network Namespaces */
     for(i=0;i<2;i++) {

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Tested this patch, it looks fine. Also few problems there which this commit resolves.

f50539e0bcb0f9bab88101ce40a8e09a1d76d4a9

Acked & Tested By: Rishikesh K Rajak <[email protected]>

-Rishi

Quoted 85 lines · Sachin Sant

NETNS tests from containers fails to execute with following message

Running netns tests.
--: childns.sh '/opt/ltp': No such file or directory

LTP infrastructure fails to locate the childns.sh script. Fix this. There were few hardcoded paths within various tests which are not available during runtime.

eg : %s/testcases/kernel/containers/netns/paripv6.sh

Fix those occurences by specifying proper paths (%s/testcases/bin/paripv6.sh)

The following patch allows the test to be executed properly on my Fedora 12 system.

---
diff -Naurp 1/testcases/kernel/containers/netns/common.c 2/testcases/kernel/containers/netns/common.c

testcases/kernel/containers/netns/common.c +2 -2
@@ -92,7 +92,7 @@ int create_net_namespace(char *p1, char 
 	}
 
 	/* We need to pass the child pid to the parentns.sh script */
-	sprintf(par, "parentns.sh '%s' %s %" PRId32 , ltproot, p1, pid);
+	sprintf(par, "%s/testcases/bin/parentns.sh %s %" PRId32 , ltproot, p1, pid);
 
 	ret = system(par);
 	status = WEXITSTATUS(ret);
@@ -141,7 +141,7 @@ int child_fn(void *c1)
 		exit(1);
 	}
 
-	sprintf(child, "childns.sh '%s'", ltproot);
+	sprintf(child, "%s/testcases/bin/childns.sh", ltproot);
 
 	/* Unshare the network namespace in the child */
 #if HAVE_UNSHARE

diff -Naurp 1/testcases/kernel/containers/netns/par_chld_ipv6.c 2/testcases/kernel/containers/netns/par_chld_ipv6.c

testcases/kernel/containers/netns/par_chld_ipv6.c +2 -4
@@ -74,10 +74,8 @@ int main()
         tst_resm(TFAIL, "error while allocating mem");
         exit(1);
     }
-    sprintf(par, "%s/testcases/kernel/containers/netns/paripv6.sh" ,     \
-ltproot);
-    sprintf(child, "%s/testcases/kernel/containers/netns/childipv6.sh" , \
-ltproot);
+    sprintf(par, "%s/testcases/bin/paripv6.sh", ltproot);
+    sprintf(child, "%s/testcases/bin/childipv6.sh", ltproot);
 
     if ((pid = fork()) == 0) {
 

diff -Naurp 1/testcases/kernel/containers/netns/sysfsview.c 2/testcases/kernel/containers/netns/sysfsview.c

testcases/kernel/containers/netns/sysfsview.c +1 -1
@@ -56,7 +56,7 @@ int main()
         exit(1);
     }
 
-    sprintf(script, "%s/testcases/kernel/containers/netns/parent_share.sh" , ltproot);
+    sprintf(script, "%s/testcases/bin/parent_share.sh" , ltproot);
 
     /* Parent should be able to view child sysfs and vice versa */
     ret = system(script);

diff -Naurp 1/testcases/kernel/containers/netns/two_children_ns.c 2/testcases/kernel/containers/netns/two_children_ns.c

testcases/kernel/containers/netns/two_children_ns.c +4 -4
@@ -85,10 +85,10 @@ int main()
         	exit(1);
     }
 
-    sprintf(child[0], "%s/testcases/kernel/containers/netns/child_1.sh" , ltproot);
-    sprintf(child[1], "%s/testcases/kernel/containers/netns/child_2.sh" , ltproot);
-    sprintf(par[0], "%s/testcases/kernel/containers/netns/parent_1.sh" , ltproot);
-    sprintf(par[1], "%s/testcases/kernel/containers/netns/parent_2.sh" , ltproot);
+    sprintf(child[0], "%s/testcases/bin/child_1.sh" , ltproot);
+    sprintf(child[1], "%s/testcases/bin/child_2.sh" , ltproot);
+    sprintf(par[0], "%s/testcases/bin/parent_1.sh" , ltproot);
+    sprintf(par[1], "%s/testcases/bin/parent_2.sh" , ltproot);
 
     /* Loop for creating two child Network Namespaces */
     for(i=0;i<2;i++) {
Signature · 16 lines
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list