Handle compilation errors of tests
This commit is contained in:
parent
96849d6600
commit
e50fbff2d1
@ -116,7 +116,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("%s----------------------------------------%s\n", TT_CLR_BLU, TT_CLR_RES);
|
||||
/* printf("%s----------------------------------------%s\n", TT_CLR_BLU, TT_CLR_RES); */
|
||||
printf("Ran %d tests in %s\n", i, tt_filename);
|
||||
free(buffer);
|
||||
if(failures)
|
||||
|
31
ttest
31
ttest
@ -1,28 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
dirs=src/kernel
|
||||
|
||||
main()
|
||||
{
|
||||
failed=0
|
||||
local failures=0
|
||||
for dir in $dirs; do
|
||||
local files=`find $dir -name "*.tt"`
|
||||
for f in $files; do
|
||||
for suite 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
|
||||
cp $suite $suite.c
|
||||
local tests=`sed -n -e 's/^\s*TEST(\([^,]*,\).*$/ttt_\1/p' $suite`
|
||||
echo "tt_test tt_tests[] = {${tests}0};" >> $suite.c
|
||||
|
||||
outfile=`mktemp`
|
||||
cc $f.c -o $outfile -ggdb -I $dir/include 2>&1 | sed -e 's/\.tt\.c:/\.tt:/'
|
||||
$outfile $f || failed=1
|
||||
rm $f.c $outfile
|
||||
test_exec=`mktemp`
|
||||
compiler_output=`cc $suite.c -o $test_exec -ggdb -I $dir/include 2>&1`
|
||||
compiler_status=$?
|
||||
|
||||
echo -e "\x1b[35m$suite\x1b[0m"
|
||||
if [[ "$compiler_status" -eq "0" ]]; then
|
||||
$test_exec $suite || failures=$(($failures + 1))
|
||||
else
|
||||
failures=$(($failures + 1))
|
||||
echo -e "\x1b[31mCOMPILATION OF SUITE FAILED\x1b[0m"
|
||||
echo "$compiler_output" | sed -e 's/\.tt\.c:/\.tt:/'
|
||||
fi
|
||||
rm -f $suite.c $test_exec
|
||||
done
|
||||
done
|
||||
|
||||
exit $failed
|
||||
exit $failures
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user