'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 <[email protected]> --- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
