Replace is_root() with tst_require_root().
Signed-off-by: Xiaoguang Wang <[email protected]>
---
testcases/commands/sssd/sssd-lib.sh | 2 +-
testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 6 +-----
testcases/kernel/syscalls/syslog/syslog-lib.sh | 2 +-
testcases/lib/cmdlib.sh | 7 +++++--
4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/testcases/commands/sssd/sssd-lib.sh
b/testcases/commands/sssd/sssd-lib.sh
index d63ed6d..9c84729 100755
--- a/testcases/commands/sssd/sssd-lib.sh
+++ b/testcases/commands/sssd/sssd-lib.sh
@@ -73,7 +73,7 @@ cleanup()
setup()
{
- is_root || exit 1
+ tst_require_root
trap ' disable_traps
tst_resm TBROK "Testing is terminating due to a signal"
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
index 33dd8b2..4013e1f 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
@@ -95,11 +95,7 @@ setup()
PATH=$PATH:$LTPBIN
fi
- # Must be root
- if ! is_root; then
- tst_resm TCONF "You must be root to execute this test"
- return 1
- fi
+ tst_require_root
# create the temporary directory used by this testcase
LTPIMA=$LTPTMP/ima
diff --git a/testcases/kernel/syscalls/syslog/syslog-lib.sh
b/testcases/kernel/syscalls/syslog/syslog-lib.sh
index b656515..b67a8f2 100755
--- a/testcases/kernel/syscalls/syslog/syslog-lib.sh
+++ b/testcases/kernel/syscalls/syslog/syslog-lib.sh
@@ -59,7 +59,7 @@ cleanup()
setup()
{
- is_root || exit 1
+ tst_require_root
trap ' disable_traps
tst_resm TBROK "Testing is terminating due to a signal"
diff --git a/testcases/lib/cmdlib.sh b/testcases/lib/cmdlib.sh
index d6f43d2..09d2cf1 100644
--- a/testcases/lib/cmdlib.sh
+++ b/testcases/lib/cmdlib.sh
@@ -114,9 +114,12 @@ incr_tst_count()
: $(( TST_COUNT += 1 ))
}
-is_root()
+tst_require_root()
{
- [ "x$(id -ru)" = x0 ]
+ if [ "x$(id -u)" != "x0" ]; then
+ tst_resm TCONF "You must be root to execute this test"
+ exit 0
+ fi
}
#
--
1.8.2.1
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list