| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) - 2012 David Goulet <dgoulet@efficios.com> |
| 4 | # |
| 5 | # This library is free software; you can redistribute it and/or modify it under |
| 6 | # the terms of the GNU Lesser General Public License as published by the Free |
| 7 | # Software Foundation; version 2.1 of the License. |
| 8 | # |
| 9 | # This library is distributed in the hope that it will be useful, but WITHOUT |
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 12 | # details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU Lesser General Public License |
| 15 | # along with this library; if not, write to the Free Software Foundation, Inc., |
| 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | |
| 18 | CURDIR=$(dirname $0)/ |
| 19 | TESTDIR=$CURDIR/.. |
| 20 | NR_ITER=100 |
| 21 | SESSION_NAME="ust-nevents" |
| 22 | EVENT_NAME="ust_gen_nevents:tptest" |
| 23 | |
| 24 | source $TESTDIR/utils.sh |
| 25 | |
| 26 | echo -e "\n-----------------------------------" |
| 27 | echo -e "UST tracer - Generate $NR_ITER events" |
| 28 | echo -e "-------------------------------------" |
| 29 | |
| 30 | if [ ! -e "$CURDIR/gen-nevents" ]; then |
| 31 | echo -e "No UST nevents binary detected. Passing." |
| 32 | exit 0 |
| 33 | fi |
| 34 | |
| 35 | TRACE_PATH=$(mktemp -d) |
| 36 | |
| 37 | # MUST set TESTDIR before calling those functions |
| 38 | |
| 39 | create_lttng_session $SESSION_NAME $TRACE_PATH |
| 40 | |
| 41 | enable_ust_lttng_event $SESSION_NAME $EVENT_NAME |
| 42 | start_tracing $SESSION_NAME |
| 43 | |
| 44 | # Start test |
| 45 | ./$CURDIR/gen-nevents $NR_ITER |
| 46 | |
| 47 | stop_tracing $SESSION_NAME |
| 48 | destroy_lttng_session $SESSION_NAME |
| 49 | |
| 50 | trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH |
| 51 | |
| 52 | rm -rf $TRACE_PATH |