| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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 ntpath | 7 import ntpath |
| 8 import posixpath | 8 import posixpath |
| 9 import sys | 9 import sys |
| 10 import collections | 10 import collections |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 patch('build_artifacts.BUILD_ARCHIVE_DIR', '/archive_dir/').start() | 30 patch('build_artifacts.BUILD_ARCHIVE_DIR', '/archive_dir/').start() |
| 31 patch('os.path.join', posixpath.join).start() | 31 patch('os.path.join', posixpath.join).start() |
| 32 | 32 |
| 33 | 33 |
| 34 class PosixTestCase(BasePosixTestCase): | 34 class PosixTestCase(BasePosixTestCase): |
| 35 def setUp(self): | 35 def setUp(self): |
| 36 BasePosixTestCase.setUp(self) | 36 BasePosixTestCase.setUp(self) |
| 37 | 37 |
| 38 def testGetToolchainNaClLib(self): | 38 def testGetToolchainNaClLib(self): |
| 39 tests = [ | 39 tests = [ |
| 40 (('newlib', 'x86_32'), 'foo/x86_64-nacl/lib32'), | 40 (('glibc_x86', 'x86_32'), 'foo/x86_64-nacl/lib32'), |
| 41 (('newlib', 'x86_64'), 'foo/x86_64-nacl/lib'), | 41 (('glibc_x86', 'x86_64'), 'foo/x86_64-nacl/lib'), |
| 42 (('newlib', 'arm'), 'foo/arm-nacl/lib'), | 42 (('glibc_arm', 'arm'), 'foo/arm-nacl/lib'), |
| 43 (('glibc', 'x86_32'), 'foo/x86_64-nacl/lib32'), | |
| 44 (('glibc', 'x86_64'), 'foo/x86_64-nacl/lib'), | |
| 45 (('bionic', 'arm'), 'foo/arm-nacl/lib'), | |
| 46 (('pnacl', None), 'foo/le32-nacl/lib'), | 43 (('pnacl', None), 'foo/le32-nacl/lib'), |
| 47 ] | 44 ] |
| 48 | 45 |
| 49 for test in tests: | 46 for test in tests: |
| 50 self.assertEqual( | 47 self.assertEqual( |
| 51 build_artifacts.GetToolchainNaClLib(test[0][0], 'foo', test[0][1]), | 48 build_artifacts.GetToolchainNaClLib(test[0][0], 'foo', test[0][1]), |
| 52 test[1]) | 49 test[1]) |
| 53 | 50 |
| 54 def testGetGypBuiltLib(self): | 51 def testGetGypBuiltLib(self): |
| 55 tests = [ | 52 tests = [ |
| 56 (('newlib', 'x86_32'), 'foo/Release/gen/tc_newlib/lib32'), | 53 (('glibc_x86', 'x86_32'), 'foo/Release/gen/tc_glibc/lib32'), |
| 57 (('newlib', 'x86_64'), 'foo/Release/gen/tc_newlib/lib64'), | 54 (('glibc_x86', 'x86_64'), 'foo/Release/gen/tc_glibc/lib64'), |
| 58 (('newlib', 'arm'), 'foo/Release/gen/tc_newlib/libarm'), | 55 (('glibc_arm', 'arm'), 'foo/Release/gen/tc_glibc/libarm'), |
| 59 (('glibc', 'x86_32'), 'foo/Release/gen/tc_glibc/lib32'), | |
| 60 (('glibc', 'x86_64'), 'foo/Release/gen/tc_glibc/lib64'), | |
| 61 (('pnacl', None), 'foo/Release/gen/tc_pnacl_newlib/lib') | 56 (('pnacl', None), 'foo/Release/gen/tc_pnacl_newlib/lib') |
| 62 ] | 57 ] |
| 63 | 58 |
| 64 for test in tests: | 59 for test in tests: |
| 65 self.assertEqual( | 60 self.assertEqual( |
| 66 build_artifacts.GetGypBuiltLib('foo', test[0][0], test[0][1]), | 61 build_artifacts.GetGypBuiltLib('foo', test[0][0], test[0][1]), |
| 67 test[1]) | 62 test[1]) |
| 68 | 63 |
| 69 def testGetGypToolchainLib(self): | 64 def testGetGypToolchainLib(self): |
| 70 tests = [ | 65 tests = [ |
| 71 (('newlib', 'x86_32'), | 66 (('glibc_x86', 'x86_32'), |
| 72 'foo/Release/gen/sdk/posix_x86/nacl_x86_newlib/x86_64-nacl/lib32'), | |
| 73 (('newlib', 'x86_64'), | |
| 74 'foo/Release/gen/sdk/posix_x86/nacl_x86_newlib/x86_64-nacl/lib'), | |
| 75 (('newlib', 'arm'), | |
| 76 'foo/Release/gen/sdk/posix_x86/nacl_arm_newlib/arm-nacl/lib'), | |
| 77 (('glibc', 'x86_32'), | |
| 78 'foo/Release/gen/sdk/posix_x86/nacl_x86_glibc/x86_64-nacl/lib32'), | 67 'foo/Release/gen/sdk/posix_x86/nacl_x86_glibc/x86_64-nacl/lib32'), |
| 79 (('glibc', 'x86_64'), | 68 (('glibc_x86', 'x86_64'), |
| 80 'foo/Release/gen/sdk/posix_x86/nacl_x86_glibc/x86_64-nacl/lib'), | 69 'foo/Release/gen/sdk/posix_x86/nacl_x86_glibc/x86_64-nacl/lib'), |
| 81 # Bionic uses the newlib toolchain lib directory | 70 (('glibc_arm', 'arm'), |
| 82 (('bionic', 'arm'), | 71 'foo/Release/gen/sdk/posix_x86/nacl_arm_glibc/arm-nacl/lib'), |
| 83 'foo/Release/gen/sdk/posix_x86/nacl_arm_newlib/arm-nacl/lib'), | |
| 84 (('pnacl', None), | 72 (('pnacl', None), |
| 85 'foo/Release/gen/sdk/posix_x86/pnacl_newlib/le32-nacl/lib'), | 73 'foo/Release/gen/sdk/posix_x86/pnacl_newlib/le32-nacl/lib'), |
| 86 ] | 74 ] |
| 87 | 75 |
| 88 for test in tests: | 76 for tc_info, expected in tests: |
| 89 self.assertEqual( | 77 self.assertEqual( |
| 90 build_artifacts.GetGypToolchainLib('foo', test[0][0], test[0][1]), | 78 build_artifacts.GetGypToolchainLib('foo', tc_info[0], tc_info[1]), |
| 91 test[1]) | 79 expected) |
| 92 | 80 |
| 93 @patch('build_artifacts.all_archives', ['foo.tar.bz2', 'bar.tar.bz2']) | 81 @patch('build_artifacts.all_archives', ['foo.tar.bz2', 'bar.tar.bz2']) |
| 94 @patch('build_version.ChromeMajorVersion', Mock(return_value='40')) | 82 @patch('build_version.ChromeMajorVersion', Mock(return_value='40')) |
| 95 @patch('build_version.ChromeRevision', Mock(return_value='302630')) | 83 @patch('build_version.ChromeRevision', Mock(return_value='302630')) |
| 96 @patch('build_version.ChromeCommitPosition', Mock(return_value= | 84 @patch('build_version.ChromeCommitPosition', Mock(return_value= |
| 97 '1492c3d296476fe12cafecabba6ebabe-refs/heads/master@{#302630}')) | 85 '1492c3d296476fe12cafecabba6ebabe-refs/heads/master@{#302630}')) |
| 98 @patch('buildbot_common.Archive') | 86 @patch('buildbot_common.Archive') |
| 99 def testUploadArchives(self, archive_mock): | 87 def testUploadArchives(self, archive_mock): |
| 100 build_artifacts.UploadArchives() | 88 build_artifacts.UploadArchives() |
| 101 cwd = '/archive_dir/' | 89 cwd = '/archive_dir/' |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 archive = build_artifacts.Archive('foo') | 283 archive = build_artifacts.Archive('foo') |
| 296 self.assertEqual(archive.name, 'win_foo') | 284 self.assertEqual(archive.name, 'win_foo') |
| 297 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2') | 285 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2') |
| 298 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2') | 286 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2') |
| 299 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo') | 287 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo') |
| 300 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo') | 288 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo') |
| 301 | 289 |
| 302 | 290 |
| 303 if __name__ == '__main__': | 291 if __name__ == '__main__': |
| 304 unittest.main() | 292 unittest.main() |
| OLD | NEW |