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

Unified Diff: sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart

Issue 595103002: Ensure dart and pub are on PATH when spawning binstub processes in test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « no previous file | sdk/lib/_internal/pub_generated/test/global/binstubs/binstub_runs_executable_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
index 9abed5ae3f052a22e6925c8a2504ae6e7866b4b6..cc3fbdb9b76168d013a5680ca6176482b1529a76 100644
--- a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
+++ b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
@@ -2,8 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:io';
+
import 'package:path/path.dart' as p;
import 'package:scheduled_test/scheduled_process.dart';
+import 'package:scheduled_test/scheduled_test.dart';
import '../../descriptor.dart' as d;
import '../../test_pub.dart';
@@ -26,7 +29,8 @@ main() {
schedulePub(args: ["global", "activate", "foo"]);
var process = new ScheduledProcess.start(
- p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"]);
+ p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"],
+ environment: getEnvironment());
process.stdout.expect("ok [arg1, arg2]");
process.shouldExit();
@@ -49,9 +53,22 @@ main() {
var process = new ScheduledProcess.start(
p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"],
- environment: getPubTestEnvironment());
+ environment: getEnvironment());
process.stdout.expect("ok [arg1, arg2]");
process.shouldExit();
});
}
+
+/// The buildbots do not have the Dart SDK (containing "dart" and "pub") on
+/// their PATH, so we need to spawn the binstub process with a PATH that
+/// explicitly includes it.
+getEnvironment() {
+ var binDir = p.dirname(Platform.executable);
+ var separator = Platform.operatingSystem == "windows" ? ";" : ":";
+ var path = "${Platform.environment["PATH"]}$separator$binDir";
+
+ var environment = getPubTestEnvironment();
+ environment["PATH"] = path;
+ return environment;
+}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub_generated/test/global/binstubs/binstub_runs_executable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698