Files
sdk/pkg/dev_compiler/tool/test.sh
T
Bob Nystrom 68dc77f456 Build DDC's SDK as part of the regular build.
This involves a few main pieces:

- Add code to the GN scripts to generate DDC's patched SDK and then
  compile it to summaries and JS in the build output directory.

- Add support to the underlying DDC build scripts to support controlling
  which files are built where.

- Update test.dart to use the DDC SDK from the build directory.

- Update create_sdk to use the built SDK instead of the checked in one.

- Fix various internal DDC tools to build their own copy of the SDK
  (since they can't easily find the one in the build directory because
  it's path if config-specific) and use those.

- Delete the checked DDC SDK JS and summaries.

I think I got everything working. The built Dart SDK looks fine -- it's
identical to one built using the old build scripts.

The various tools and DDC's little test runner I *think* work, but there
may be a bug or two in there. I tried the various things I could and it
seems like they work but it's hard to tell since they may be kind of
broken right now anyway.

Bug:
Change-Id: Iea77915a5c1cc8450f60ebfbdf8c725c7ea2f32c
Reviewed-on: https://dart-review.googlesource.com/18144
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-11-20 23:24:07 +00:00

1.6 KiB
Executable File

#!/bin/bash
set -e # bail on error
 
function fail {
echo -e "Some tests failed"
return 1
}
 
# Some tests require being run from the package root
# switch to the root directory of dev_compiler
cd $( dirname "${BASH_SOURCE[0]}" )/..
 
# Check minimum SDK version
./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail
 
# Delete codegen expectation files to be sure that if a test fails to compile
# we don't erroneously pick up the old version.
if [ -d test/codegen/expect ]; then
rm -r test/codegen/expect || fail
fi
 
if [ -d gen/codegen_input ]; then
rm -r gen/codegen_input || fail
fi
 
if [ -d gen/codegen_output ]; then
rm -r gen/codegen_output || fail
fi
 
# Build the SDK summary in a place where the tests can find it if it's not
# already there.
if [ ! -e gen/sdk/ddc_sdk.sum ]; then
./tool/build_sdk.sh
fi
 
./tool/build_pkgs.dart \
--analyzer-sdk=gen/sdk/ddc_sdk.sum \
--output=gen/codegen_output/pkg
 
# Make sure we don't run tests in code coverage mode.
# this will cause us to generate files that are not part of the baseline
# TODO(jmesserly): we should move diff into Dart code, so we don't need to
# worry about this. Also if we're in code coverage mode, we should avoid running
# all_tests twice. Finally self_host_test is not currently being tracked by
# code coverage.
unset COVERALLS_TOKEN
dart test/all_tests.dart || fail
 
{
fc=`find test -name "*.dart" |\
xargs grep "/\*\S* should be \S*\*/" | wc -l`
echo "There are" $fc "tests marked as known failures."
}
 
echo -e "All tests built - run tool/browser_test.sh to run tests"