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