Fix: tests: don't use pidof to wait for test apps
[lttng-tools.git] / tests / regression / ust / high-throughput / test_high_throughput
... / ...
CommitLineData
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
17TEST_DESC="UST tracer - Testing high events throughput"
18
19CURDIR=$(dirname $0)/
20TESTDIR=$CURDIR/../../..
21NR_APP=20
22BIN_NAME="gen-events"
23SESSION_NAME="high-throughput"
24EVENT_NAME="tp:tptest"
25NUM_TESTS=9
26
27source $TESTDIR/utils/utils.sh
28
29if [ ! -x "$CURDIR/$BIN_NAME" ]; then
30 BAIL_OUT "No UST nevents binary detected."
31fi
32
33TRACE_PATH=$(mktemp -d)
34
35# MUST set TESTDIR before calling those functions
36
37plan_tests $NUM_TESTS
38
39print_test_banner "$TEST_DESC"
40
41start_lttng_sessiond
42
43create_lttng_session $SESSION_NAME $TRACE_PATH
44
45enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
46start_lttng_tracing $SESSION_NAME
47
48for i in `seq 1 $NR_APP`; do
49 ./$CURDIR/$BIN_NAME & >/dev/null 2>&1
50done
51
52diag "Waiting for applications to end"
53wait
54pass "Wait for applications to end"
55
56stop_lttng_tracing $SESSION_NAME
57destroy_lttng_session $SESSION_NAME
58
59stop_lttng_sessiond
60
61# Validate test
62
63TEMP_FILE=$(mktemp)
64TEMP_FILE_2=$(mktemp)
65
66traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
67babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
68
69cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
70
71dropped=0
72while read line;
73do
74 let dropped=$dropped+$line
75done < $TEMP_FILE
76
77let total=$dropped+$traced
78let wanted=$NR_APP*1000000
79
80if [ $wanted -ne $total ]; then
81 fail "Trace validation"
82 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
83else
84 pass "Trace validation"
85 diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total"
86fi
87
88rm -rf $TRACE_PATH
89rm $TEMP_FILE $TEMP_FILE_2
This page took 0.022677 seconds and 4 git commands to generate.