Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: tests/compiler/dart2js/dill_loader_test.dart

Issue 2979463002: Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service." (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/dart2js.status ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/dill_loader_test.dart
diff --git a/tests/compiler/dart2js/dill_loader_test.dart b/tests/compiler/dart2js/dill_loader_test.dart
index 7e989e26184b0c987fa070f3b37487e13e26489f..f4d94acda9445ba8d503a58b6f75b3bad0197219 100644
--- a/tests/compiler/dart2js/dill_loader_test.dart
+++ b/tests/compiler/dart2js/dill_loader_test.dart
@@ -16,10 +16,22 @@ import 'package:compiler/src/library_loader.dart' show ScriptLoader;
import 'package:compiler/src/script.dart' show Script;
import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
import "package:expect/expect.dart";
-import 'package:front_end/front_end.dart';
-import 'package:front_end/src/fasta/kernel/utils.dart' show serializeProgram;
-import 'package:compiler/src/kernel/dart2js_target.dart';
-import 'package:kernel/target/targets.dart' show TargetFlags;
+import 'package:path/path.dart' as path;
+
+final String dartkExecutable = Platform.isWindows
+ ? 'tools/dartk_wrappers/dartk.bat'
+ : 'tools/dartk_wrappers/dartk';
+
+/// Run the dartk.dart script, and return the binary encoded results.
+List<int> runDartk(String filename) {
+ String basePath = path.fromUri(Uri.base);
+ String dartkPath = path.normalize(path.join(basePath, dartkExecutable));
+
+ var args = [filename, '-fbin', '-ostdout'];
+ ProcessResult result = Process.runSync(dartkPath, args, stdoutEncoding: null);
+ Expect.equals(0, result.exitCode, result.stderr);
+ return result.stdout;
+}
class TestScriptLoader implements ScriptLoader {
CompilerImpl compiler;
@@ -41,19 +53,8 @@ main() {
DiagnosticCollector diagnostics = new DiagnosticCollector();
OutputCollector output = new OutputCollector();
Uri entryPoint = Uri.parse('memory:main.dill');
+ List<int> kernelBinary = runDartk(filename);
- var platform = Uri
- .parse(Platform.resolvedExecutable)
- .resolve('patched_dart2js_sdk/platform.dill');
- var options = new CompilerOptions()
- ..target = new Dart2jsTarget(new TargetFlags())
- ..packagesFileUri = Platform.script.resolve('../../../.packages')
- ..linkedDependencies = [platform]
- ..verify = true
- ..onError = errorHandler;
-
- List<int> kernelBinary =
- serializeProgram(await kernelForProgram(uri, options));
CompilerImpl compiler = compilerFor(
entryPoint: entryPoint,
memorySourceFiles: {'main.dill': kernelBinary},
@@ -76,8 +77,3 @@ main() {
Expect.isNotNull(member);
});
}
-
-void errorHandler(CompilationError e) {
- exitCode = 1;
- print(e.message);
-}
« no previous file with comments | « tests/compiler/dart2js/dart2js.status ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698