Commit | Line | Data |
---|---|---|
b6ca8ef5 DG |
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 | ||
ec8f26de DG |
18 | CURDIR=$(dirname $0)/ |
19 | TESTDIR=$CURDIR/.. | |
b6ca8ef5 DG |
20 | NR_ITER=100 |
21 | TEST_BIN_NAME="gen-events-time" | |
22 | SESSION_NAME="ust-nprocesses" | |
23 | EVENT_NAME="ust_gen_event:tptest" | |
b6ca8ef5 DG |
24 | TEST_WAIT_SEC=3 |
25 | ||
26 | source $TESTDIR/utils.sh | |
27 | ||
28 | echo -e "\n-------------------------------------" | |
29 | echo -e "UST tracer - Generate $NR_ITER process" | |
30 | echo -e "---------------------------------------" | |
31 | ||
ec8f26de DG |
32 | if [ ! -e "$CURDIR/$TEST_BIN_NAME" ]; then |
33 | echo -e "No UST $TEST_BIN_NAME binary detected. Passing." | |
34 | exit 0 | |
35 | fi | |
36 | ||
b6ca8ef5 DG |
37 | # MUST set TESTDIR before calling those functions |
38 | ||
39 | # Start test for 1000 seconds | |
40 | ||
41 | for i in `seq 1 $NR_ITER` | |
42 | do | |
ec8f26de | 43 | ./$CURDIR/$TEST_BIN_NAME 1000 >/dev/null 2>&1 & |
b6ca8ef5 DG |
44 | done |
45 | ||
46 | echo -n "Validating registered apps: " | |
47 | ||
10a8a223 | 48 | listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u) |
b6ca8ef5 DG |
49 | reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l) |
50 | if [ "$reg_app_count" -ne "$NR_ITER" ]; then | |
51 | echo -e "$reg_app_count apps listed. Expected $NR_ITER \e[1;31mFAILED\e[0m" | |
52 | else | |
53 | echo -e "\e[1;32mOK\e[0m" | |
54 | fi | |
55 | ||
ec8f26de DG |
56 | TRACE_PATH=$(mktemp -d) |
57 | ||
b6ca8ef5 DG |
58 | create_lttng_session $SESSION_NAME $TRACE_PATH |
59 | ||
60 | enable_ust_lttng_event $SESSION_NAME $EVENT_NAME | |
61 | start_tracing $SESSION_NAME | |
62 | ||
63 | echo "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" | |
64 | sleep $TEST_WAIT_SEC | |
65 | ||
66 | stop_tracing $SESSION_NAME | |
67 | destroy_lttng_session $SESSION_NAME | |
68 | ||
69 | rm -rf $TRACE_PATH | |
70 | ||
71 | echo -e -n "Killing all spawned applications..." | |
72 | killall -q $TEST_BIN_NAME >/dev/null 2>&1 & | |
73 | echo -e "\e[1;32mOK\e[0m" | |
74 | exit 0 |