Files
sdk/pkg/kernel
Asger Feldthaus 2e718613aa Add 'self_check' runtime for running self-checking unit tests
Some of the kernel unit tests can now be run using:

  tools/test.py -cdartk -rself_check language co19

This will search the pkg/ folder for files matching *_self_check.dart
and run each program with the compiled output as argument. If there is
no compiler, the test case itself is given as argument. These testers
are always run in batch-mode.

This type of test has no expected output, but is intended to check
itself by testing that certain invariants are not violated while
processing the given data set.

The 'self_check' runtime is not specifically tied to kernel,
although only kernel is using it at the moment.

There is also a new option --skip-compilation which skips the
compiler step.  It doesn't interact nicely with the status files,
but can still be useful for a quick offline test.

Current limitations:
- All self-check tests are treated as the same test case. If one fails,
  the remaining self-check testers don't run for that input.
- There is no way to run a subset of the self-check tests, or filter
  them based on what compiler was used.
- Tests that are expected to fail in the compiler show up as
  errors when skipping compilation.

BUG=
R=kustermann@google.com, whesse@google.com

Review-Url: https://codereview.chromium.org/2549793002 .
2016-12-15 13:07:03 +01:00
..
2016-11-30 12:26:03 +01:00

Dart Kernel

Dart Kernel is a small high-level language derived from Dart. It is designed for use as an intermediate format for whole-program analysis and transformations, and as a frontend for codegen and execution backends.

The kernel language has in-memory representations in Dart and C++, and can be serialized as binary or text.

Both the kernel language and its implementations are unstable and are under development.

This package contains the Dart part of the implementation and contains:

  • A transformable IR for the kernel language
  • A frontend based on the analyzer
  • Serialization of kernel code

Getting Kernel

Checkout the repository and run pub get:

git clone https://github.com/dart-lang/kernel
cd kernel
pub get

Command-Line Tool

Run bin/dartk.dart from the command-line to convert between .dart files and the serialized binary and textual formats.

dartk expects the .dill extension for files in the binary format. The textual format has no preferred extension right now.

Example commands:

dartk foo.dart            # print text IR for foo.dart
dartk foo.dart -ofoo.dill # write binary IR for foo.dart to foo.dill
dartk foo.dill            # print text IR for binary file foo.dill

Pass the --link or -l flag to link all transitive dependencies into one file:

dartk myapp.dart -ppackages -l -omyapp.dill # Bundle everything.
dartk myapp.dill # Print it back out in a (very, very long) textual format.

See ast.dart for the in-memory IR, or binary.md for a description of the binary format. For now, the textual format is very ad-hoc and cannot be parsed back in.

Testing

If you plan to make changes to kernel, get a checkout of the Dartk SDK and run:

tool/regenerate_dill_files.dart --sdk <path to SDK checkout>
pub run test

Linking

Linking from binary files is not yet implemented. In order to compile a whole program, currently everything must be compiled from source at once.