From 22314179f0660c172514b397060fd8f34b586e82 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 9 Oct 2019 16:38:47 +0000 Subject: [test] Split LLDB tests into API, Shell & Unit LLDB has three major testing strategies: unit tests, tests that exercise the SB API though dotest.py and what we currently call lit tests. The later is rather confusing as we're now using lit as the driver for all three types of tests. As most of this grew organically, the directory structure in the LLDB repository doesn't really make this clear. The 'lit' tests are part of the root and among these tests there's a Unit and Suite folder for the unit and dotest-tests. This layout makes it impossible to run just the lit tests. This patch changes the directory layout to match the 3 testing strategies, each with their own directory and their own configuration file. This means there are now 3 directories under lit with 3 corresponding targets: - API (check-lldb-api): Test exercising the SB API. - Shell (check-lldb-shell): Test exercising command line utilities. - Unit (check-lldb-unit): Unit tests. Finally, there's still the `check-lldb` target that runs all three test suites. Finally, this also renames the lit folder to `test` to match the LLVM repository layout. Differential revision: https://reviews.llvm.org/D68606 llvm-svn: 374184 --- lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp (limited to 'lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp') diff --git a/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp new file mode 100644 index 00000000000..301ae3067d1 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp @@ -0,0 +1,60 @@ +// clang-format off +// REQUIRES: lld + +// Test various interesting cases for AST reconstruction. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s + +// Test trivial versions of each tag type. +struct Struct { + int A : 5 = 6; + int B : 7 = 8; + unsigned C : 3 = 2; + unsigned D : 15 = 12345; + char E : 1 = 0; + char F : 2 = 1; + char G : 3 = 2; + // H should be at offset 0 of a new byte. + char H : 3 = 3; +}; + +constexpr Struct TheStruct; + + +int main(int argc, char **argv) { + return TheStruct.A; +} + +// CHECK: (lldb) target variable -T TheStruct +// CHECK: (const Struct) TheStruct = { +// CHECK: (int:5) A = 6 +// CHECK: (int:7) B = 8 +// CHECK: (unsigned int:3) C = 2 +// CHECK: (unsigned int:15) D = 12345 +// CHECK: (char:1) E = '\0' +// CHECK: (char:2) F = '\x01' +// CHECK: (char:3) G = '\x02' +// CHECK: (char:3) H = '\x03' +// CHECK: } +// +// CHECK: target modules dump ast +// CHECK: Dumping clang ast for 1 modules. +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} struct Struct definition +// CHECK: | |-FieldDecl {{.*}} A 'int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 5 +// CHECK: | |-FieldDecl {{.*}} B 'int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 7 +// CHECK: | |-FieldDecl {{.*}} C 'unsigned int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3 +// CHECK: | |-FieldDecl {{.*}} D 'unsigned int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 15 +// CHECK: | |-FieldDecl {{.*}} E 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 1 +// CHECK: | |-FieldDecl {{.*}} F 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 2 +// CHECK: | |-FieldDecl {{.*}} G 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3 +// CHECK: | `-FieldDecl {{.*}} H 'char' +// CHECK: | `-IntegerLiteral {{.*}} 'int' 3 -- cgit v1.2.3