* On some systems 'smackfs' mounts aren't listed in the output from 'df',
  so we switch to the '/proc/mounts' instead.

* Use 'tst_brkm'.

* Use '$()' instead of '``'.

Signed-off-by: Zeng Linggang <zenglg...@cn.fujitsu.com>
---
 testcases/kernel/security/smack/smack_common.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/testcases/kernel/security/smack/smack_common.sh 
b/testcases/kernel/security/smack/smack_common.sh
index 5d7f112..d4165d1 100755
--- a/testcases/kernel/security/smack/smack_common.sh
+++ b/testcases/kernel/security/smack/smack_common.sh
@@ -27,20 +27,20 @@
 
 smackfsdir=${smackfsdir:=/smack}
 
-check_mounted() {
-       if ! expr "$smackfsdir" : "$(df -P | awk "\$NF == \"$smackfsdir\""'{ 
print $NF }')"; then
-               echo "smackfs not mounted at $smackfsdir"
-               exit 1
+check_mounted()
+{
+       grep -q $smackfsdir /proc/mounts
+       if [ $? -ne 0 ]; then
+               tst_brkm TCONF "smackfs not mounted at \"$smackfsdir\""
        fi
 }
 
-check_onlycap() {
-       onlycap=`cat "$smackfsdir/onlycap" 2>/dev/null`
-       if [ "$onlycap" != "" ]; then
-               cat <<EOM
-The smack label reported for $smackfsdir/onlycap is "$onlycap", not the 
expected "".
-EOM
-               exit 1
+check_onlycap()
+{
+       onlycap=$(cat "$smackfsdir/onlycap" 2>/dev/null)
+       if [ -n "$onlycap" ]; then
+               tst_brkm TCONF "\"$smackfsdir/onlycap\" is \"$onlycap\", not" \
+                              "the expected \"\"."
        fi
 }
 
-- 
1.9.3


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to