Commit | Line | Data |
---|---|---|
4d5b973e DG |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2012 David Goulet <dgoulet@efficios.com> |
4d5b973e | 4 | # |
9d16b343 MJ |
5 | # SPDX-License-Identifier: LGPL-2.1-only |
6 | ||
c38b5107 | 7 | TEST_DESC="UST tracer - Testing low events throughput" |
4d5b973e DG |
8 | |
9 | CURDIR=$(dirname $0)/ | |
9ac429ef | 10 | TESTDIR=$CURDIR/../../.. |
4d5b973e DG |
11 | BIN_NAME="gen-events" |
12 | SESSION_NAME="low-throughput" | |
13 | EVENT_NAME="tp:slow" | |
362e2a1c | 14 | NUM_TESTS=8 |
4d5b973e | 15 | |
9ac429ef | 16 | source $TESTDIR/utils/utils.sh |
4d5b973e | 17 | |
8acbe07d | 18 | if [ ! -x "$CURDIR/$BIN_NAME" ]; then |
362e2a1c | 19 | BAIL_OUT "No UST nevents binary detected." |
4d5b973e DG |
20 | fi |
21 | ||
8d5a3312 | 22 | TRACE_PATH=$(mktemp -d -t tmp.test_low_throughput_ust_trace_path.XXXXXX) |
4d5b973e DG |
23 | |
24 | # MUST set TESTDIR before calling those functions | |
25 | ||
362e2a1c CB |
26 | plan_tests $NUM_TESTS |
27 | ||
e3bef725 CB |
28 | print_test_banner "$TEST_DESC" |
29 | ||
c125de8f FD |
30 | bail_out_if_no_babeltrace |
31 | ||
fb3268e3 | 32 | start_lttng_sessiond |
4d5b973e | 33 | |
bf6ae429 | 34 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
4d5b973e | 35 | |
c4926bb5 | 36 | enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME |
e563bbdb | 37 | start_lttng_tracing_ok $SESSION_NAME |
4d5b973e DG |
38 | |
39 | # This is going to take 20 minutes | |
40 | ./$CURDIR/$BIN_NAME >/dev/null 2>&1 | |
41 | ||
96340a01 | 42 | stop_lttng_tracing_ok $SESSION_NAME |
67b4c664 | 43 | destroy_lttng_session_ok $SESSION_NAME |
4d5b973e | 44 | |
fb3268e3 | 45 | stop_lttng_sessiond |
4d5b973e DG |
46 | |
47 | # Validate test | |
48 | ||
49 | last_val=0 | |
50 | out=0 | |
51 | ||
c125de8f | 52 | "$BABELTRACE_BIN" $TRACE_PATH | while read event; |
4d5b973e DG |
53 | do |
54 | val=$(echo $event | cut -f10 -d" ") | |
55 | val=${val%?} | |
56 | th=$(echo $event | cut -f13 -d " ") | |
57 | ||
58 | if [ $th = '"one"' ]; then | |
59 | ((last_val++)) | |
60 | # We expect here a continous value from 1 to 20 | |
61 | if [ $last_val -ne $val ]; then | |
362e2a1c | 62 | diag "One minute event failed ($val)" |
4d5b973e DG |
63 | out=1 |
64 | break | |
65 | fi | |
66 | elif [ $th = '"ten"' ]; then | |
67 | # Test 10 minutes counter | |
68 | if [ $val -ne 10 ]; then | |
69 | # Test 20 minutes counter | |
70 | if [ $val -ne 20 ]; then | |
362e2a1c | 71 | diag "Ten minutes event failed ($val)" |
4d5b973e DG |
72 | out=1 |
73 | break | |
74 | fi | |
75 | fi | |
76 | elif [ $th = '"twenty"' ]; then | |
77 | # Test 20 minutes counter | |
78 | if [ $val -ne 20 ]; then | |
362e2a1c | 79 | diag "Twenty minutes event failed ($val)" |
4d5b973e DG |
80 | out=1 |
81 | break | |
82 | fi | |
83 | fi | |
84 | done | |
85 | ||
362e2a1c | 86 | ok $out "Trace validation" |
4d5b973e DG |
87 | |
88 | rm -rf $TRACE_PATH |