Commit Graph

12 Commits

Author SHA1 Message Date
Jens Johansen 4457cb7002 [CFE] Crash test minimizer can find specific errors that occur only on reload
For instance one could pass something like
```
--wantErrorOnReload="Error: The getter 'axis' isn't defined for the class 'Constraints'" --noTryToDeleteEmptyFilesUpFront
```

to reproduce https://dart-review.googlesource.com/c/sdk/+/180341

(the --noTryToDeleteEmptyFilesUpFront part might not be neccessary,
but was at one point doing the reproduction / development of this).

Change-Id: I943b715c56f3e1103c6287ed9529aa29c0e74f07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180360
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-01-22 15:16:23 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Jens Johansen f03d4bc198 [CFE] Refactor and improve crash test minimizer
Change-Id: I15f36ed980f07f37b77e3b8df471e8fbca714c05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175244
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-12-08 13:38:34 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Jens Johansen 923facf226 [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>
2020-12-03 07:53:57 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Jens Johansen 714ee1cd48 [CFE] Reproduction for flutter issue #63029
Change-Id: I9df135af44fe023e4795f0a042f1bc1297ace8d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157499
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-07 14:26:24 +00:00
Jens Johansen a62466934e [CFE] Allow crashing test case minimizer to use more than one line of stacktrace to find matching crash
Before this CL (and still as default) the crashing test minimizer would
operate by
1) Run and verify it crashed; record the first entry of the stacktrace
2) Delete stuff and rerun, verifying that the first entry of the new
   stacktrace matched the old one (to verify we have a smaller example
   of the same crash).

This doesn't work will with for instance assert errors though, as trying
to find a small reproduction for one assert error could result in a
small reproduction for another assert error.

This CL introduces the "--stack-matches=<n>" option, so you could for
instance add "--stack-matches=3" in an attempt to find the exact
assert error you wanted.

Change-Id: I1b523e9c3d391c63b3ffb5baa8ab673df7e051d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156505
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-30 13:08:48 +00:00
Jens Johansen a2e7c24cd7 [CFE/kernel] Grab bag of small fixes/improvements
* Refactor a test to make it easier to extend it later.
* Allow the crashing reproduction minimizer to search for a new target
  if it finds another interesting crash.
* Fix update_expectations tool to include textual_outline
* Fix leakingDebugToString on Library

Change-Id: I9a59151f2ad5c2d91b4cbbe10d864fe9928221eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146804
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 07:29:47 +00:00
Jens Johansen 491cebed70 [CFE] Test the crashes if no accessor provided when loading dart:core
This is the requested reproduction test for
https://dart-review.googlesource.com/c/sdk/+/146786

Change-Id: If32f22454866ea7e25ed4520ccb4aa492032870e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146792
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-06 14:55:22 +00:00
Jens Johansen 6dcdec5e26 [CFE] Extends the crash reproduction minimizer to work on more than one file
E.g., reproducing #40707:

$ time out/ReleaseX64/dart pkg/front_end/test/crashing_test_case_minimizer.dart --platform=[...]/flutter_web_sdk/kernel/flutter_ddc_sdk.dill --invalidate=[...]/gallery/lib/main.dart --target=ddc --widgetTransformation [...]/gallery/lib/main.dart
[...]

DONE


Uri file://[...]/gallery/.dart_tool/package_config.json has this content:
{
  "packages": [
    {
      "name": "flutter",
      "rootUri": "file://[...]/flutter/packages/flutter",
      "packageUri": "lib/",
      "languageVersion": "2.2"
    },
    {
    }
  ],
  "generatorVersion": "2.9.0-3.0.dev.flutter-b0d35855d8"
}



====================


Uri file://[...]/gallery/lib/main.dart has this content:
import 'package:flutter/material.dart';
class RootPage extends StatelessWidget {



====================


Uri file://[...]/flutter/packages/flutter/lib/foundation.dart has this content:
export 'src/foundation/diagnostics.dart';



====================


Uri file://[...]/flutter/packages/flutter/lib/material.dart has this content:
export 'widgets.dart';



====================


Uri file://[...]/flutter/packages/flutter/lib/src/foundation/diagnostics.dart has this content:
abstract class DiagnosticableTree with Diagnosticable {



====================


Uri file://[...]/flutter/packages/flutter/lib/widgets.dart has this content:
export 'src/widgets/framework.dart';
export 'src/widgets/widget_inspector.dart';



====================


Uri file://[...]/flutter/packages/flutter/lib/src/widgets/framework.dart has this content:
import 'package:flutter/foundation.dart';
abstract class Widget extends DiagnosticableTree {
}
abstract class StatelessWidget extends Widget {



====================


Uri file://[...]/flutter/packages/flutter/lib/src/widgets/widget_inspector.dart has this content:
abstract class _HasCreationLocation {
}
class _Location {



====================



real    5m28.400s
user    7m24.233s
sys     0m9.895s

Change-Id: Ide66ad928699b781f3cfa8de11536cc8125983e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145080
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-28 15:22:09 +00:00
Jens Johansen 66ab9407cd [CFE] Add (experimental) tool to minimize a compiler crashing reproduction
E.g.
```
$ out/ReleaseX64/dart pkg/front_end/test/crashing_test_case_minimizer.dart pkg/front_end/parser_testcases/error_recovery/utf_16_le_content.crash_dart
[...]
Got it down to 12 bytes: [100, 59, 100, 59, 110, 40, 41, 123, 34, 34, 100, 33]
That's 'd;d;n(){""d!' as text
```

Change-Id: Ic71a258c590d3e1ca5cff0c1dcb724c9578dbfc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144289
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-22 11:45:34 +00:00