Rename libcommon.so to libcommon-gpl.so
[lttng-tools.git] / tests / stress / kill_relayd
CommitLineData
b3300ee2
DG
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
b3300ee2 4#
9d16b343 5# SPDX-License-Identifier: LGPL-2.1-only
b3300ee2 6#
b3300ee2
DG
7
8CURDIR=$(dirname $0)/
9TESTDIR=$CURDIR/..
10# We use the .libs/ binary since it's run from the repository.
11REPO_RELAYD_BIN="lt-lttng-relayd"
12
13# Number of seconds the we sleep before killing the relayd. If RANDOM_KILL is
14# defined, it's between 1 and 10 seconds.
15NR_SEC=10
16
17KILL_LOOP=0
18RANDOM_KILL=0
19
20source $TESTDIR/utils/utils.sh
21
22function get_random()
23{
24 return $(echo $RANDOM % $NR_SEC + 1 | bc)
25}
26
27function kill_relayd()
28{
29 if [ $RANDOM_KILL -eq 1 ]; then
30 # Something between 1 and NR_SEC seconds.
31 get_random
32 sleep $?
33 else
34 sleep $NR_SEC
35 fi
36 killall -q -9 $REPO_RELAYD_BIN >/dev/null 2>&1
37}
38
39# Do we have to run in an infinite loop ?
40if [ -n "$1" ]; then
41 KILL_LOOP=1
42fi
43
44# Should it be a random kill or not ?
45if [ -n "$2" ]; then
46 RANDOM_KILL=1
47fi
48
49# MUST set TESTDIR before this point.
50
51if [ $KILL_LOOP -eq 0 ]; then
52 kill_relayd
53else
54 while :; do
55 kill_relayd
56 done
57fi
This page took 0.040043 seconds and 4 git commands to generate.