Fix: test cases now rely on explicit workloads
[lttng-tools.git] / tests / stress / launch_ust_app
1 #!/bin/bash
2 #
3 # Copyright (C) - 2013 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
17
18 CURDIR=$(dirname $0)/
19 TESTDIR=$CURDIR/..
20
21 NR_APP=1
22 NR_USEC_WAIT=5000000
23 NR_APP_LOOP=1
24
25 TESTAPP_PATH="$TESTDIR/utils/testapp"
26 TESTAPP_NAME="gen-ust-events"
27 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
28
29 source $TESTDIR/utils/utils.sh
30
31 if [ ! -x "$TESTAPP_BIN" ]; then
32 BAIL_OUT "No UST nevents binary detected."
33 fi
34
35 # Number of application to spawn.
36 if [ -n "$1" ]; then
37 NR_APP=$1
38 fi
39
40 # Number of seconds before the next loop is done in the app.
41 if [ -n "$2" ]; then
42 NR_USEC_WAIT=$(echo $(( $2 * 1000000 )))
43 fi
44
45 # Number of loop the application should do meaning one TP is hit per loop.
46 if [ -n "$3" ]; then
47 NR_APP_LOOP=$3
48 fi
49
50 # MUST set TESTDIR before this point.
51
52 # Infinite loop. Spawns NR_APP apps for NR_USEC_WAIT doing NR_APP_LOOP.
53 while :; do
54 for j in `seq 1 $NR_APP`; do
55 $TESTAPP_BIN $NR_APP_LOOP $NR_USEC_WAIT >/dev/null 2>&1 &
56 done
57 # Wait before the next round of applications.
58 sleep 3
59 done
This page took 0.031702 seconds and 4 git commands to generate.