Tests: use babeltrace2 for all tests
[lttng-tools.git] / tests / regression / ust / high-throughput / test_high_throughput
1 #!/bin/bash
2 #
3 # Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
6
7 TEST_DESC="UST tracer - Testing high events throughput"
8
9 CURDIR=$(dirname $0)/
10 TESTDIR=$CURDIR/../../..
11 NR_APP=20
12 BIN_NAME="gen-events"
13 SESSION_NAME="high-throughput"
14 EVENT_NAME="tp:tptest"
15 NUM_TESTS=9
16
17 source $TESTDIR/utils/utils.sh
18
19 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
20 BAIL_OUT "No UST nevents binary detected."
21 fi
22
23 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_high_throughput_ust_trace_path.XXXXXX)
24
25 # MUST set TESTDIR before calling those functions
26
27 plan_tests $NUM_TESTS
28
29 print_test_banner "$TEST_DESC"
30
31 bail_out_if_no_babeltrace
32
33 start_lttng_sessiond
34
35 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
36
37 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
38 start_lttng_tracing_ok $SESSION_NAME
39
40 for i in `seq 1 $NR_APP`; do
41 ./$CURDIR/$BIN_NAME >/dev/null 2>&1 &
42 done
43
44 diag "Waiting for applications to end"
45 wait
46 pass "Wait for applications to end"
47
48 stop_lttng_tracing_ok $SESSION_NAME
49 destroy_lttng_session_ok $SESSION_NAME
50
51 stop_lttng_sessiond
52
53 # Validate test
54
55 TEMP_FILE=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file1.XXXXXX)
56 TEMP_FILE_2=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file2.XXXXXX)
57
58 traced=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
59 "$BABELTRACE_BIN" $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
60
61 cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
62
63 dropped=0
64 while read line;
65 do
66 let dropped=$dropped+$line
67 done < $TEMP_FILE
68
69 let total=$dropped+$traced
70 let wanted=$NR_APP*1000000
71
72 if [ $wanted -ne $total ]; then
73 fail "Trace validation"
74 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
75 else
76 pass "Trace validation"
77 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
78 fi
79
80 rm -rf $TRACE_PATH
81 rm $TEMP_FILE $TEMP_FILE_2
This page took 0.031254 seconds and 4 git commands to generate.