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 | 18 | CURDIR=$(dirname $0)/ |
355f483d DG |
19 | TESTDIR=$CURDIR/../.. |
20 | NR_ITER=$1 | |
b6ca8ef5 DG |
21 | TEST_BIN_NAME="gen-events-time" |
22 | SESSION_NAME="ust-nprocesses" | |
23 | EVENT_NAME="ust_gen_event:tptest" | |
82541c34 | 24 | TEST_WAIT_SEC=5 |
b6ca8ef5 DG |
25 | |
26 | source $TESTDIR/utils.sh | |
27 | ||
b6ca8ef5 DG |
28 | # MUST set TESTDIR before calling those functions |
29 | ||
30 | # Start test for 1000 seconds | |
31 | ||
32 | for i in `seq 1 $NR_ITER` | |
33 | do | |
ec8f26de | 34 | ./$CURDIR/$TEST_BIN_NAME 1000 >/dev/null 2>&1 & |
b6ca8ef5 DG |
35 | done |
36 | ||
0e82bf23 DG |
37 | echo -n "Validating registered apps in 3 seconds..." |
38 | ||
39 | sleep 3 | |
b6ca8ef5 | 40 | |
10a8a223 | 41 | listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u) |
b6ca8ef5 DG |
42 | reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l) |
43 | if [ "$reg_app_count" -ne "$NR_ITER" ]; then | |
c38b5107 CB |
44 | echo -e "$reg_app_count apps listed. Expected $NR_ITER " |
45 | print_fail | |
b6ca8ef5 | 46 | else |
c38b5107 | 47 | print_ok |
b6ca8ef5 DG |
48 | fi |
49 | ||
ec8f26de DG |
50 | TRACE_PATH=$(mktemp -d) |
51 | ||
b6ca8ef5 DG |
52 | create_lttng_session $SESSION_NAME $TRACE_PATH |
53 | ||
54 | enable_ust_lttng_event $SESSION_NAME $EVENT_NAME | |
fb3268e3 | 55 | start_lttng_tracing $SESSION_NAME |
b6ca8ef5 DG |
56 | |
57 | echo "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" | |
fcc371d7 | 58 | echo "Warning: this arbitrary time can make the test fail on slower system" |
b6ca8ef5 DG |
59 | sleep $TEST_WAIT_SEC |
60 | ||
fb3268e3 | 61 | stop_lttng_tracing $SESSION_NAME |
b6ca8ef5 DG |
62 | destroy_lttng_session $SESSION_NAME |
63 | ||
64 | rm -rf $TRACE_PATH | |
65 | ||
66 | echo -e -n "Killing all spawned applications..." | |
67 | killall -q $TEST_BIN_NAME >/dev/null 2>&1 & | |
c38b5107 | 68 | print_ok |
b6ca8ef5 | 69 | exit 0 |