public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/sendmsg01: using 'ip' command to replace 'ifconfig'
@ 2013-01-21 15:59 Zhouping Liu
  2013-01-21 16:00 ` chrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouping Liu @ 2013-01-21 15:59 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 checking capture unexpected signal.

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

diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg01.c b/testcases/kernel/syscalls/sendmsg/sendmsg01.c
index e1424ca..2376e3e 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,12 +589,12 @@ 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");
+			 "ip failed to bring up loop back device");
 		tst_exit();
 	}
 
@@ -607,7 +610,6 @@ static void cleanup(void)
 	unlink(tmpsunpath);
 	TEST_CLEANUP;
 	tst_rmdir();
-
 }
 
 static void setup0(void)
-- 
1.7.11.7


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 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_122412
_______________________________________________
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-21 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-21 15:59 [LTP] [PATCH] syscalls/sendmsg01: using 'ip' command to replace 'ifconfig' Zhouping Liu
2013-01-21 16:00 ` chrubis

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