summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/expression_command/top-level
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-01 09:12:37 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-01 09:12:37 +0000
commit29872606d220420d53fde7cc5e3bea15f8da62e7 (patch)
tree47d7a82ccea48a6dd10a2d8ecb6b3c3127724131 /lldb/packages/Python/lldbsuite/test/expression_command/top-level
parentadfdcb9c2652aeee585b9005fd6c67be06af8ea9 (diff)
downloadbcm5719-llvm-29872606d220420d53fde7cc5e3bea15f8da62e7.tar.gz
bcm5719-llvm-29872606d220420d53fde7cc5e3bea15f8da62e7.zip
[lldb] Restructure test folders to match LLDB command hierarchy
Summary: As discussed on lldb-dev, this patch moves some LLDB tests into a hierarchy that more closely resembles the commands we use in the LLDB interpreter. This patch should only move tests that use the command interpreter and shouldn't touch any tests that primarily test the SB API. Reviewers: #lldb, jfb, JDevlieghere Reviewed By: #lldb, JDevlieghere Subscribers: dexonsmith, arphaman, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67033 llvm-svn: 370605
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command/top-level')
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile13
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py94
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp15
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk6
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp9
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp107
6 files changed, 0 insertions, 244 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
deleted file mode 100644
index 9e35242c72f..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp test.cpp
-
-include $(LEVEL)/Makefile.rules
-
-a.out: dummy
-
-dummy:
- $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk
-
-clean::
- $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk clean
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
deleted file mode 100644
index e6a632b7f23..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
+++ /dev/null
@@ -1,94 +0,0 @@
-"""
-Test top-level expressions.
-"""
-
-from __future__ import print_function
-
-
-import unittest2
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class TopLevelExpressionsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break for main.c.
- self.line = line_number('main.cpp',
- '// Set breakpoint here')
- self.dummy_line = line_number('dummy.cpp',
- '// Set breakpoint here')
-
- # Disable confirmation prompt to avoid infinite wait
- self.runCmd("settings set auto-confirm true")
- self.addTearDownHook(
- lambda: self.runCmd("settings clear auto-confirm"))
-
- def build_and_run(self):
- """Test top-level expressions."""
- self.build()
-
- self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line(
- self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- def run_dummy(self):
- self.runCmd("file " + self.getBuildArtifact("dummy"),
- CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line(
- self,
- "dummy.cpp",
- self.dummy_line,
- num_expected_locations=1,
- loc_exact=False)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- @add_test_categories(['pyapi'])
- @skipIf(debug_info="gmodules") # not relevant
- @skipIf(oslist=["windows"]) # Error in record layout on Windows
- def test_top_level_expressions(self):
- self.build_and_run()
-
- resultFromCode = self.frame().EvaluateExpression("doTest()").GetValueAsUnsigned()
-
- self.runCmd("kill")
-
- self.run_dummy()
-
- codeFile = open('test.cpp', 'r')
-
- expressions = []
- current_expression = ""
-
- for line in codeFile:
- if line.startswith("// --"):
- expressions.append(current_expression)
- current_expression = ""
- else:
- current_expression += line
-
- options = lldb.SBExpressionOptions()
- options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
- options.SetTopLevel(True)
-
- for expression in expressions:
- self.frame().EvaluateExpression(expression, options)
-
- resultFromTopLevel = self.frame().EvaluateExpression("doTest()")
-
- self.assertTrue(resultFromTopLevel.IsValid())
- self.assertEqual(
- resultFromCode,
- resultFromTopLevel.GetValueAsUnsigned())
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
deleted file mode 100644
index fa49bd4bda7..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdio.h>
-
-// These are needed to make sure that the linker does not strip the parts of the
-// C++ abi library that are necessary to execute the expressions in the
-// debugger. It would be great if we did not need to do this, but the fact that
-// LLDB cannot conjure up the abi library on demand is not relevant for testing
-// top level expressions.
-struct DummyA {};
-struct DummyB : public virtual DummyA {};
-
-int main() {
- DummyB b;
- printf("This is a dummy\n"); // Set breakpoint here
- return 0;
-}
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk
deleted file mode 100644
index af97678b2cf..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := dummy.cpp
-EXE := dummy
-
-include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp
deleted file mode 100644
index f9b2dd4c6d9..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdio.h>
-
-extern int doTest();
-
-int main()
-{
- printf("%d\n", doTest()); // Set breakpoint here
- return 0;
-}
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp
deleted file mode 100644
index 5a978743596..00000000000
--- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-class MyClass
-{
-public:
- int memberResult()
- {
- return 1;
- }
- static int staticResult()
- {
- return 1;
- }
- int externResult();
-};
-
-// --
-
-int MyClass::externResult()
-{
- return 1;
-}
-
-// --
-
-MyClass m;
-
-// --
-
-enum MyEnum {
- myEnumOne = 1,
- myEnumTwo,
- myEnumThree
-};
-
-// --
-
-class AnotherClass
-{
-public:
- __attribute__ ((always_inline)) int complicatedFunction()
- {
- struct {
- int i;
- } s = { 15 };
-
- int numbers[4] = { 2, 3, 4, 5 };
-
- for (signed char number: numbers)
- {
- s.i -= number;
- }
-
- return s.i;
- }
-};
-
-// --
-
-class DiamondA
-{
-private:
- struct {
- int m_i;
- };
-public:
- DiamondA(int i) : m_i(i) { }
- int accessor() { return m_i; }
-};
-
-// --
-
-class DiamondB : public virtual DiamondA
-{
-public:
- DiamondB(int i) : DiamondA(i) { }
-};
-
-// --
-
-class DiamondC : public virtual DiamondA
-{
-public:
- DiamondC(int i) : DiamondA(i) { }
-};
-
-// --
-
-class DiamondD : public DiamondB, public DiamondC
-{
-public:
- DiamondD(int i) : DiamondA(i), DiamondB(i), DiamondC(i) { }
-};
-
-// --
-
-int doTest()
-{
- int accumulator = m.memberResult();
- accumulator += MyClass::staticResult();
- accumulator += m.externResult();
- accumulator += MyEnum::myEnumThree;
- accumulator += myEnumOne;
- accumulator += AnotherClass().complicatedFunction();
- accumulator += DiamondD(3).accessor();
- return accumulator;
-}
-
-// --
OpenPOWER on IntegriCloud