X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fust%2Fmulti-session%2Frun;fp=tests%2Fust%2Fmulti-session%2Frun;h=f6dab7c65a3b5142c1028a56c99a29f3d908e777;hb=00eb21af5e9148b9711b29fdfe62ee8c0b9739f9;hp=0000000000000000000000000000000000000000;hpb=04fdd819f0eebfd15a4196a9ca98e826352a9b4f;p=lttng-tools.git diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run new file mode 100755 index 000000000..f6dab7c65 --- /dev/null +++ b/tests/ust/multi-session/run @@ -0,0 +1,92 @@ +#!/bin/bash +# +# Copyright (C) - 2012 David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# 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 + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +NR_ITER=100 +SESSION_NAME="multi-session" +EVENT_NAME="ust_gen_nevents:tptest" + +source $TESTDIR/utils.sh + +echo -e "\n--------------------------" +echo -e "UST tracer - Multi-session" +echo -e "--------------------------" + +if [ ! -x "$CURDIR/gen-nevents" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +# MUST set TESTDIR before calling those functions + +test_multi_session() { + local out + + # BEFORE application is spawned + for i in `seq 0 3`; do + create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" + enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" + start_tracing "$SESSION_NAME-$i" + done + + echo -n "Starting application generating $NR_ITER events... " + ./$CURDIR/gen-nevents $NR_ITER & + echo -e "\e[1;32mOK\e[0m" + + # At least hit one event + echo -n "Waiting for events to record " + while [ -n "$(pidof gen-nevents)" ]; do + echo -n "." + sleep 0.1 + done + echo -e "\e[1;32m OK\e[0m" + + for i in `seq 0 3`; do + stop_tracing "$SESSION_NAME-$i" + destroy_lttng_session "$SESSION_NAME-$i" + out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) + if [ $out -ne $NR_ITER ]; then + echo -n "No event found. Suppose to have at least one... " + echo -e "\e[1;31mFAILED\e[0m" + out=1 + else + echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... " + echo -e "\e[1;32mOK\e[0m" + out=0 + fi + done + + return $out +} + +# MUST set TESTDIR before calling those functions + +start_sessiond + +TRACE_PATH=$(mktemp -d) + +test_multi_session +out=$? +if [ $out -ne 0 ]; then + stop_sessiond + exit $out +fi + +stop_sessiond + +rm -rf "$TRACE_PATH"