简体   繁体   English

在AOT /发布或配置文件模式下运行颤振/飞镖测试?

[英]Running flutter/dart tests in AOT/release or profile mode?

If I understand it correctly by default flutter test will run with a JIT on the Dart VM, while the release mode uses an AOT compiler to native code. 如果我理解正确,默认情况下, flutter test将在Dart VM上使用JIT运行,而发布模式使用AOT编译器来编写本机代码。 I (think to) have a crash which only happens in AOT mode (release and profile), and it would be way easier to debug and reproduce it when I could isolate it by running code in AOT/profile mode. 我(认为)只有在AOT模式(发行版和配置文件)下才会发生崩溃,当我可以通过在AOT /配置文件模式下运行代码隔离它时,调试和重现它会更容易。

So how can I run tests (or at least code snippets) in AOT mode? 那么如何在AOT模式下运行测试(或至少代码片段)? (I don't really care if it runs on an actual iOS or Android device, or is executed on the dev machine or simulators. (我不太在意它是否在实际的iOS或Android设备上运行,还是在开发机或模拟器上执行。

(I have found an article which seems to describe the compilation process , but is pretty involved. Is there some easier way for tests?) (我找到了一篇似乎描述了编译过程的文章 ,但涉及很多。有没有更简单的测试方法?)

I have found a rather simple solution which is documented on the dart website . 我找到了一个相当简单的解决方案,该解决方案记录在dart网站上 Starting with Dart 2.3 there is a dart2aot and dartaotruntime bundled with the SDK. 从Dart 2.3开始,SDK附带了dart2aotdartaotruntime This allows simple execution and I was able to reproduce my crash. 这样可以简单执行,并且能够重现崩溃。

Herbys-MacBook-Pro-2017:migrate$ dart2aot migrate_aot_test.dart migrate_aot_test.dart.aot
Herbys-MacBook-Pro-2017:migrate$ dartaotruntime migrate_aot_test.dart.aot
[...]

===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x1061000410f
Abort trap: 6
Herbys-MacBook-Pro-2017:migrate$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM