Fix: tests: wait output hide Terminate errors
[lttng-tools.git] / tests / regression / ust / nprocesses / test_nprocesses
CommitLineData
d3e8f6bb
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
21dee66a
CB
17NUM_PROCESS=30
18TEST_DESC="UST tracer - Generate $NUM_PROCESS process"
d3e8f6bb 19
ec8f26de 20CURDIR=$(dirname $0)/
9ac429ef 21TESTDIR=$CURDIR/../../..
0fc2834c 22NR_ITER=-1 # infinite loop
21dee66a
CB
23NR_USEC_WAIT=1000000
24TESTAPP_PATH="$TESTDIR/utils/testapp"
25TESTAPP_NAME="gen-ust-events"
26TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
4220447f 27SESSION_NAME="ust-nprocesses"
21dee66a 28EVENT_NAME="tp:tptest"
4220447f
CB
29TEST_WAIT_SEC=5
30NUM_TESTS=9
0fc2834c 31APPS_PID=
d3e8f6bb 32
9ac429ef 33source $TESTDIR/utils/utils.sh
d3e8f6bb 34
21dee66a
CB
35if [ ! -x "$TESTAPP_BIN" ]; then
36 BAIL_OUT "No UST $TESTAPP_BIN binary detected."
ec8f26de
DG
37fi
38
d3e8f6bb
DG
39# MUST set TESTDIR before calling those functions
40
4220447f
CB
41plan_tests $NUM_TESTS
42
e3bef725
CB
43print_test_banner "$TEST_DESC"
44
fb3268e3 45start_lttng_sessiond
d3e8f6bb 46
0fc2834c 47# Start tests. Each is an infinite tracing loop.
d3e8f6bb 48
0fc2834c 49diag "Starting $NUM_PROCESS test applications"
21dee66a 50for i in `seq 1 $NUM_PROCESS`
4220447f 51do
21dee66a 52 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
0fc2834c 53 APPS_PID="${APPS_PID} ${!}"
4220447f
CB
54done
55
c7613334
MD
56#FIXME: racy missing synchronization
57
0fc2834c
MD
58diag "Waiting for applications to be registered to sessiond"
59
7972aab2 60reg_app_count=0
21dee66a 61while [ $reg_app_count -ne $NUM_PROCESS ]; do
7972aab2 62 listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
21dee66a 63 reg_app_count=$(echo -n $listing | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep "$TESTAPP_BIN" | wc -l)
7972aab2 64done
4220447f 65
0fc2834c 66pass "All applications are registered to sessiond"
4220447f
CB
67
68TRACE_PATH=$(mktemp -d)
69
70create_lttng_session $SESSION_NAME $TRACE_PATH
71
72enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
73start_lttng_tracing $SESSION_NAME
d3e8f6bb 74
0fc2834c
MD
75# We don't validate whether the applications have traced here, rather
76# just that they registered to sessiond (above).
4220447f
CB
77
78stop_lttng_tracing $SESSION_NAME
79destroy_lttng_session $SESSION_NAME
80
c7613334
MD
81#FIXME/TODO: add validation after fixing racy synchroniaation
82
4220447f
CB
83rm -rf $TRACE_PATH
84
5dca3876 85diag "Stopping all spawned applications"
0fc2834c
MD
86for p in ${APPS_PID}; do
87 kill ${p}
88 wait ${p} 2>/dev/null
89done
c7613334 90APPS_PID=
5dca3876 91pass "Stopped all spawned applications"
4220447f
CB
92
93stop_lttng_sessiond
This page took 0.051685 seconds and 4 git commands to generate.