================
@@ -105,6 +105,20 @@ def test_resolve_file_address(self):
self.assertIsNotNone(data_section2)
self.assertEqual(data_section.name, data_section2.name)
+ def test_get_arch_name(self):
+ d = {"EXE": "b.out"}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ target = self.create_simple_target("b.out")
+
+ arch_name = target.arch_name
+ self.assertNotEqual(len(arch_name), 0, "Got an arch name string")
----------------
n2h9 wrote:
In that case `build` also does not take architecture into account, tried both
`arch` and `architecture` :cry: .
```
expected_arch = "aarch64"
d = {
"EXE": "b.out",
"arch": expected_arch,
}
self.build(dictionary=d)
....
print(">>>>")
print(f"target.arch_name = {target.arch_name}")
print("<<<<")
```
<details>
<summary>test command output with traces</summary>
```sh
./build/bin/lldb-dotest \
-v -t -p TestTargetAPI.py \
-f test_get_arch_name_dwarf \
-f test_get_arch_name_dwo \
-f test_get_arch_name_dsym \
--arch aarch64 \
lldb/test/API/python_api/target
/usr/bin/python3 /home/ubuntu/code/llvm-project/lldb/test/API/dotest.py --arch
x86_64 -u CXXFLAGS -u CFLAGS --build-dir
/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex --executable
/home/ubuntu/code/llvm-project/build/./bin/lldb --compiler
/home/ubuntu/code/llvm-project/build/./bin/clang --dsymutil
/home/ubuntu/code/llvm-project/build/./bin/dsymutil --make /usr/bin/gmake
--lldb-libs-dir /home/ubuntu/code/llvm-project/build/./lib --llvm-tools-dir
/home/ubuntu/code/llvm-project/build/./bin --lldb-obj-root
/home/ubuntu/code/llvm-project/build/tools/lldb --cmake-build-type Debug -v -t
-p TestTargetAPI.py -f test_get_arch_name_dwarf -f test_get_arch_name_dwo -f
test_get_arch_name_dsym --arch aarch64 lldb/test/API/python_api/target
lldb version 22.0.0git (https://github.com/n2h9/fork-llvm-project revision
0dfb712313fa7689e936e572fde6ac99197806df)
clang revision 0dfb712313fa7689e936e572fde6ac99197806df
llvm revision 0dfb712313fa7689e936e572fde6ac99197806df
libc++ tests will not be run because: API tests require a locally built libc++.
msvcstl tests will not be run because: Don't know how to build with MSVC's STL
on linux
objc tests will be skipped because of unsupported platform
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'pdb',
'gmodules', 'debugserver', 'objc']
adding filter spec TargetAPITestCase.test_get_arch_name_dwarf to module <module
'TestTargetAPI' from
'/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py'>
adding filter spec TargetAPITestCase.test_get_arch_name_dwo to module <module
'TestTargetAPI' from
'/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py'>
adding filter spec TargetAPITestCase.test_get_arch_name_dsym to module <module
'TestTargetAPI' from
'/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py'>
compiler=/home/ubuntu/code/llvm-project/build/bin/clang
Configuration: arch=aarch64
compiler=/home/ubuntu/code/llvm-project/build/bin/clang
----------------------------------------------------------------------
Collected 3 tests
Change dir to: /home/ubuntu/code/llvm-project/lldb/test/API/python_api/target
1: test_get_arch_name_dwarf
(TestTargetAPI.TargetAPITestCase.test_get_arch_name_dwarf) ... runCmd: settings
clear --all
output:
runCmd: settings set symbols.enable-external-lookup false
output:
runCmd: settings set target.inherit-tcc true
output:
runCmd: settings set target.disable-aslr false
output:
runCmd: settings set target.detach-on-error false
output:
runCmd: settings set target.auto-apply-fixits false
output:
runCmd: settings set plugin.process.gdb-remote.packet-timeout 60
output:
runCmd: settings set symbols.clang-modules-cache-path
"/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/module-cache-lldb"
output:
runCmd: settings set use-color false
output:
runCmd: settings set show-statusline false
output:
/usr/bin/gmake
VPATH=/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target -C
/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwarf
-I /home/ubuntu/code/llvm-project/lldb/test/API/python_api/target -I
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make -f
/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/Makefile
MAKE_DSYM=NO all ARCH=aarch64 CC=/home/ubuntu/code/llvm-project/build/bin/clang
CC_TYPE=clang CXX=/home/ubuntu/code/llvm-project/build/bin/clang++
LLVM_AR=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
AR=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
OBJCOPY=/home/ubuntu/code/llvm-project/build/./bin/llvm-objcopy
STRIP=/home/ubuntu/code/llvm-project/build/./bin/llvm-strip
ARCHIVER=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
DWP=/home/ubuntu/code/llvm-project/build/./bin/llvm-dwp
CLANG_MODULE_CACHE_DIR=/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/module-cache-clang
LLDB_OBJ_ROOT=/home/ubuntu/code/llvm-project/build/tools/lldb EXE=b.out
arch=aarch64 OS=Linux HOST_OS=Linux
gmake: Entering directory
'/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwarf'
/home/ubuntu/code/llvm-project/build/bin/clang -g -O0
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include
-I/home/ubuntu/code/llvm-project/build/tools/lldb/include
-I/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make
-include
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h
-fno-limit-debug-info -D_DEFAULT_SOURCE -MT main.o -MD -MP -MF main.d -c -o
main.o /home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/main.c
/home/ubuntu/code/llvm-project/build/bin/clang main.o -g -O0
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include
-I/home/ubuntu/code/llvm-project/build/tools/lldb/include
-I/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make
-include
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h
-fno-limit-debug-info -D_DEFAULT_SOURCE --driver-mode=g++ -o "b.out"
gmake: Leaving directory
'/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwarf'
>>>>
target.arch_name = x86_64
<<<<
ok
PASS: LLDB (/home/ubuntu/code/llvm-project/build/bin/clang-aarch64) ::
test_get_arch_name_dwarf
(TestTargetAPI.TargetAPITestCase.test_get_arch_name_dwarf)
2: test_get_arch_name_dwo
(TestTargetAPI.TargetAPITestCase.test_get_arch_name_dwo) ... runCmd: settings
clear --all
output:
runCmd: settings set symbols.enable-external-lookup false
output:
runCmd: settings set target.inherit-tcc true
output:
runCmd: settings set target.disable-aslr false
output:
runCmd: settings set target.detach-on-error false
output:
runCmd: settings set target.auto-apply-fixits false
output:
runCmd: settings set plugin.process.gdb-remote.packet-timeout 60
output:
runCmd: settings set symbols.clang-modules-cache-path
"/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/module-cache-lldb"
output:
runCmd: settings set use-color false
output:
runCmd: settings set show-statusline false
output:
/usr/bin/gmake
VPATH=/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target -C
/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwo
-I /home/ubuntu/code/llvm-project/lldb/test/API/python_api/target -I
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make -f
/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/Makefile
MAKE_DSYM=NO MAKE_DWO=YES all ARCH=aarch64
CC=/home/ubuntu/code/llvm-project/build/bin/clang CC_TYPE=clang
CXX=/home/ubuntu/code/llvm-project/build/bin/clang++
LLVM_AR=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
AR=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
OBJCOPY=/home/ubuntu/code/llvm-project/build/./bin/llvm-objcopy
STRIP=/home/ubuntu/code/llvm-project/build/./bin/llvm-strip
ARCHIVER=/home/ubuntu/code/llvm-project/build/./bin/llvm-ar
DWP=/home/ubuntu/code/llvm-project/build/./bin/llvm-dwp
CLANG_MODULE_CACHE_DIR=/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/module-cache-clang
LLDB_OBJ_ROOT=/home/ubuntu/code/llvm-project/build/tools/lldb EXE=b.out
arch=aarch64 OS=Linux HOST_OS=Linux
gmake: Entering directory
'/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwo'
/home/ubuntu/code/llvm-project/build/bin/clang -g -O0
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include
-I/home/ubuntu/code/llvm-project/build/tools/lldb/include
-I/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make
-include
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h
-fno-limit-debug-info -gsplit-dwarf -D_DEFAULT_SOURCE -MT main.o -MD -MP -MF
main.d -c -o main.o
/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target/main.c
/home/ubuntu/code/llvm-project/build/bin/clang main.o -g -O0
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include
-I/home/ubuntu/code/llvm-project/build/tools/lldb/include
-I/home/ubuntu/code/llvm-project/lldb/test/API/python_api/target
-I/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make
-include
/home/ubuntu/code/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h
-fno-limit-debug-info -gsplit-dwarf -D_DEFAULT_SOURCE --driver-mode=g++
-o "b.out"
gmake: Leaving directory
'/home/ubuntu/code/llvm-project/build/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_arch_name_dwo'
>>>>
target.arch_name = x86_64
<<<<
ok
PASS: LLDB (/home/ubuntu/code/llvm-project/build/bin/clang-aarch64) ::
test_get_arch_name_dwo (TestTargetAPI.TargetAPITestCase.test_get_arch_name_dwo)
3: test_get_arch_name_dsym
(TestTargetAPI.TargetAPITestCase.test_get_arch_name_dsym) ... skipped 'test
case does not fall in any category of interest for this run'
UNSUPPORTED: LLDB (/home/ubuntu/code/llvm-project/build/bin/clang-aarch64) ::
test_get_arch_name_dsym
(TestTargetAPI.TargetAPITestCase.test_get_arch_name_dsym) (test case does not
fall in any category of interest for this run)
Restore dir to: /home/ubuntu/code/llvm-project
----------------------------------------------------------------------
Ran 3 tests in 0.659s
OK (skipped=1)
Session logs for test failures/errors/unexpected successes can be found in the
test build directory
```
</details>
https://github.com/llvm/llvm-project/pull/168273
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits