[CFE] Improve crash test minimizer

This CL adds to/changes the crash test minimizer to:
* Make use of the direct-from-parser ast to try to delete entire
  classes, procedures etc.
* Tries to inline small files into the importers/exporters of those
  files to reduce the number of files.
* Can print info by pression 'i' while it's running.
* Can stop the process without throwing away anything by pression 'q'.
* Can save and load a partial minimization to a json file so one can
  start from there again by passing '--fsJson=jsonFileHere'.
* Attempts to prints the reproduction as a "incremental yaml test file"
  so one can quickly create an incremental test reproducing the crash.

For instance, recreating a bug recently fixed, I can find it using:
```
time out/ReleaseX64/dart pkg/front_end/test/crashing_test_case_minimizer.dart --platform=/path/to/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/platform_strong.dill --invalidate=package:flutter/src/widgets/framework.dart --target=flutter --widgetTransformation --experimental-invalidation --serialize --stack-matches=5 /tmp/edited_flutter_gallery/lib/main.dart

[...]

DONE


Wrote json file system to file:///usr/local/google/home/jensj/code/dart-sdk/sdk/crash_minimizer_result_132
------ Reproduction as semi-done incremental yaml test file ------


type: newworld
trackWidgetCreation: true
target: DDC # basically needed for widget creation to be run
worlds:
  - entry: file:///tmp/edited_flutter_gallery/lib/main.dart
    experiments: alternative-invalidation-strategy
    sources:
      file:///tmp/edited_flutter_gallery/.dart_tool/package_config.json: |
        {
          "configVersion": 2,
          "packages": [
            {
              "name": "flutter",
              "rootUri": "file:///path/to/flutter/packages/flutter",
              "packageUri": "lib/",
              "languageVersion": "2.12"
            }
          ],
          "generated": "2020-11-20T08:58:21.614044Z",
          "generator": "pub",
          "generatorVersion": "2.12.0-50.0.dev"
        }
      file:///tmp/edited_flutter_gallery/lib/main.dart: |
        import "package:flutter/src/widgets/framework.dart";
      file:///path/to/flutter/packages/flutter/lib/src/widgets/framework.dart: |
        import "package:flutter/src/widgets/widget_inspector.dart";
        abstract class Widget {}
      file:///path/to/flutter/packages/flutter/lib/src/widgets/widget_inspector.dart: |
        abstract class _HasCreationLocation {}
        class _Location {}
    expectedLibraryCount: 3 # with parts this is not right

  - entry: file:///tmp/edited_flutter_gallery/lib/main.dart
    experiments: alternative-invalidation-strategy
    worldType: updated
    expectInitializeFromDill: false # or true?
    invalidate:
      - package:flutter/src/widgets/framework.dart
    expectedLibraryCount: 3 # with parts this is not right
    expectsRebuildBodiesOnly: true # or false?

------------------------------------------------------------------


[...]

real    31m16.886s
user    38m57.585s
sys     1m35.374s
```

Change-Id: I9b75a231841c13370f11879a10485ee2add8c3ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174643
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2 files changed
tree: 9ad8b1ae6c16f950986d091252d9b842c9fa73ed
  1. .dart_tool/
  2. .github/
  3. benchmarks/
  4. build/
  5. client/
  6. docs/
  7. pkg/
  8. runtime/
  9. samples/
  10. samples-dev/
  11. samples_2/
  12. sdk/
  13. tests/
  14. third_party/
  15. tools/
  16. utils/
  17. .clang-format
  18. .gitattributes
  19. .gitconfig
  20. .gitignore
  21. .gn
  22. .mailmap
  23. .packages
  24. .style.yapf
  25. .vpython
  26. AUTHORS
  27. BUILD.gn
  28. CHANGELOG.md
  29. codereview.settings
  30. CONTRIBUTING.md
  31. DEPS
  32. LICENSE
  33. PATENT_GRANT
  34. PRESUBMIT.py
  35. README.dart-sdk
  36. README.md
  37. sdk_args.gni
  38. WATCHLISTS
README.md

Dart

A client-optimized language for fast apps on any platform

Dart is:

  • Optimized for UI: Develop with a programming language specialized around the needs of user interface creation

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app

  • Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, getting started, and more.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents on our wiki.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.