* Use 'test.sh' script and use 'tst_*'.

* Add 'TCID' and 'TST_TOTAL' global variables.

* Use '.' instead of 'source'.

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

* Some cleanup.

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

diff --git a/testcases/kernel/security/smack/smack_set_load.sh 
b/testcases/kernel/security/smack/smack_set_load.sh
index 2dd4fbb..57c04c0 100755
--- a/testcases/kernel/security/smack/smack_set_load.sh
+++ b/testcases/kernel/security/smack/smack_set_load.sh
@@ -14,40 +14,43 @@
 #               1         2         3         4         5         6
 #      123456789012345678901234567890123456789012345678901234567890123456789
 
-source smack_common.sh
+export TCID=smack_set_load
+export TST_TOTAL=1
 
-RuleA="TheOne                  TheOther                rwxa"
-RuleB="TheOne                  TheOther                r---"
+. test.sh
 
-OldRule=`grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther '`
+. smack_common.sh
 
-echo -n "$RuleA" 2>/dev/null > "$smackfsdir/load"
-NewRule=`grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther '`
-if [ "$NewRule" = "" ]; then
-       echo "Rule did not get set."
-       exit 1
+rule_a="TheOne                  TheOther                rwxa"
+rule_b="TheOne                  TheOther                r---"
+
+old_rule=$(grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther ')
+
+echo -n "$rule_a" 2>/dev/null > "$smackfsdir/load"
+new_rule=$(grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther ')
+if [ "$new_rule" = "" ]; then
+       tst_brkm TFAIL "Rule did not get set."
 fi
-Mode=`echo "$NewRule" | sed -e 's/.* //'`
-if [ "$Mode" != "rwxa" ]; then
-       echo "Rule \"$NewRule\" is not set correctly."
+mode=$(echo "$new_rule" | sed -e 's/.* //')
+if [ "$mode" != "rwxa" ]; then
+       tst_brkm TFAIL "Rule \"$new_rule\" is not set correctly."
        exit 1
 fi
 
-echo -n "$RuleB" 2>/dev/null > "$smackfsdir/load"
-NewRule=`grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther '`
-if [ "$NewRule" = "" ]; then
-       echo "Rule did not get set."
-       exit 1
+echo -n "$rule_b" 2>/dev/null > "$smackfsdir/load"
+new_rule=$(grep "^TheOne" "$smackfsdir/load" 2>/dev/null | grep ' TheOther ')
+if [ "$new_rule" = "" ]; then
+       tst_brkm TFAIL "Rule did not get set."
 fi
-Mode=`echo "$NewRule" | sed -e 's/.* //'`
-if [ "$Mode" != "r" ]; then
-       echo "Rule \"$NewRule\" is not set correctly."
-       exit 1
+mode=$(echo "$new_rule" | sed -e 's/.* //')
+if [ "$mode" != "r" ]; then
+       tst_brkm TFAIL "Rule \"$new_rule\" is not set correctly."
 fi
 
-if [ "$OldRule" != "$NewRule" ]; then
-       cat <<EOM
-Notice: Test access rule changed from
-"$OldRule" to "$NewRule".
-EOM
+if [ "$old_rule" != "$new_rule" ]; then
+       tst_resm TINFO "Notice: Test access rule changed from \"$old_rule\"" \
+                      "to \"$new_rule\"."
 fi
+
+tst_resm TPASS "Test \"$TCID\" success."
+tst_exit
-- 
1.9.3


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to