diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-09-01 09:12:37 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-09-01 09:12:37 +0000 |
commit | 29872606d220420d53fde7cc5e3bea15f8da62e7 (patch) | |
tree | 47d7a82ccea48a6dd10a2d8ecb6b3c3127724131 /lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols | |
parent | adfdcb9c2652aeee585b9005fd6c67be06af8ea9 (diff) | |
download | bcm5719-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/weak_symbols')
6 files changed, 0 insertions, 155 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/Makefile deleted file mode 100644 index ea434d42714..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -LEVEL = ../../make -CFLAGS_EXTRAS += -std=c99 -LD_FLAGS := -dynamiclib -include $(LEVEL)/Makefile.rules - -all: a.out dylib missing - -dylib: dylib.o - $(CC) $(LD_FLAGS) -o libdylib.dylib dylib.o - -missing: dylib2.o - mkdir hidden - $(CC) $(LD_FLAGS) -o hidden/libdylib.dylib dylib2.o - -a.out: main.o dylib missing - $(CC) $(CFLAGS) -L. -ldylib main.o - -dylib.o: dylib.h $(SRCDIR)/dylib.c - $(CC) -DHAS_THEM $(CFLAGS) -c $(SRCDIR)/dylib.c - -dylib2.o: dylib.h $(SRCDIR)/dylib.c - $(CC) $(CFLAGS) -c $(SRCDIR)/dylib.c -o dylib2.o - -main.o: dylib.h $(SRCDIR)/main.c - $(CC) $(CFLAGS) -c $(SRCDIR)/main.c -fmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR) - diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/TestWeakSymbols.py b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/TestWeakSymbols.py deleted file mode 100644 index 2999cba7d99..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/TestWeakSymbols.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test that we can compile expressions referring to -absent weak symbols from a dylib. -""" - -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test import decorators -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class TestWeakSymbolsInExpressions(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - @decorators.skipUnlessDarwin - def test_weak_symbol_in_expr(self): - """Tests that we can refer to weak symbols in expressions.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.c") - self.do_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def run_weak_var_check (self, weak_varname, present): - # The expression will modify present_weak_int to signify which branch - # was taken. Set it to so we don't get confused by a previous run. - value = self.target.FindFirstGlobalVariable("present_weak_int") - value.SetValueFromCString("0") - if present: - correct_value = 10 - else: - correct_value = 20 - - # Note, I'm adding the "; 10" at the end of the expression to work around - # the bug that expressions with no result currently return False for Success()... - expr = "if (&" + weak_varname + " != NULL) { present_weak_int = 10; } else { present_weak_int = 20;}; 10" - result = self.frame.EvaluateExpression(expr) - self.assertTrue(result.GetError().Success(), "absent_weak_int expr failed: %s"%(result.GetError().GetCString())) - self.assertEqual(value.GetValueAsSigned(), correct_value, "Didn't change present_weak_int correctly.") - - def do_test(self): - hidden_dir = os.path.join(self.getBuildDir(), "hidden") - - launch_info = lldb.SBLaunchInfo(None) - launch_info.SetWorkingDirectory(self.getBuildDir()) - # We have to point to the hidden directory to pick up the - # version of the dylib without the weak symbols: - env_expr = self.platformContext.shlib_environment_var + "=" + hidden_dir - launch_info.SetEnvironmentEntries([env_expr], True) - - (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, - "Set a breakpoint here", self.main_source_file, - launch_info = launch_info) - # First we have to import the Dylib module so we get the type info - # for the weak symbol. We need to add the source dir to the module - # search paths, and then run @import to introduce it into the expression - # context: - self.dbg.HandleCommand("settings set target.clang-module-search-paths " + self.getSourceDir()) - - self.frame = thread.frames[0] - self.assertTrue(self.frame.IsValid(), "Got a good frame") - options = lldb.SBExpressionOptions() - options.SetLanguage(lldb.eLanguageTypeObjC) - result = self.frame.EvaluateExpression("@import Dylib", options) - - # Now run an expression that references an absent weak symbol: - self.run_weak_var_check("absent_weak_int", False) - self.run_weak_var_check("absent_weak_function", False) - - # Make sure we can do the same thing with present weak symbols - self.run_weak_var_check("present_weak_int", True) - self.run_weak_var_check("present_weak_function", True) diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.c b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.c deleted file mode 100644 index dc513e5c5fb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "dylib.h" - -int present_weak_int = 10; -int present_weak_function() -{ - return present_weak_int; -} - -#if defined HAS_THEM -int absent_weak_int = 10; -int absent_weak_function() { - return absent_weak_int; -} -#endif diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.h b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.h deleted file mode 100644 index f668ec0a784..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/dylib.h +++ /dev/null @@ -1,8 +0,0 @@ -extern int absent_weak_int __attribute__((weak_import)); - -extern int present_weak_int __attribute__((weak_import)); - -extern int absent_weak_function() __attribute__((weak_import)); - -extern int present_weak_function() __attribute__((weak_import)); - diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/main.c b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/main.c deleted file mode 100644 index 5ea257bae5b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/main.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "dylib.h" -#include <stdio.h> - -int -doSomething() -{ - // Set a breakpoint here. - if (&absent_weak_int != NULL) - printf("In absent_weak_int: %d\n", absent_weak_int); - if (absent_weak_function != NULL) - printf("In absent_weak_func: %p\n", absent_weak_function); - if (&present_weak_int != NULL) - printf("In present_weak_int: %d\n", present_weak_int); - if (present_weak_function != NULL) - printf("In present_weak_func: %p\n", present_weak_function); - -} - -int -main() -{ - return doSomething(); -} diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/module.modulemap b/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/module.modulemap deleted file mode 100644 index 6f7671400bc..00000000000 --- a/lldb/packages/Python/lldbsuite/test/expression_command/weak_symbols/module.modulemap +++ /dev/null @@ -1,3 +0,0 @@ -module Dylib { - header "dylib.h" -} |