diff --git a/pkg/dynamic_modules/test/runner/util.dart b/pkg/dynamic_modules/test/runner/util.dart index cfe7384eecf..aa611ad5491 100644 --- a/pkg/dynamic_modules/test/runner/util.dart +++ b/pkg/dynamic_modules/test/runner/util.dart @@ -14,12 +14,17 @@ import 'dart:ffi' show Abi; /// Note: we don't search for the directory "sdk" because this may not be /// available when running this test in a shard. Uri repoRoot = (() { + var root = Platform.environment['REPO_ROOT']; + if (root != null) return Uri.base.resolve(root); Uri script = Platform.script; var segments = script.pathSegments; var index = segments.lastIndexOf('pkg'); if (index == -1) { - exitCode = 1; - throw "error: cannot find the root of the Dart SDK"; + index = segments.lastIndexOf(_outFolder); // running from snapshot + if (index == -1) { + exitCode = 1; + throw "error: cannot find the root of the Dart SDK"; + } } return script.resolve("../" * (segments.length - index - 1)); })(); diff --git a/utils/dynamic_module_runner/BUILD.gn b/utils/dynamic_module_runner/BUILD.gn index 42abc5ab7a8..d550347dff6 100644 --- a/utils/dynamic_module_runner/BUILD.gn +++ b/utils/dynamic_module_runner/BUILD.gn @@ -17,3 +17,8 @@ aot_snapshot("dynamic_module_runner_snapshot") { [ "--dynamic-interface=" + rebase_path( "$_dart_root/utils/dynamic_module_runner/dynamic_interface.yaml") ] } + +aot_snapshot("dynamic_modules_test_suite_snapshot") { + main_dart = "../../pkg/dynamic_modules/test/runner/main.dart" + name = "dynamic_modules_test_suite" +}