mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
If the test specifies a .dill file, dont make the engine interpret is as source. (#5002)
This commit is contained in:
parent
58e84c8bf0
commit
4e0fbb6f01
@ -342,14 +342,12 @@ DartVM::DartVM(const Settings& settings,
|
||||
const bool is_preview_dart2 =
|
||||
platform_kernel_ != nullptr || isolate_snapshot_is_dart_2;
|
||||
|
||||
if (is_preview_dart2) {
|
||||
FXL_DLOG(INFO) << "Dart 2 is enabled.";
|
||||
} else {
|
||||
FXL_DLOG(INFO) << "Dart 2 is NOT enabled. Platform kernel: "
|
||||
<< static_cast<bool>(platform_kernel_)
|
||||
<< " Isolate Snapshot is Dart 2: "
|
||||
<< isolate_snapshot_is_dart_2;
|
||||
}
|
||||
FXL_DLOG(INFO) << "Dart 2 " << (is_preview_dart2 ? " is" : "is NOT")
|
||||
<< "enabled. Platform kernel: "
|
||||
<< static_cast<bool>(platform_kernel_)
|
||||
<< " Isolate Snapshot is Dart 2: "
|
||||
<< isolate_snapshot_is_dart_2;
|
||||
|
||||
if (is_preview_dart2) {
|
||||
PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs));
|
||||
if (use_checked_mode) {
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "flutter/shell/common/shell.h"
|
||||
#include "flutter/shell/common/switches.h"
|
||||
#include "flutter/shell/common/thread_host.h"
|
||||
#include "lib/fxl/files/path.h"
|
||||
#include "lib/fxl/functional/make_copyable.h"
|
||||
#include "lib/fxl/synchronization/waitable_event.h"
|
||||
#include "third_party/dart/runtime/bin/embedded_dart_io.h"
|
||||
@ -89,6 +90,19 @@ class ScriptCompletionTaskObserver {
|
||||
FXL_DISALLOW_COPY_AND_ASSIGN(ScriptCompletionTaskObserver);
|
||||
};
|
||||
|
||||
static bool FileNameIsDill(const std::string& name) {
|
||||
const std::string suffix = ".dill";
|
||||
|
||||
if (name.size() < suffix.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (name.rfind(suffix, name.size()) == name.size() - suffix.size()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int RunTester(const blink::Settings& settings, bool run_forever) {
|
||||
const auto thread_label = "io.flutter.test";
|
||||
|
||||
@ -124,8 +138,18 @@ int RunTester(const blink::Settings& settings, bool run_forever) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
auto isolate_configuration = IsolateConfiguration::CreateForSource(
|
||||
settings.main_dart_file_path, settings.packages_file_path);
|
||||
if (settings.main_dart_file_path.empty()) {
|
||||
FXL_LOG(ERROR) << "Main dart file not specified.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
auto isolate_configuration =
|
||||
FileNameIsDill(settings.main_dart_file_path)
|
||||
? IsolateConfiguration::CreateForSnapshot(
|
||||
std::make_unique<fml::FileMapping>(
|
||||
files::AbsolutePath(settings.main_dart_file_path), false))
|
||||
: IsolateConfiguration::CreateForSource(settings.main_dart_file_path,
|
||||
settings.packages_file_path);
|
||||
|
||||
if (!isolate_configuration) {
|
||||
FXL_LOG(ERROR) << "Could create isolate configuration.";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user