Files
sdk/pkg/dev_compiler/test/test.sh
T
Leaf Petersen 89da130295 More typechecker tests, support for failing tests
This CL adds support for marking tests as known failures using the following syntax:

/*expectation1::shouldbe::expectation2*/

where expectation is either "level:StaticInfo" as before, or "pass".

The meaning is that the test is currently exhibiting incorrect behavior expectation1, but should exhibit behavior expectation2.

The test will succeed so long as expectation1 is matched, but a summary of the number of "shouldbe" expectations is printed at the end of running the test script.  Currently this is just implemented as grep, we can make this fancier eventually.

I'm not particularly attached to the syntax, feel free to suggest alternatives.

This CL also adds a bunch of fairly mechanical tests of subtyping, a number of which we are definitely failing, and some of which we may or may not be failing depending on where we wish to insert automatic fixup code.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/129027013
2014-12-16 10:30:13 -08:00

1.3 KiB
Executable File

#!/bin/bash
set -e # bail on error
 
function fail {
echo -e "Some tests failed"
return 1
}
 
function show_diff {
echo "Fail: actual output did not match expected"
echo
diff -u -r -N $1 $2 |\
sed -e "s/^\(+.*\)/\1/" |\
sed -e "s/^\(-.*\)/\1/"
echo
echo "You can update these expectations with:"
echo "$ pushd $TEST_DIR/codegen"
echo "$ cp -a actual/* expect"
echo "$ popd"
fail
}
 
# the directory of this script
TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd )
 
# Some tests require being run from the package root
pushd $TEST_DIR/.. &> /dev/null
 
# Remove packages symlinks, and old codegen output
find test/codegen -name packages -exec rm {} \;
rm -r test/codegen/actual > /dev/null || true
dart -c test/all_tests.dart || fail
 
# validate codegen_test output
pushd test/codegen/ &> /dev/null
diff -u -r -N expect actual > /dev/null || show_diff expect actual
popd &> /dev/null
 
# run self host and analyzer after other tests, because they're ~seconds to run.
dart -c test/checker/self_host_test.dart || fail
 
ls lib/*.dart bin/*.dart | dartanalyzer -b --fatal-warnings || fail
{
fc=`find test -name "*.dart" |\
xargs grep "/\*\S* should be \S*\*/" | wc -l`
echo "There are" $fc "tests marked as known failures."
}
popd &> /dev/null
 
echo -e "All tests pass"