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