dart-sdk/pkg/kernel/test/verify_self_check.dart
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

15 lines
453 B
Dart

// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:kernel/kernel.dart';
import 'package:kernel/verifier.dart';
import 'self_check_util.dart';
main(List<String> args) {
runSelfCheck(args, (String filename) {
verifyProgram(loadProgramFromBinary(filename));
});
}