testsuite: add options separator to xeno-regression-test
[xenomai-head.git] / src / testsuite / xeno-test / dohell
blob918da8a4cdb71456ab9fe09aada98a769c901958
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 optionnaly:
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
16 }
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
24 ;;
25 -s) shift; server="$1"; shift
26 ;;
27 -p) shift; port="$1"; shift
28 ;;
29 -m) shift; mntpoint="$1"; shift
30 ;;
31 -l) shift; ltpdir="$1"; shift
32 ;;
33 -*) usage
34 exit 1;;
35 *) break;;
36 esac
37 done
39 if [ -z "$ltpdir" -a $# -ne 1 ]; then
40 usage
41 exit 1
42 fi
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
54 fi
56 seq 1 399999 > /tmp/netcat.data
57 ( while :; do cat /tmp/netcat.data; sleep 15; done | $nc $server $port ) &
58 pids="$!"
59 fi
61 if [ -n "$mntpoint" ]; then
62 while :; do dd if=/dev/zero of=$mntpoint/bigfile bs=1024000 count=100; done &
63 pids="$pids $!"
64 fi
66 if [ -n "$hackbench" ]; then
67 while :; do $hackbench 1; done &
68 pids="$pids $!"
69 fi
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
91 fi
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