If the test specifies a .dill file, dont make the engine interpret is as source. (#5002)

This commit is contained in:
Chinmay Garde 2018-04-13 15:07:28 -07:00 committed by GitHub
parent 58e84c8bf0
commit 4e0fbb6f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 10 deletions

View File

@ -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) {

View File

@ -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.";