A simple testing framework

This commit is contained in:
2017-12-01 15:48:04 +01:00
parent a908284dc6
commit faaedb212d
2 changed files with 123 additions and 0 deletions

27
ttest Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -e
dirs=src/kernel
main()
{
for dir in $dirs; do
local files=`find $dir -name "*.tt"`
for f in $files; do
cp $f $f.c
tests=`sed -n -e 's/^\s*TEST(\([^,]*,\).*$/ttt_\1/p' $f`
echo "tt_test tt_tests[] = {${tests}0};" >> $f.c
outfile=`mktemp`
cc $f.c -o $outfile -ggdb -I $dir/include
$outfile $f
rm $f.c $outfile
done
done
}
main "$@"