diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:57 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:57 +0000 | 
| commit | 88c643b6fec27eec436c8d138fee6346e92337d6 (patch) | |
| tree | 82cd13b2f3cde1c9e5f79689ba4e6ba67694843f /packages/Python/lldbsuite/test/expression_command/top-level | |
| parent | 94994d372d014ce4c8758b9605d63fae651bd8aa (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/expression_command/top-level')
6 files changed, 0 insertions, 246 deletions
| diff --git a/packages/Python/lldbsuite/test/expression_command/top-level/Makefile b/packages/Python/lldbsuite/test/expression_command/top-level/Makefile deleted file mode 100644 index 9e35242c72fa..000000000000 --- a/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/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py b/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py deleted file mode 100644 index 1a8a619b0ed2..000000000000 --- a/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Test top-level expressions. -""" - -from __future__ import print_function - - -import unittest2 - -import os -import time -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/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp deleted file mode 100644 index fa49bd4bda7e..000000000000 --- a/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/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk b/packages/Python/lldbsuite/test/expression_command/top-level/dummy.mk deleted file mode 100644 index af97678b2cf5..000000000000 --- a/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/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp b/packages/Python/lldbsuite/test/expression_command/top-level/main.cpp deleted file mode 100644 index f9b2dd4c6d9d..000000000000 --- a/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/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp b/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp deleted file mode 100644 index 5a978743596a..000000000000 --- a/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; -} - -// -- | 
