Commit | Line | Data |
---|---|---|
4d5b973e 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 | 17 | TEST_DESC="UST tracer - Testing low events throughput" |
4d5b973e DG |
18 | |
19 | CURDIR=$(dirname $0)/ | |
9ac429ef | 20 | TESTDIR=$CURDIR/../../.. |
4d5b973e DG |
21 | BIN_NAME="gen-events" |
22 | SESSION_NAME="low-throughput" | |
23 | EVENT_NAME="tp:slow" | |
362e2a1c | 24 | NUM_TESTS=8 |
4d5b973e | 25 | |
9ac429ef | 26 | source $TESTDIR/utils/utils.sh |
4d5b973e | 27 | |
8acbe07d | 28 | if [ ! -x "$CURDIR/$BIN_NAME" ]; then |
362e2a1c | 29 | BAIL_OUT "No UST nevents binary detected." |
4d5b973e DG |
30 | fi |
31 | ||
32 | TRACE_PATH=$(mktemp -d) | |
33 | ||
34 | # MUST set TESTDIR before calling those functions | |
35 | ||
362e2a1c CB |
36 | plan_tests $NUM_TESTS |
37 | ||
e3bef725 CB |
38 | print_test_banner "$TEST_DESC" |
39 | ||
fb3268e3 | 40 | start_lttng_sessiond |
4d5b973e | 41 | |
bf6ae429 | 42 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
4d5b973e | 43 | |
c4926bb5 | 44 | enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME |
e563bbdb | 45 | start_lttng_tracing_ok $SESSION_NAME |
4d5b973e DG |
46 | |
47 | # This is going to take 20 minutes | |
48 | ./$CURDIR/$BIN_NAME >/dev/null 2>&1 | |
49 | ||
fb3268e3 | 50 | stop_lttng_tracing $SESSION_NAME |
4d5b973e DG |
51 | destroy_lttng_session $SESSION_NAME |
52 | ||
fb3268e3 | 53 | stop_lttng_sessiond |
4d5b973e DG |
54 | |
55 | # Validate test | |
56 | ||
57 | last_val=0 | |
58 | out=0 | |
59 | ||
60 | babeltrace $TRACE_PATH | while read event; | |
61 | do | |
62 | val=$(echo $event | cut -f10 -d" ") | |
63 | val=${val%?} | |
64 | th=$(echo $event | cut -f13 -d " ") | |
65 | ||
66 | if [ $th = '"one"' ]; then | |
67 | ((last_val++)) | |
68 | # We expect here a continous value from 1 to 20 | |
69 | if [ $last_val -ne $val ]; then | |
362e2a1c | 70 | diag "One minute event failed ($val)" |
4d5b973e DG |
71 | out=1 |
72 | break | |
73 | fi | |
74 | elif [ $th = '"ten"' ]; then | |
75 | # Test 10 minutes counter | |
76 | if [ $val -ne 10 ]; then | |
77 | # Test 20 minutes counter | |
78 | if [ $val -ne 20 ]; then | |
362e2a1c | 79 | diag "Ten minutes event failed ($val)" |
4d5b973e DG |
80 | out=1 |
81 | break | |
82 | fi | |
83 | fi | |
84 | elif [ $th = '"twenty"' ]; then | |
85 | # Test 20 minutes counter | |
86 | if [ $val -ne 20 ]; then | |
362e2a1c | 87 | diag "Twenty minutes event failed ($val)" |
4d5b973e DG |
88 | out=1 |
89 | break | |
90 | fi | |
91 | fi | |
92 | done | |
93 | ||
362e2a1c | 94 | ok $out "Trace validation" |
4d5b973e DG |
95 | |
96 | rm -rf $TRACE_PATH |