public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2]] syscalls/sendmsg01: using 'ip' command to replace 'ifconfig'
@ 2013-01-22  2:00 Zhouping Liu
  2013-01-22  3:03 ` Wanlong Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouping Liu @ 2013-01-22  2:00 UTC (permalink / raw)
  To: LTP List

'ip' tools is more general than 'ifconfig', and there are some
distros don't support to install 'ifconfig' tools under default,
which will cause such below error:

   sh: ifconfig: command not found
   sendmsg01    1  TBROK  :  ifconfig failed to bring up loop back device
   sendmsg01    2  TBROK  :  Remaining cases broken

the patch displaced 'ifconfig' using 'ip', and also the case need root
permission and to check capture unexpected signal.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/syscalls/sendmsg/sendmsg01.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

v2: added Cyril's suggestion: try ip and fallback to ifconfig if ip has failed.

diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg01.c b/testcases/kernel/syscalls/sendmsg/sendmsg01.c
index e1424ca..2a1b2c9 100644
--- a/testcases/kernel/syscalls/sendmsg/sendmsg01.c
+++ b/testcases/kernel/syscalls/sendmsg/sendmsg01.c
@@ -573,6 +573,9 @@ static void setup(void)
 {
 
 	int ret = 0;
+
+	tst_require_root(NULL);
+	tst_sig(FORK, DEF_HANDLER, cleanup);
 	TEST_PAUSE;
 
 	/* initialize sockaddr's */
@@ -586,13 +589,16 @@ static void setup(void)
 	strcpy(sun1.sun_path, tmpsunpath);
 
 	/* this test will fail or in some cases hang if no eth or lo is
-	 * configured, so making sure in setup that atleast lo is up
+	 * configured, so making sure in setup that at least lo is up
 	 */
-	ret = system("ifconfig lo up 127.0.0.1");
+	ret = system("ip link set lo up");
 	if (WEXITSTATUS(ret) != 0) {
-		tst_brkm(TBROK, cleanup,
-			 "ifconfig failed to bring up loop back device");
-		tst_exit();
+		ret = system("ifconfig lo up 127.0.0.1");
+		if (WEXITSTATUS(ret) != 0) {
+			tst_brkm(TBROK, cleanup,
+			    "ip/ifconfig failed to bring up loop back device");
+			tst_exit();
+		}
 	}
 
 	pid = start_server(&sin1, &sun1);
@@ -607,7 +613,6 @@ static void cleanup(void)
 	unlink(tmpsunpath);
 	TEST_CLEANUP;
 	tst_rmdir();
-
 }
 
 static void setup0(void)
-- 
1.7.11.7


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2013-01-22  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-22  2:00 [LTP] [PATCH v2]] syscalls/sendmsg01: using 'ip' command to replace 'ifconfig' Zhouping Liu
2013-01-22  3:03 ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox