tests: Move to kernel style SPDX license identifiers
[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
22TRACE_PATH=$(mktemp -d)
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
fb3268e3 30start_lttng_sessiond
4d5b973e 31
bf6ae429 32create_lttng_session_ok $SESSION_NAME $TRACE_PATH
4d5b973e 33
c4926bb5 34enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
e563bbdb 35start_lttng_tracing_ok $SESSION_NAME
4d5b973e
DG
36
37# This is going to take 20 minutes
38./$CURDIR/$BIN_NAME >/dev/null 2>&1
39
96340a01 40stop_lttng_tracing_ok $SESSION_NAME
67b4c664 41destroy_lttng_session_ok $SESSION_NAME
4d5b973e 42
fb3268e3 43stop_lttng_sessiond
4d5b973e
DG
44
45# Validate test
46
47last_val=0
48out=0
49
50babeltrace $TRACE_PATH | while read event;
51do
52 val=$(echo $event | cut -f10 -d" ")
53 val=${val%?}
54 th=$(echo $event | cut -f13 -d " ")
55
56 if [ $th = '"one"' ]; then
57 ((last_val++))
58 # We expect here a continous value from 1 to 20
59 if [ $last_val -ne $val ]; then
362e2a1c 60 diag "One minute event failed ($val)"
4d5b973e
DG
61 out=1
62 break
63 fi
64 elif [ $th = '"ten"' ]; then
65 # Test 10 minutes counter
66 if [ $val -ne 10 ]; then
67 # Test 20 minutes counter
68 if [ $val -ne 20 ]; then
362e2a1c 69 diag "Ten minutes event failed ($val)"
4d5b973e
DG
70 out=1
71 break
72 fi
73 fi
74 elif [ $th = '"twenty"' ]; then
75 # Test 20 minutes counter
76 if [ $val -ne 20 ]; then
362e2a1c 77 diag "Twenty minutes event failed ($val)"
4d5b973e
DG
78 out=1
79 break
80 fi
81 fi
82done
83
362e2a1c 84ok $out "Trace validation"
4d5b973e
DG
85
86rm -rf $TRACE_PATH
This page took 0.063629 seconds and 5 git commands to generate.