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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 10937019: First pass at getting git and tar.gz working on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge bug. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/pub.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 /** 1024 /**
1025 * Creates the files and directories within this tar file, then archives them, 1025 * Creates the files and directories within this tar file, then archives them,
1026 * compresses them, and saves the result to [parentDir]. 1026 * compresses them, and saves the result to [parentDir].
1027 */ 1027 */
1028 Future<File> create(parentDir) { 1028 Future<File> create(parentDir) {
1029 var tempDir; 1029 var tempDir;
1030 return parentDir.createTemp().chain((_tempDir) { 1030 return parentDir.createTemp().chain((_tempDir) {
1031 tempDir = _tempDir; 1031 tempDir = _tempDir;
1032 return Futures.wait(contents.map((child) => child.create(tempDir))); 1032 return Futures.wait(contents.map((child) => child.create(tempDir)));
1033 }).chain((_) { 1033 }).chain((_) {
1034 var args = ["--directory", tempDir.path, "--create", "--gzip", "--file", 1034 if (Platform.operatingSystem != "windows") {
1035 join(parentDir, _stringName)]; 1035 var args = ["--directory", tempDir.path, "--create", "--gzip",
1036 args.addAll(contents.map((child) => child.name)); 1036 "--file", join(parentDir, _stringName)];
1037 return runProcess("tar", args); 1037 args.addAll(contents.map((child) => child.name));
1038 return runProcess("tar", args);
1039 } else {
1040 // Create the tar file.
1041 var tarFile = join(tempDir, _stringName.replaceAll("tar.gz", "tar"));
1042 var args = ["a", tarFile];
1043 args.addAll(contents.map(
1044 (child) => '-i!"${join(tempDir, child.name)}"'));
1045
1046 // Find 7zip. Note: this assumes the tests are being run from
1047 // utils/tests/pub/
1048 var scriptDir = new File(new Options().script).directorySync().path;
1049 var command = fs.joinPaths(scriptDir,
1050 '../../../third_party/7zip/7za.exe');
1051
1052 return runProcess(command, args).chain((_) {
1053 // GZIP it. 7zip doesn't support doing both as a single operation.
1054 args = ["a", join(parentDir, _stringName), tarFile];
1055 return runProcess(command, args);
1056 });
1057 }
1038 }).chain((result) { 1058 }).chain((result) {
1039 if (!result.success) { 1059 if (!result.success) {
1040 throw "Failed to create tar file $name.\n" 1060 throw "Failed to create tar file $name.\n"
1041 "STDERR: ${Strings.join(result.stderr, "\n")}"; 1061 "STDERR: ${Strings.join(result.stderr, "\n")}";
1042 } 1062 }
1043 return deleteDir(tempDir); 1063 return deleteDir(tempDir);
1044 }).transform((_) { 1064 }).transform((_) {
1045 return new File(join(parentDir, _stringName)); 1065 return new File(join(parentDir, _stringName));
1046 }); 1066 });
1047 } 1067 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1156 }
1137 1157
1138 /** 1158 /**
1139 * Schedules a callback to be called after Pub is run with [runPub], even if it 1159 * Schedules a callback to be called after Pub is run with [runPub], even if it
1140 * fails. 1160 * fails.
1141 */ 1161 */
1142 void _scheduleCleanup(_ScheduledEvent event) { 1162 void _scheduleCleanup(_ScheduledEvent event) {
1143 if (_scheduledCleanup == null) _scheduledCleanup = []; 1163 if (_scheduledCleanup == null) _scheduledCleanup = [];
1144 _scheduledCleanup.add(event); 1164 _scheduledCleanup.add(event);
1145 } 1165 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698