Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"--precompiled" does not play nice with "--debug" for vm tests #1180

Open
cedx opened this issue Feb 13, 2020 · 4 comments
Open

"--precompiled" does not play nice with "--debug" for vm tests #1180

cedx opened this issue Feb 13, 2020 · 4 comments

Comments

@cedx
Copy link

@cedx cedx commented Feb 13, 2020

I'm using the new coverage feature from test package (i.e. --coverage parameter), but when used in conjunction with build_runner, it fails with a Bad state error.

Dart SDK: 2.7.1 (x64)
OS: Windows 10
Packages: build_runner 1.7.4 , test 1.12.0, build_test 0.10.12+1
Sample repository: https://github.com/cedx/where.dart

$ pub run build_runner test
# 00:03 +23: All tests passed!
$ pub run build_runner build
$ pub run test --coverage=var
# 00:08 +23: All tests passed!
$ pub run build_runner test -- --coverage=var

[INFO] Generating build script completed, took 386ms
...
[INFO] Succeeded after 10.1s with 16 outputs (49 actions)
Running tests...

Warning: You should set `SILENT_OBSERVATORY` to true when debugging the VM as it will output the observatory URL by default.
This breaks the various reporter contracts.
To set the value define `DART_VM_OPTIONS=-DSILENT_OBSERVATORY=true`.

00:02 +0: loading test\file_stat_test.dart

Observatory listening on http://127.0.0.1:50444/ED2QqR137Mg=/
Observatory listening on http://127.0.0.1:50445/ED2QqR137Mg=/
00:02 +0 -1: loading test\finder_test.dart [E]
  Failed to load "test\finder_test.dart": Bad state: No element
  dart:collection/list.dart 150:5                               ListMixin.firstWhere
  package:test_core/src/runner/vm/platform.dart 84:12           VMPlatform.load
  ===== asynchronous gap ===========================
  dart:async/future.dart 276:45                                 new Future.error
  package:test_core/src/runner/loader.dart 246:26               Loader.loadFile.<fn>
  ===== asynchronous gap ===========================
  dart:async/zone.dart 1064:19                                  _CustomZone.registerBinaryCallback
  dart:async-patch/async_patch.dart 82:23                       _asyncErrorWrapperHelper
  package:test_core/src/runner/loader.dart                      Loader.loadFile.<fn>
  package:test_core/src/runner/load_suite.dart 98:31            new LoadSuite.<fn>.<fn>
  package:test_core/src/runner/load_suite.dart 108:8            new LoadSuite.<fn>
  package:test_api/src/backend/invoker.dart 401:25              Invoker._onRun.<fn>.<fn>.<fn>.<fn>
  dart:async/future.dart 176:37                                 new Future.<fn>
  package:stack_trace/src/stack_zone_specification.dart 209:15  StackZoneSpecification._run
  package:stack_trace/src/stack_zone_specification.dart 119:48  StackZoneSpecification._registerCallback.<fn>
  dart:async/zone.dart 1122:38                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 925:7                                    _CustomZone.runGuarded
  dart:async/zone.dart 965:23                                   _CustomZone.bindCallbackGuarded.<fn>
  package:stack_trace/src/stack_zone_specification.dart 209:15  StackZoneSpecification._run
  package:stack_trace/src/stack_zone_specification.dart 119:48  StackZoneSpecification._registerCallback.<fn>
  dart:async/zone.dart 1126:13                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 949:23                                   _CustomZone.bindCallback.<fn>
  dart:async-patch/timer_patch.dart 23:15                       Timer._createTimer.<fn>
  dart:isolate-patch/timer_impl.dart 384:19                     _Timer._runTimers
  dart:isolate-patch/timer_impl.dart 418:5                      _Timer._handleMessage
  dart:isolate-patch/isolate_patch.dart 174:12                  _RawReceivePortImpl._handleMessage
  ===== asynchronous gap ===========================
  dart:async/zone.dart 1047:19                                  _CustomZone.registerCallback
  dart:async/zone.dart 964:22                                   _CustomZone.bindCallbackGuarded
  dart:async/timer.dart 54:45                                   new Timer
  dart:async/timer.dart 91:9                                    Timer.run
  dart:async/future.dart 174:11                                 new Future
  package:test_api/src/backend/invoker.dart 400:21              Invoker._onRun.<fn>.<fn>.<fn>
  dart:async/zone.dart 1126:13                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 1518:10                                  _runZoned
  dart:async/zone.dart 1465:12                                  runZoned
  package:test_api/src/backend/invoker.dart 388:9               Invoker._onRun.<fn>.<fn>
  dart:async/zone.dart 1126:13                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 1518:10                                  _runZoned
  dart:async/zone.dart 1465:12                                  runZoned
  package:test_api/src/backend/invoker.dart 148:7               Invoker.guard
  package:test_api/src/backend/invoker.dart 437:15              Invoker._guardIfGuarded
  package:test_api/src/backend/invoker.dart 387:7               Invoker._onRun.<fn>
  package:stack_trace/src/chain.dart 101:24                     Chain.capture.<fn>
  dart:async/zone.dart 1126:13                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 1518:10                                  _runZoned
  dart:async/zone.dart 1465:12                                  runZoned
  package:stack_trace/src/chain.dart 99:12                      Chain.capture
  package:test_api/src/backend/invoker.dart 386:11              Invoker._onRun
  package:test_api/src/backend/live_test_controller.dart 197:5  LiveTestController._run
  package:test_api/src/backend/live_test_controller.dart 50:37  _LiveTest.run
  dart:async/future.dart 202:37                                 new Future.microtask.<fn>
  dart:async/zone.dart 1126:13                                  _rootRun
  dart:async/zone.dart 1023:19                                  _CustomZone.run
  dart:async/zone.dart 949:23                                   _CustomZone.bindCallback.<fn>
  dart:async/schedule_microtask.dart 43:21                      _microtaskLoop
  dart:async/schedule_microtask.dart 52:5                       _startMicrotaskLoop
  dart:isolate-patch/isolate_patch.dart 118:13                  _runPendingImmediateCallback
  dart:isolate-patch/isolate_patch.dart 175:5                   _RawReceivePortImpl._handleMessage
@jakemac53

This comment has been minimized.

Copy link
Contributor

@jakemac53 jakemac53 commented Feb 13, 2020

It looks like there is an assumption that the library uri will come through as an absolute uri (https://github.com/dart-lang/test/blob/master/pkgs/test_core/lib/src/runner/vm/platform.dart#L75), in the build_runner case this is likely coming through as a custom org-dartlang-app: uri which has a relative path from the package root (we can't use any absolute uris so that our build cache is portable).

I am going to move this to the test repo as I don't believe there is anything we can do on the build side of things specifically.

@cedx just to confirm are you also using build_vm_compilers?

@jakemac53 jakemac53 transferred this issue from dart-lang/build Feb 13, 2020
@jakemac53 jakemac53 changed the title Does not play nice with "--coverage" from "test" package precompiled + build_runner does not play nice with "--coverage" for vm tests Feb 13, 2020
@cedx

This comment has been minimized.

Copy link
Author

@cedx cedx commented Feb 13, 2020

@jakemac53 I'm not using build_vm_compilers in my pubspec.yaml file.
When doing a pub upgrade (or pub deps) to see all transitive dependencies, build_vm_compilers is not listed.

@jakemac53 jakemac53 changed the title precompiled + build_runner does not play nice with "--coverage" for vm tests "--precompiled" does not play nice with "--coverage" for vm tests Feb 13, 2020
@jakemac53

This comment has been minimized.

Copy link
Contributor

@jakemac53 jakemac53 commented Feb 13, 2020

Oh ok - actually that still makes sense because we end up running the test in the precompiled directory instead of from your package root (its a merged output directory).

In precompiled mode it should expect the uri from the precompiled directory and not the users package.

@jakemac53

This comment has been minimized.

Copy link
Contributor

@jakemac53 jakemac53 commented Feb 13, 2020

Note that this might still have some other weird consequences in terms of the uris not matching expected uris in the package so the coverage information might seem a bit off? I don't have a lot of context there.

@grouma grouma changed the title "--precompiled" does not play nice with "--coverage" for vm tests "--precompiled" does not play nice with "--debug" for vm tests Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.