Tests: Convert the UST high-throughput test output to TAP
[lttng-tools.git] / tests / regression / ust / high-throughput / test_high_throughput
CommitLineData
e72d66a6
DG
1#!/bin/bash
2#
3# Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
4#
5# This library is free software; you can redistribute it and/or modify it under
6# the terms of the GNU Lesser General Public License as published by the Free
7# Software Foundation; version 2.1 of the License.
8#
9# This library is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12# details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this library; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c38b5107 17TEST_DESC="UST tracer - Testing high events throughput"
e72d66a6
DG
18
19CURDIR=$(dirname $0)/
9ac429ef 20TESTDIR=$CURDIR/../../..
6950d621 21NR_APP=20
e72d66a6
DG
22BIN_NAME="gen-events"
23SESSION_NAME="high-throughput"
24EVENT_NAME="tp:tptest"
6950d621 25NUM_TESTS=9
e72d66a6 26
9ac429ef 27source $TESTDIR/utils/utils.sh
e72d66a6 28
c38b5107 29print_test_banner "$TEST_DESC"
e72d66a6 30
8acbe07d 31if [ ! -x "$CURDIR/$BIN_NAME" ]; then
6950d621 32 BAIL_OUT "No UST nevents binary detected."
e72d66a6
DG
33fi
34
35TRACE_PATH=$(mktemp -d)
36
37# MUST set TESTDIR before calling those functions
38
6950d621
CB
39plan_tests $NUM_TESTS
40
fb3268e3 41start_lttng_sessiond
e72d66a6
DG
42
43create_lttng_session $SESSION_NAME $TRACE_PATH
44
45enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
fb3268e3 46start_lttng_tracing $SESSION_NAME
e72d66a6 47
6950d621 48for i in `seq 1 $NR_APP`; do
e72d66a6
DG
49 ./$CURDIR/$BIN_NAME & >/dev/null 2>&1
50done
51
908ee7bd 52while [ -n "$(pidof $BIN_NAME)" ]; do
908ee7bd
DG
53 sleep 0.5
54done
6950d621 55pass "Wait for application end"
e72d66a6 56
fb3268e3 57stop_lttng_tracing $SESSION_NAME
e72d66a6
DG
58destroy_lttng_session $SESSION_NAME
59
fb3268e3 60stop_lttng_sessiond
e72d66a6
DG
61
62# Validate test
63
64TEMP_FILE=$(mktemp)
65TEMP_FILE_2=$(mktemp)
66
67traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
68babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
69
70cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
71
72dropped=0
73while read line;
74do
75 let dropped=$dropped+$line
76done < $TEMP_FILE
77
78let total=$dropped+$traced
6950d621 79let wanted=$NR_APP*1000000
e72d66a6
DG
80
81if [ $wanted -ne $total ]; then
6950d621
CB
82 fail "Trace validation"
83 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
e72d66a6 84else
6950d621
CB
85 pass "Trace validation"
86 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
e72d66a6
DG
87fi
88
89rm -rf $TRACE_PATH
90rm $TEMP_FILE $TEMP_FILE_2
This page took 0.02901 seconds and 4 git commands to generate.