OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import os.path | 7 import os.path |
8 import shutil | 8 import shutil |
9 import simplejson | 9 import simplejson |
10 import tempfile | 10 import tempfile |
11 import unittest | 11 import unittest |
12 import sys | 12 import sys |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 relative_dir_name = os.path.dirname(temp_file) | 100 relative_dir_name = os.path.dirname(temp_file) |
101 if relative_dir_name and not os.path.exists(dir_name): | 101 if relative_dir_name and not os.path.exists(dir_name): |
102 os.makedirs(dir_name) | 102 os.makedirs(dir_name) |
103 open(temp_path, 'a') | 103 open(temp_path, 'a') |
104 | 104 |
105 # Make some directories to make the stager happy. | 105 # Make some directories to make the stager happy. |
106 self.target = 'Test' | 106 self.target = 'Test' |
107 if chromium_utils.IsWindows(): | 107 if chromium_utils.IsWindows(): |
108 self.build_dir = os.path.join(self.temp_dir, 'build') | 108 self.build_dir = os.path.join(self.temp_dir, 'build') |
109 elif chromium_utils.IsLinux(): | 109 elif chromium_utils.IsLinux(): |
110 self.build_dir = os.path.join(self.temp_dir, 'out') | 110 self.build_dir = os.path.join(self.temp_dir, 'sconsbuild') |
111 elif chromium_utils.IsMac(): | 111 elif chromium_utils.IsMac(): |
112 self.build_dir = os.path.join(self.temp_dir, 'xcodebuild') | 112 self.build_dir = os.path.join(self.temp_dir, 'xcodebuild') |
113 else: | 113 else: |
114 raise PlatformError( | 114 raise PlatformError( |
115 'Platform "%s" is not currently supported.' % sys.platform) | 115 'Platform "%s" is not currently supported.' % sys.platform) |
116 os.makedirs(os.path.join(self.build_dir, self.target)) | 116 os.makedirs(os.path.join(self.build_dir, self.target)) |
117 self.src_dir = os.path.join(self.temp_dir, 'build', 'src') | 117 self.src_dir = os.path.join(self.temp_dir, 'build', 'src') |
118 os.makedirs(self.src_dir) | 118 os.makedirs(self.src_dir) |
119 self.archive_dir = os.path.join(self.temp_dir, 'archive') | 119 self.archive_dir = os.path.join(self.temp_dir, 'archive') |
120 os.makedirs(self.archive_dir) | 120 os.makedirs(self.archive_dir) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 self.stager.SaveBuildRevisionToSpecifiedFile(last_change_file_path) | 403 self.stager.SaveBuildRevisionToSpecifiedFile(last_change_file_path) |
404 # Check the contents in last change file. | 404 # Check the contents in last change file. |
405 self.assertTrue(os.path.exists(last_change_file_path)) | 405 self.assertTrue(os.path.exists(last_change_file_path)) |
406 fp = open(last_change_file_path) | 406 fp = open(last_change_file_path) |
407 self.assertEquals(expect_last_change_file_contents, fp.read()) | 407 self.assertEquals(expect_last_change_file_contents, fp.read()) |
408 fp.close() | 408 fp.close() |
409 self.assertEquals(build_number, self.stager.GetLastBuildRevision()) | 409 self.assertEquals(build_number, self.stager.GetLastBuildRevision()) |
410 | 410 |
411 if __name__ == '__main__': | 411 if __name__ == '__main__': |
412 unittest.main() | 412 unittest.main() |
OLD | NEW |