Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test lldb 'image list' on object files across multiple architectures. |
| 3 | This exercises classes like ObjectFileELF and their support for opening |
| 4 | foreign-architecture object files. |
| 5 | """ |
| 6 | |
Zachary Turner | 35d017f | 2015-10-23 17:04:29 +0000 | [diff] [blame] | 7 | from __future__ import print_function |
| 8 | |
Zachary Turner | 0a0490b | 2015-10-27 20:12:05 +0000 | [diff] [blame^] | 9 | import use_lldb_suite |
Zachary Turner | 77db4a8 | 2015-10-22 20:06:20 +0000 | [diff] [blame] | 10 | |
Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 11 | import os.path |
Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 12 | import lldb |
| 13 | from lldbtest import * |
| 14 | import lldbutil |
| 15 | import re |
| 16 | |
| 17 | class TestImageListMultiArchitecture(TestBase): |
| 18 | |
| 19 | mydir = TestBase.compute_mydir(__file__) |
| 20 | |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 21 | @no_debug_info_test |
Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 22 | def test_image_list_shows_multiple_architectures(self): |
| 23 | """Test that image list properly shows the correct architecture for a set of different architecture object files.""" |
| 24 | images = { |
Todd Fiala | 7df337f | 2015-10-13 23:41:19 +0000 | [diff] [blame] | 25 | "hello-freebsd-10.0-x86_64-clang-3.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"), |
| 26 | "hello-freebsd-10.0-x86_64-gcc-4.7.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"), |
| 27 | "hello-netbsd-6.1-x86_64-gcc-4.5.3": re.compile(r"x86_64-(\*)?-netbsd(-unknown)? x86_64"), |
| 28 | "hello-ubuntu-14.04-x86_64-gcc-4.8.2": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"), |
| 29 | "hello-ubuntu-14.04-x86_64-clang-3.5pre": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"), |
| 30 | "hello-unknown-kalimba_arch4-kcc-36": re.compile(r"kalimba4-csr-(unknown|\*)(-unknown)? kalimba"), |
| 31 | "hello-unknown-kalimba_arch5-kcc-39": re.compile(r"kalimba5-csr-(unknown|\*)(-unknown)? kalimba"), |
Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | for image_name in images: |
Todd Fiala | 6ce5b63 | 2014-06-27 20:07:03 +0000 | [diff] [blame] | 35 | file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "bin", image_name)) |
Todd Fiala | b91de78 | 2014-06-27 16:52:49 +0000 | [diff] [blame] | 36 | expected_triple_and_arch_regex = images[image_name] |
| 37 | |
| 38 | self.runCmd("file {}".format(file_name)) |
| 39 | self.match("image list -t -A", [expected_triple_and_arch_regex]) |
Greg Clayton | 615eb7e | 2014-09-19 20:11:50 +0000 | [diff] [blame] | 40 | # Revert to the host platform after all of this is done |
| 41 | self.runCmd("platform select host") |