Tests: Cleanup redundant code and use printing helper functions
[lttng-tools.git] / tests / ust / before-after / run
index 9b165282171a7bbb92fab9888a673170d6ff8873..5f6cc439b862cfb2b347db09f2e83209606a9264 100755 (executable)
@@ -14,6 +14,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+TEST_DESC="UST tracer - Start tracing before and after execution"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../..
@@ -23,9 +24,7 @@ EVENT_NAME="ust_gen_nevents:tptest"
 
 source $TESTDIR/utils.sh
 
-echo -e "\n----------------------------------------------------"
-echo -e "UST tracer - Star tracing before and after execution"
-echo -e "----------------------------------------------------"
+print_test_banner "$TEST_DESC"
 
 if [ ! -x "$CURDIR/gen-nevents" ]; then
        echo -e "No UST nevents binary detected. Passing."
@@ -44,7 +43,8 @@ test_before_apps() {
        # Start test
        echo -n "Starting application... "
        ./$CURDIR/gen-nevents $NR_ITER
-       echo -e "Ended \e[1;32mOK\e[0m"
+       echo -n "Ended "
+       print_ok
        stop_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
@@ -58,7 +58,7 @@ test_after_apps() {
 
        echo -n "Starting application... "
        ./$CURDIR/gen-nevents 100 &
-       echo -e "\e[1;32mOK\e[0m"
+       print_ok
 
        # BEFORE application is spawned
        create_lttng_session $SESSION_NAME $TRACE_PATH
@@ -74,11 +74,11 @@ test_after_apps() {
        out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                echo -n "No event found. Suppose to have at least one... "
-               echo -e "\e[1;31mFAILED\e[0m"
+               print_fail
                out=1
        else
                echo -n "Found $out event(s). Coherent... "
-               echo -e "\e[1;32mOK\e[0m"
+               print_ok
                out=0
        fi
 
This page took 0.02552 seconds and 4 git commands to generate.