Skip to content

[tool] Adding an await to DefaultResidentCompiler._recompile fails test(s) in test/general.shard/devfs_test.dart #151255

@andrewkolos

Description

@andrewkolos

Discovered while working on #151146. Blocks fixing #137184, easily the top crasher of the flutter tool.

Repro

  1. Checkout master (I used fbd6890).
  2. Open packages/flutter_tools/lib/src/compile.dart. Add await Future.value() after the server.stdin.writeln('recompile $mainUri $inputKey'); (the line in the link).
  3. Run this test using dart test test/general.shard/devfs_test.dart --name "DevFS actually starts compile before processing bundle" from the packages/flutter_tools directory.

The test will fail:

andrewkolos-macbookpro:flutter_tools andrewkolos$ dart test test/general.shard/devfs_test.dart --name "DevFS actually starts compile before processing bundle"
Building package executable... (1.8s)
Built test:test.
00:01 +0: DevFS actually starts compile before processing bundle                                                                                                                                                                
Expected: a value greater than <3>
  Actual: <2>
   Which: is not a value greater than <3>

#0      fail (package:matcher/src/expect/expect.dart:149:31)
#1      _expect (package:matcher/src/expect/expect.dart:144:3)
#2      expect (package:matcher/src/expect/expect.dart:56:3)
#3      main.<anonymous closure> (file:///Users/andrewkolos/Documents/GitHub/flutter/packages/flutter_tools/test/general.shard/devfs_test.dart:603:5)
<asynchronous suspension>
#4      testUsingContext.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///Users/andrewkolos/Documents/GitHub/flutter/packages/flutter_tools/test/src/context.dart:151:26)
<asynchronous suspension>
#5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#6      testUsingContext.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///Users/andrewkolos/Documents/GitHub/flutter/packages/flutter_tools/test/src/context.dart:140:22)
<asynchronous suspension>

line1
line2
line1
line2

00:01 +0 -1: DevFS actually starts compile before processing bundle [E]                                                                                                                                                         
  Expected: a value greater than <3>
    Actual: <2>
     Which: is not a value greater than <3>
  
  package:matcher                                     expect
  test/general.shard/devfs_test.dart 603:5            main.<fn>
  ===== asynchronous gap ===========================
  test/src/context.dart 151:26                        testUsingContext.<fn>.<fn>.<fn>.<fn>.<fn>
  ===== asynchronous gap ===========================
  package:flutter_tools/src/base/context.dart 153:19  AppContext.run.<fn>
  ===== asynchronous gap ===========================
  test/src/context.dart 140:22                        testUsingContext.<fn>.<fn>.<fn>.<fn>
  

To run this test again: /Users/andrewkolos/Documents/GitHub/flutter/bin/cache/dart-sdk/bin/dart test test/general.shard/devfs_test.dart -p vm --plain-name 'DevFS actually starts compile before processing bundle'
00:01 +0 -1: Some tests failed.                                                                                                                                                                                                 

Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.

Looks like this method deferring to the event loop causes a mis-sequencing of events somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions