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("\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);
|
printf("Ran %d tests in %s\n", i, tt_filename);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if(failures)
|
if(failures)
|
||||||
|
31
ttest
31
ttest
@ -1,28 +1,35 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
dirs=src/kernel
|
dirs=src/kernel
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
failed=0
|
local failures=0
|
||||||
for dir in $dirs; do
|
for dir in $dirs; do
|
||||||
local files=`find $dir -name "*.tt"`
|
local files=`find $dir -name "*.tt"`
|
||||||
for f in $files; do
|
for suite in $files; do
|
||||||
|
|
||||||
cp $f $f.c
|
cp $suite $suite.c
|
||||||
tests=`sed -n -e 's/^\s*TEST(\([^,]*,\).*$/ttt_\1/p' $f`
|
local tests=`sed -n -e 's/^\s*TEST(\([^,]*,\).*$/ttt_\1/p' $suite`
|
||||||
echo "tt_test tt_tests[] = {${tests}0};" >> $f.c
|
echo "tt_test tt_tests[] = {${tests}0};" >> $suite.c
|
||||||
|
|
||||||
outfile=`mktemp`
|
test_exec=`mktemp`
|
||||||
cc $f.c -o $outfile -ggdb -I $dir/include 2>&1 | sed -e 's/\.tt\.c:/\.tt:/'
|
compiler_output=`cc $suite.c -o $test_exec -ggdb -I $dir/include 2>&1`
|
||||||
$outfile $f || failed=1
|
compiler_status=$?
|
||||||
rm $f.c $outfile
|
|
||||||
|
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
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $failed
|
exit $failures
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user