[macOS] native_assets_test.dart: 在macOS上使用Flutter运行热重载和热重启,并使用本地资源,macOS调试时可能会出现不稳定的情况,

sg2wtvxw  于 4个月前  发布在  Flutter
关注(0)|答案(5)|浏览(70)

集成测试有时会失败,

34:35 +84 ~1 -2: test/integration.shard/isolated/native_assets_test.dart: flutter run hot reload and hot restart with native assets macos debug [E]
  Expected: not contains 'Invalid argument(s): Couldn\'t resolve native function \'sum\''
    Actual: 'warning: Run script build phase \'Run Script\' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target \'Flutter Assemble\' from project \'Runner\')\n'
              'Performing hot reload...                                        \n'
              'The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9106?uri=http://127.0.0.1:53308/xYohxuqAUcQ=/\n'
              'Reloaded 0 libraries in 520ms (compile: 8 ms, reload: 0 ms, reassemble: 492 ms).\n'
              '\n'
              'Performing hot restart...                                       \n'
              'Restarted application in 5,343ms.\n'
              '\n'
              'Performing hot reload...                                        \n'
              '\n'
              '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════\n'
              'The following ArgumentError was thrown building _FocusInheritedScope:\n'
              'Invalid argument(s): Couldn\'t resolve native function \'sum\' in\n'
              '\'package:package_with_native_assets/package_with_native_assets_bindings_generated.dart\' : Failed to\n'
              'load dynamic library \'package_with_native_assets1.framework/package_with_native_assets1\': Failed to\n'
              'load dynamic library \'package_with_native_assets1.framework/package_with_native_assets1\':\n'
              'dlopen(package_with_native_assets1.framework/package_with_native_assets1, 0x0001): tried:\n'
              '\'package_with_native_assets1.framework/package_with_native_assets1\' (no such file),\n'
              '\'/System/Volumes/Preboot/Cryptexes/OSpackage_with_native_assets1.framework/package_with_native_assets1\'\n'
              '(no such file),\n'

。我无法在本地重现这个问题。

2exbekwf

2exbekwf2#

我已经在本地多次运行了测试,但我也无法重现这个问题。
如果它不稳定,Flutter CI不应该注意到并报告一个P0问题并分配给我(我是测试负责人)。

r6l8ljro

r6l8ljro3#

我打开了这个,以防你有任何关于这可能是由什么引起的的想法。它看起来像是潜在的问题,与防止重复框架名称(package_with_native_assets1.framework)有关,但在macOS/debug中只有一个架构,所以我不太清楚可能导致这个问题的代码路径。

8dtrkrch

8dtrkrch5#

我无法在本地复现这个问题,但是检查临时文件夹的单元测试结果如下:

format-version:
  - 1
  - 0
  - 0
native-assets:
  macos_arm64:
    package:package_with_native_assets/package_with_native_assets_bindings_generated.dart:
      - absolute
      - package_with_native_assets.framework/package_with_native_assets
    package:link_hook/link_hook_bindings_generated.dart:
      - absolute
      - link_hook.framework/link_hook
  macos_x64:
    package:package_with_native_assets/package_with_native_assets_bindings_generated.dart:
      - absolute
      - package_with_native_assets1.framework/package_with_native_assets1
    package:link_hook/link_hook_bindings_generated.dart:
      - absolute
      - link_hook1.framework/link_hook1

我认为在机器人的热重载或热重启过程中,架构顺序发生了变化,导致了两个不同名称的架构互换。
现在,这些名称本来不应该不同的。这个问题最近已经在iOS上修复(02d5286),但在MacOS上还没有修复。我已经创建了#149761来解决这个问题。

相关问题