diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 16:38:47 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 16:38:47 +0000 |
commit | 22314179f0660c172514b397060fd8f34b586e82 (patch) | |
tree | afb3f04cd285733772ffceec4ccf3d8539dca91c /lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp | |
parent | df14bd315db94d286c0c75b4b6ee5d760f311399 (diff) | |
download | bcm5719-llvm-22314179f0660c172514b397060fd8f34b586e82.tar.gz bcm5719-llvm-22314179f0660c172514b397060fd8f34b586e82.zip |
[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
Diffstat (limited to 'lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp')
-rw-r--r-- | lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp new file mode 100644 index 00000000000..3c4b005cdf1 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp @@ -0,0 +1,111 @@ +// To avoid linking MSVC specific libs, we don't test virtual/override methods +// that needs vftable support in this file. + +// Enum. +enum Enum { RED, GREEN, BLUE }; +Enum EnumVar; + +// Union. +union Union { + short Row; + unsigned short Col; + int Line : 16; // Test named bitfield. + short : 8; // Unnamed bitfield symbol won't be generated in PDB. + long Table; +}; +Union UnionVar; + +// Struct. +struct Struct; +typedef Struct StructTypedef; + +struct Struct { + bool A; + unsigned char UCharVar; + unsigned int UIntVar; + long long LongLongVar; + Enum EnumVar; // Test struct has UDT member. + int array[10]; +}; +struct Struct StructVar; + +struct _List; // Forward declaration. +struct Complex { + struct _List *array[90]; + struct { // Test unnamed struct. MSVC treats it as `int x` + int x; + }; + union { // Test unnamed union. MSVC treats it as `int a; float b;` + int a; + float b; + }; +}; +struct Complex c; + +struct _List { // Test doubly linked list. + struct _List *current; + struct _List *previous; + struct _List *next; +}; +struct _List ListVar; + +typedef struct { + int a; +} UnnamedStruct; // Test unnamed typedef-ed struct. +UnnamedStruct UnnanmedVar; + +// Class. +namespace MemberTest { +class Base { +public: + Base() {} + ~Base() {} + +public: + int Get() { return 0; } + +protected: + int a; +}; +class Friend { +public: + int f() { return 3; } +}; +class Class : public Base { // Test base class. + friend Friend; + static int m_static; // Test static member variable. +public: + Class() : m_public(), m_private(), m_protected() {} + explicit Class(int a) { m_public = a; } // Test first reference of m_public. + ~Class() {} + + static int StaticMemberFunc(int a, ...) { + return 1; + } // Test static member function. + int Get() { return 1; } + int f(Friend c) { return c.f(); } + inline bool operator==(const Class &rhs) const // Test operator. + { + return (m_public == rhs.m_public); + } + +public: + int m_public; + struct Struct m_struct; + +private: + Union m_union; + int m_private; + +protected: + friend class Friend; + int m_protected; +}; +} // namespace MemberTest + +int main() { + MemberTest::Base B1; + B1.Get(); + MemberTest::Class::StaticMemberFunc(1, 10, 2); + return 0; +} |