Using test.sh in the case:
1.Change the tst_resm() followed by exit to tst_brkm and remove the exit
2.Change the "echo ...; exit" to tst_brkm TCONF or tst_brkm TFAIL
3.Change the exit -1 at the end of the test to tst_resm TFAIL and call
  tst_exit at the very end of the test

Signed-off-by: Cui Bixuan <cuibix...@huawei.com>
---
 .../kernel/syscalls/utimensat/utimensat_tests.sh   | 36 ++++++++--------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh 
b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
index 5b1c287..3521fe2 100755
--- a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
+++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
@@ -27,9 +27,7 @@ export TST_COUNT=0
 . test.sh

 if tst_kvercmp 2 6 22 ; then
-       tst_resm TCONF "System kernel version is less than 2.6.22"
-       tst_resm TCONF "Cannot execute test"
-       exit 0
+       tst_brkm TCONF "System kernel version is less than 2.6.22 and cannot 
execute test"
 fi

 RESULT_FILE=$TMPDIR/utimensat.result
@@ -40,8 +38,7 @@ FILE=$TEST_DIR/utimensat.test_file
 TEST_PROG=utimensat01

 if [ ! -f $LTPROOT/testcases/bin/$TEST_PROG ]; then
-       tst_resm TWARN "$LTPROOT/testcases/bin/$TEST_PROG is missing (please 
check install)"
-       exit 1
+       tst_brkm TWARN "$LTPROOT/testcases/bin/$TEST_PROG is missing (please 
check install)"
 fi

 # Summary counters of all test results
@@ -73,15 +70,13 @@ setup_file()

     sudo $s_arg -u $test_user touch $FILE || return $?
     if ! $TEST_PROG -q $FILE 0 0 0 0 > $RESULT_FILE; then
-        echo "Failed to set up test file $FILE" 1>&2
-        exit 1
+       tst_resm TFAIL "Failed to set up test file $FILE"
     fi

     read res atime mtime < $RESULT_FILE
     if test "X$res" != "XSUCCESS" ||
                 test $atime -ne 0 || test $mtime != 0; then
-        echo "Failed to set correct times on test file $FILE" 1>&2
-        exit 1
+       tst_resm TFAIL "Failed to set correct times on test file $FILE"
     fi

     # Set owner, permissions, and EFAs for file.
@@ -126,8 +121,7 @@ check_result()
     # If our test setup failed, stop immediately

     if test $STATUS -gt 1; then
-        echo "FAILED (bad test setup)"
-        exit 1
+       tst_resm TFAIL "FAILED (bad test setup)"
     fi

     read res atime mtime < $RESULT_FILE
@@ -204,8 +198,7 @@ run_test()
            ;;
         W) do_write_fd_test=0
            ;;
-        *) echo "run_test: bad usage"
-           exit 1
+        *) tst_resm TFAIL "run_test: bad usage"
            ;;
         esac
     done
@@ -255,15 +248,13 @@ run_test()
 # Use trap to restore this line after program terminates.
 sudoers=/etc/sudoers
 if [ ! -r $sudoers ]; then
-       tst_resm TBROK "can't read $sudoers"
-       exit 1
+       tst_brkm TBROK "can't read $sudoers"
 fi
 pattern="[[:space:]]*Defaults[[:space:]]*requiretty.*"
 if grep -q "^${pattern}" $sudoers; then
        tst_resm TINFO "Comment requiretty in $sudoers for automated testing 
systems"
        if ! sed -r -i.$$ -e "s/^($pattern)/#\1/" $sudoers; then
-               tst_resm TBROK "failed to mangle $sudoers properly"
-               exit 1
+               tst_brkm TBROK "failed to mangle $sudoers properly"
        fi
        trap 'trap "" EXIT; restore_sudoers' EXIT
 fi
@@ -285,12 +276,11 @@ else
 fi

 if ! sudo $s_arg true; then
-       tst_resm TBROK "sudo cannot be run by user non-interactively"
-       exit 1
+       tst_brkm TBROK "sudo cannot be run by user non-interactively"
 fi
 if test ! -f $sudoers
 then
-       echo "root    ALL=(ALL)    ALL" > $sudoers || exit
+       echo "root    ALL=(ALL)    ALL" > $sudoers || tst_brkm TBROK "echo 
'root    ALL=(ALL)    ALL' to $sudoers failed"
        chmod 440 $sudoers
        trap 'trap "" EXIT; nuke_sudoers' EXIT
 fi
@@ -502,8 +492,8 @@ uname -a
 date
 echo "Total tests: $test_num; passed: $passed_cnt; failed: $failed_cnt"
 if test $failed_cnt -gt 0; then
-    echo "Failed tests: $failed_list"
-    exit -1
+       echo "Failed tests: $failed_list"
+       tst_resm TFAIL "test failed"
 fi

-exit
+tst_exit
-- 
1.8.2.2

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to