#!/bin/csh

# This script will run all tests in The Cutpaste Directory.

set TESTS = "Cutpaste1 Cutpaste3"

if (-e ./failures) then
	echo "backing up failures file"
	mv failures failures.bak
endif

rm -f core
touch ./failures

foreach test ($TESTS)
	./$test
	if ($status != 0) then
		if (-e core) then
			echo "backing up core to "$test".core"
			mv core $test.core
		endif
		echo "failure in test: "$test
		echo $test >> failures
	endif
	
end

# 
#	This portion of the script will run the cutpaste2 test. Two
#	copies of the client cutpaste2a will be invoked.  This
#	will test cut/paste interaction between two clients.
#
cp Cutpaste2a Cutpaste2a1
cp Cutpaste2a Cutpaste2a2

Cutpaste2a1 -geometry +0+0 &
Cutpaste2a2 -geometry +0+180 &

Cutpaste2b

rm Cutpaste2a1
rm Cutpaste2a2

# end of Cutpaste2 Test

#	This portion of the script will run the cutpaste4 test. 
#

Cutpaste4b -geometry +372+0 &
Cutpaste4a -geometry +0+0

#
# Kill both copies of client cutpaste4
#

set PS_LINE1=`ps | grep Cutpaste4b | grep -v grep`

set PID1=`echo $PS_LINE1 | cut -d' ' -f1`

kill -9 $PID1

# Run multi and icccm. Since they do not have an instruction box
# more the README file on the window in which we are RUNning.

multi &
multi &
icccm &
more README 

#
# End of script
