1#!/bin/bash
2
3# Copyright (C) 2004 Dan Carpenter
4# This software is released under the terms of the GPL
5
6SLEEP_SECS=1
7SEGV_SECS=4
8
9if ps | grep -q tty ; then
10	delim='t'
11	tty="tty"
12else
13	delim='p'
14	tty="pts"
15fi
16
17secs=0
18while true ; do
19        # fixme (hack) assumes tests in test/ dir
20        # assumes ltp naming scheme with a number on the
21        # end of each test script
22	for i in `ps x | \
23                  grep test | \
24                  grep [0-9]$ | \
25                  cut -d $delim -f 1` ; do
26		if [ $secs -eq $SEGV_SECS ] ; then
27			kill -SEGV $i
28		else
29			kill -CONT $i
30		fi
31	done
32	if [ $secs -ge $SEGV_SECS ] ; then
33		secs=0
34	else
35		secs=$(($secs + 1))
36	fi
37
38	sleep $SLEEP_SECS
39done
40