Commit | Line | Data |
---|---|---|
d3e8f6bb 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 | |
c38b5107 CB |
17 | NR_ITER=100 |
18 | TEST_DESC="UST tracer - Generate $NR_ITER process" | |
d3e8f6bb | 19 | |
ec8f26de | 20 | CURDIR=$(dirname $0)/ |
9ac429ef | 21 | TESTDIR=$CURDIR/../../.. |
8acbe07d | 22 | TEST_BIN_NAME="gen-events-time" |
4220447f CB |
23 | SESSION_NAME="ust-nprocesses" |
24 | EVENT_NAME="ust_gen_event:tptest" | |
25 | TEST_WAIT_SEC=5 | |
26 | NUM_TESTS=9 | |
d3e8f6bb | 27 | |
9ac429ef | 28 | source $TESTDIR/utils/utils.sh |
d3e8f6bb | 29 | |
c38b5107 | 30 | print_test_banner "$TEST_DESC" |
d3e8f6bb | 31 | |
8acbe07d | 32 | if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then |
4220447f | 33 | BAIL_OUT "No UST $TEST_BIN_NAME binary detected." |
ec8f26de DG |
34 | fi |
35 | ||
d3e8f6bb DG |
36 | # MUST set TESTDIR before calling those functions |
37 | ||
4220447f CB |
38 | plan_tests $NUM_TESTS |
39 | ||
fb3268e3 | 40 | start_lttng_sessiond |
d3e8f6bb | 41 | |
4220447f | 42 | # Start test for 1000 seconds |
d3e8f6bb | 43 | |
4220447f CB |
44 | for i in `seq 1 $NR_ITER` |
45 | do | |
46 | ./$CURDIR/$TEST_BIN_NAME 1000 >/dev/null 2>&1 & | |
47 | done | |
48 | ||
49 | sleep 3 | |
50 | ||
51 | listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u) | |
52 | reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l) | |
53 | if [ "$reg_app_count" -ne "$NR_ITER" ]; then | |
54 | fail "Trace validation" | |
55 | diag "$reg_app_count apps listed. Expected $NR_ITER " | |
56 | else | |
57 | pass "Trace validation" | |
58 | fi | |
59 | ||
60 | TRACE_PATH=$(mktemp -d) | |
61 | ||
62 | create_lttng_session $SESSION_NAME $TRACE_PATH | |
63 | ||
64 | enable_ust_lttng_event $SESSION_NAME $EVENT_NAME | |
65 | start_lttng_tracing $SESSION_NAME | |
d3e8f6bb | 66 | |
4220447f CB |
67 | diag "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" |
68 | diag "Warning: this arbitrary time can make the test fail on slower system" | |
69 | ||
70 | sleep $TEST_WAIT_SEC | |
71 | ||
72 | stop_lttng_tracing $SESSION_NAME | |
73 | destroy_lttng_session $SESSION_NAME | |
74 | ||
75 | rm -rf $TRACE_PATH | |
76 | ||
77 | # Send SIGPIPE to 'silence' bash process status such as "Process as terminated" | |
78 | killall -s PIPE -q $TEST_BIN_NAME >/dev/null 2>&1 | |
79 | ||
80 | pass "Kill all spawned applications" | |
81 | ||
82 | stop_lttng_sessiond |