docs: Add supported versions and fix-backport policy
[lttng-tools.git] / tests / regression / ust / low-throughput / test_low_throughput
CommitLineData
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 7TEST_DESC="UST tracer - Testing low events throughput"
4d5b973e
DG
8
9CURDIR=$(dirname $0)/
9ac429ef 10TESTDIR=$CURDIR/../../..
4d5b973e
DG
11BIN_NAME="gen-events"
12SESSION_NAME="low-throughput"
13EVENT_NAME="tp:slow"
362e2a1c 14NUM_TESTS=8
4d5b973e 15
9ac429ef 16source $TESTDIR/utils/utils.sh
4d5b973e 17
8acbe07d 18if [ ! -x "$CURDIR/$BIN_NAME" ]; then
362e2a1c 19 BAIL_OUT "No UST nevents binary detected."
4d5b973e
DG
20fi
21
8d5a3312 22TRACE_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
26plan_tests $NUM_TESTS
27
e3bef725
CB
28print_test_banner "$TEST_DESC"
29
c125de8f
FD
30bail_out_if_no_babeltrace
31
fb3268e3 32start_lttng_sessiond
4d5b973e 33
bf6ae429 34create_lttng_session_ok $SESSION_NAME $TRACE_PATH
4d5b973e 35
c4926bb5 36enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
e563bbdb 37start_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 42stop_lttng_tracing_ok $SESSION_NAME
67b4c664 43destroy_lttng_session_ok $SESSION_NAME
4d5b973e 44
fb3268e3 45stop_lttng_sessiond
4d5b973e
DG
46
47# Validate test
48
49last_val=0
50out=0
51
c125de8f 52"$BABELTRACE_BIN" $TRACE_PATH | while read event;
4d5b973e
DG
53do
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
84done
85
362e2a1c 86ok $out "Trace validation"
4d5b973e
DG
87
88rm -rf $TRACE_PATH
This page took 0.066788 seconds and 5 git commands to generate.