bfin: remove inline keyword
[xenomai-head.git] / src / testsuite / xeno-test / dohell
blobfae48b6461ef86fd78369236db7862f61a31afca
1 #! /bin/sh
3 usage() {
4 cat <<EOF
5 $0 [ -b path ] [ -s server ] [ -p port ] [ -m mntpoint ] [ -l path | seconds ]
7 Generate load, using an assorted set of commands and optionally:
8 - hackbench if the path to the hackbench binary is specified with -b;
9 - nc to send TCP data to "server" port "port" if -s is specified (if -p
10 is not specified, the port 9, aka discard is used);
11 - dd to write data under "mntpoint" if -m is specified.
13 during the runtime of the LTP test if the path to the LTP installation
14 directory is specifed with -l or during "seconds" seconds.
15 EOF
18 port=9
19 while [ $# -gt 0 ]; do
20 case $1 in
21 -h|--help) usage
22 exit 0;;
23 -b) shift; hackbench="$1"; shift
25 -s) shift; server="$1"; shift
27 -p) shift; port="$1"; shift
29 -m) shift; mntpoint="$1"; shift
31 -l) shift; ltpdir="$1"; shift
33 -*) usage
34 exit 1;;
35 *) break;;
36 esac
37 done
39 if [ -z "$ltpdir" -a $# -ne 1 ]; then
40 usage
41 exit 1
44 pids=""
46 if [ -n "$server" ]; then
47 if type nc > /dev/null 2>&1; then
48 nc=nc
49 elif type netcat > /dev/null 2>&1; then
50 nc=netcat
51 else
52 echo netcat or nc not found
53 exit 1
56 seq 1 399999 > /tmp/netcat.data
57 ( while :; do cat /tmp/netcat.data; sleep 15; done | $nc $server $port ) &
58 pids="$!"
61 if [ -n "$mntpoint" ]; then
62 while :; do dd if=/dev/zero of=$mntpoint/bigfile bs=1024000 count=100; done &
63 pids="$pids $!"
66 if [ -n "$hackbench" ]; then
67 while :; do $hackbench 1; done &
68 pids="$pids $!"
71 while :; do cat /proc/interrupts; done > /dev/null 2>&1 &
72 pids="$pids $!"
74 while :; do ps w; done > /dev/null 2>&1 &
75 pids="$pids $!"
77 dd if=/dev/zero of=/dev/null &
78 pids="$pids $!"
80 while :; do ls -lR / > /dev/null 2>&1; done &
81 pids="$pids $!"
83 test -e /proc/sys/kernel/hung_task_timeout_secs && \
84 echo 0 > /proc/sys/kernel/hung_task_timeout_secs
86 if [ -n "$ltpdir" ]; then
87 cd "$ltpdir" && ./runalltests.sh
88 cd "$ltpdir" && ./runalltests.sh
89 else
90 sleep $1
93 kill $pids > /dev/null 2>&1
94 sleep 5
95 killall -KILL cat $nc dd hackbench ls ps > /dev/null 2>&1
96 killall -KILL `basename $0` sleep > /dev/null 2>&1