Skip to content

Commit

Permalink
If the test specifies a .dill file, dont make the engine interpret is…
Browse files Browse the repository at this point in the history
… as source. (#5002)
  • Loading branch information
chinmaygarde authored Apr 13, 2018
1 parent 58e84c8 commit 4e0fbb6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
14 changes: 6 additions & 8 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
28 changes: 26 additions & 2 deletions shell/testing/tester_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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";

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

0 comments on commit 4e0fbb6

Please sign in to comment.