[cross-project] Add tests for LLDB data-formatters for llvm::ArrayRef (#173238)
This patch adds the bare-minimum tests for the LLDB `llvm::ArrayRef` formatters. Since this would be the first LLVM data fromatter test for LLDB, I wanted to keep the test itself minimal and mainly set up/agree on the infrastructure (i.e., CMake machinery, etc.). The setup mimicks that of GDB. The main differences are: 1. the GDB formatter tests put all the test cases in one monolithic test file, whereas I'm planning on having one test-file per LLVM container. 2. the GDB formatter tests currently only get run if LLVM was built with debug-info. Not sure we have any build-bots out there running this configuration. In this patch we rely on just the debug-info from the LLVM headers (see latest commit). That way the tests get more consistently run (at least our public macOS buildbot runs the cross-project-tests in Release+Asserts).
This commit is contained in:
parent
128cc16c25
commit
3eeec298e6
@ -12,12 +12,19 @@ add_llvm_executable(check-gdb-llvm-support
|
||||
)
|
||||
target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
|
||||
|
||||
add_executable(check-lldb-llvm-support-arrayref
|
||||
debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp
|
||||
)
|
||||
target_link_libraries(check-lldb-llvm-support-arrayref PRIVATE LLVMSupport)
|
||||
target_compile_options(check-lldb-llvm-support-arrayref PRIVATE -g -O0)
|
||||
|
||||
set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(CROSS_PROJECT_TEST_DEPS
|
||||
FileCheck
|
||||
check-gdb-llvm-support
|
||||
check-lldb-llvm-support-arrayref
|
||||
count
|
||||
llvm-ar
|
||||
llvm-config
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
|
||||
int Array[] = {1, 2, 3};
|
||||
|
||||
llvm::ArrayRef<int> ArrayRef(Array);
|
||||
llvm::MutableArrayRef<int> MutableArrayRef(Array);
|
||||
|
||||
int main() { return 0; }
|
||||
@ -0,0 +1,25 @@
|
||||
# RUN: split-file %s %t
|
||||
# RUN: lldb -b -x -o 'command script import %llvm_src_root/utils/lldbDataFormatters.py' -s %t/commands.input %llvm_tools_dir/check-lldb-llvm-support-arrayref | FileCheck %t/checks
|
||||
|
||||
#--- commands.input
|
||||
b main
|
||||
run
|
||||
p ArrayRef
|
||||
p MutableArrayRef
|
||||
|
||||
#--- checks
|
||||
# CHECK: (lldb) p ArrayRef
|
||||
# CHECK-NEXT: (llvm::ArrayRef<int>) size=3 {
|
||||
# CHECK-NEXT: [0] = 1
|
||||
# CHECK-NEXT: [1] = 2
|
||||
# CHECK-NEXT: [2] = 3
|
||||
# CHECK-NEXT: }
|
||||
|
||||
# CHECK: (lldb) p MutableArrayRef
|
||||
# CHECK-NEXT: (llvm::MutableArrayRef<int>) {
|
||||
# CHECK-NEXT: llvm::ArrayRef<int> = size=3 {
|
||||
# CHECK-NEXT: [0] = 1
|
||||
# CHECK-NEXT: [1] = 2
|
||||
# CHECK-NEXT: [2] = 3
|
||||
# CHECK-NEXT: }
|
||||
# CHECK-NEXT: }
|
||||
@ -0,0 +1,6 @@
|
||||
import lit.util
|
||||
|
||||
if "native" not in config.available_features or lit.util.which("lldb") is None:
|
||||
config.unsupported = True
|
||||
|
||||
config.suffixes = [".test"]
|
||||
Loading…
x
Reference in New Issue
Block a user