Source

cowbel / run-tests

#!/bin/sh
# cowbel test suite
# 
# Written in 2012 by David Given.
#
# To the extent possible under law, the author has dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# Please see the file COPYING.CC0 in the distribution package for more
# information.

for f in \
	test/integer-test.cow \
	test/sort-test.cow \
	test/file-test.cow \
	test/pcre-test.cow \
	test/buffer-test.cow \
	test/set-test.cow \
	test/inference-test.cow \
	test/map-test.cow \
	test/maps-example.cow \
	test/mandelbrot.cow \
	test/failed-inference-test.cow \
	test/bug-more-failed-inference.cow \
	test/generics-test.cow \
	test/extern-test.cow \
	test/incorrect-types-test.cow \
	test/disjoint-types-test.cow \
	test/generics-example.cow \
	test/operators-test.cow \
	test/application-test.cow \
	test/fizzbuzz.cow \
	test/99-bottles.cow \
	test/real-test.cow \
	test/array-test.cow \
	test/assignment-test.cow \
	test/boolean-test.cow \
	test/bug-function-scopes.cow \
	test/bug-inherited-stack-frame.cow \
	test/deep-upvalues-test.cow \
	test/interfaces-test.cow \
	test/life.cow \
	test/linked-list-test.cow \
	test/loop-test.cow \
	test/maybe-test.cow \
	test/object-constructors-test.cow \
	test/string-comparison-test.cow \
	test/type-assignment-test.cow \
;do
	echo $f
	
	logfile=$f.log

	(
		if (./cowbel -q -I include -o out -X-Os -X-lpcre $f) then
			if ! ./out; then
				echo "Exited with $?"
			fi
		fi
		exit 1
	) > $logfile 2>&1

	if ! cmp --quiet $logfile $logfile.pristine; then 		
		echo FAILED
		echo
		diff -u $logfile.pristine $logfile
		exit 1
	fi
	
	rm -f $logfile
done