Skip to content

Commit

Permalink
Wrap all references to build artifacts in the LLDB testsuite (NFC)
Browse files Browse the repository at this point in the history
in TestBase::getBuildArtifact(). This NFC commit is in preparation for
https://reviews.llvm.org/D42281 (compile the LLDB tests out-of-tree).

Differential Revision: https://reviews.llvm.org/D42280

llvm-svn: 323007
  • Loading branch information
adrian-prantl committed Jan 19, 2018
1 parent ce8746d commit 595048f
Show file tree
Hide file tree
Showing 413 changed files with 639 additions and 621 deletions.
Expand Up @@ -19,7 +19,7 @@ class DefaultCacheLineSizeTestCase(TestBase):
@skipUnlessPlatform(['android'])
def test_cache_line_size(self):
self.build(dictionary=self.getBuildFlags())
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target and target.IsValid(), "Target is valid")

Expand Down
Expand Up @@ -20,7 +20,7 @@ class SBDirCheckerCase(TestBase):
def setUp(self):
TestBase.setUp(self)
self.source = 'main.cpp'
self.exe_name = 'a.out'
self.exe_name = self.getBuildArtifact("a.out")
self.generateSource(self.source)

@skipIfNoSBHeaders
Expand All @@ -39,7 +39,7 @@ def test_sb_api_directory(self):

def sanity_check_executable(self, exe_name):
"""Sanity check executable compiled from the auto-generated program."""
exe = os.path.join(os.getcwd(), exe_name)
exe = self.getBuildArtifact(exe_name)
self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)

self.line_to_break = line_number(
Expand Down
Expand Up @@ -35,7 +35,7 @@ def test_receiving_breakpoint_added(self):
lldb.SBTarget.GetBroadcasterClassName(),
lldb.SBTarget.eBroadcastBitBreakpointChanged)

exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")

target = self.dbg.CreateTarget(exe)

Expand Down
Expand Up @@ -21,7 +21,7 @@ class TestBreakpointIt(TestBase):
@skipIf(archs=no_match(["arm"]))
def test_false(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")

self.runCmd("target create %s" % exe)
lldbutil.run_break_set_by_symbol(self, "bkpt_false",
Expand All @@ -34,7 +34,7 @@ def test_false(self):
@skipIf(archs=no_match(["arm"]))
def test_true(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")

self.runCmd("target create %s" % exe)
bpid = lldbutil.run_break_set_by_symbol(self, "bkpt_true",
Expand Down
Expand Up @@ -30,7 +30,8 @@ def setUp(self):

def data_formatter_commands(self):
"""Benchmark different ways to continue a process"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file "+self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)

bkpt = self.target().FindBreakpointByID(
lldbutil.run_break_set_by_source_regexp(
Expand Down
Expand Up @@ -39,7 +39,7 @@ def test_expr_cmd(self):

def run_lldb_repeated_exprs(self, exe_name, count):
import pexpect
exe = os.path.join(os.getcwd(), exe_name)
exe = self.getBuildArtifact(exe_name)

# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
Expand Down
Expand Up @@ -44,7 +44,7 @@ def test_compare_lldb_to_gdb(self):

def run_lldb_repeated_exprs(self, exe_name, count):
import pexpect
exe = os.path.join(os.getcwd(), exe_name)
exe = self.getBuildArtifact(exe_name)

# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
Expand Down
Expand Up @@ -30,7 +30,8 @@ def setUp(self):

def data_formatter_commands(self):
"""Benchmark the std::list data formatter (libc++)"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)

bkpt = self.target().FindBreakpointByID(
lldbutil.run_break_set_by_source_regexp(
Expand Down
Expand Up @@ -30,7 +30,8 @@ def setUp(self):

def data_formatter_commands(self):
"""Benchmark the std::map data formatter (libc++)"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " +self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)

bkpt = self.target().FindBreakpointByID(
lldbutil.run_break_set_by_source_regexp(
Expand Down
2 changes: 1 addition & 1 deletion lldb/packages/Python/lldbsuite/test/concurrent_base.py
Expand Up @@ -114,7 +114,7 @@ def do_thread_actions(self,
watchpoint_func. The inferior is continued until exit or a crash takes place, and the number of events seen by LLDB
is verified to match the expected number of events.
"""
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

# Get the target
Expand Down
2 changes: 1 addition & 1 deletion lldb/packages/Python/lldbsuite/test/darwin_log.py
Expand Up @@ -346,7 +346,7 @@ def do_test(self, enable_options, settings_commands=None,
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)

exe = os.path.join(os.getcwd(), self.exe_name)
exe = self.getBuildArtifact(self.exe_name)

# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
Expand Down
Expand Up @@ -46,7 +46,7 @@ def test_batch_mode_run_crash(self):
self.setTearDownCleanup()

import pexpect
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
prompt = "(lldb) "

# Pass CRASH so the process will crash and stop in batch mode.
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_batch_mode_run_exit(self):
self.setTearDownCleanup()

import pexpect
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
prompt = "(lldb) "

# Now do it again, and make sure if we don't crash, we quit:
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_batch_mode_attach_exit(self):
self.setTearDownCleanup()

import pexpect
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
prompt = "(lldb) "

# Finally, start up the process by hand, attach to it, and wait for its completion.
Expand Down
Expand Up @@ -32,7 +32,8 @@ def test(self):
"""Test typedeffed untagged struct arguments for function call expressions"""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file "+self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)
lldbutil.run_break_set_by_file_and_line(
self,
"main.cpp",
Expand Down
Expand Up @@ -30,7 +30,8 @@ def setUp(self):
def test_with(self):
"""Test calling std::String member function."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)

# Some versions of GCC encode two locations for the 'return' statement
# in main.cpp
Expand Down
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
def test(self):
"""Test gathering result from interrupted function call."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

# Some versions of GCC encode two locations for the 'return' statement
# in main.cpp
Expand Down
Expand Up @@ -37,7 +37,7 @@ def test(self):
self.build()

# Set breakpoint in main and run exe
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
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=True)

Expand Down
Expand Up @@ -22,7 +22,7 @@ def test_setpgid(self):
self.expr_syscall()

def expr_syscall(self):
exe = os.path.join(os.getcwd(), 'a.out')
exe = self.getBuildArtifact("a.out")

# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
Expand Down
Expand Up @@ -43,7 +43,7 @@ def cleanup():
self.addTearDownHook(cleanup)

"""Test expr + formatters for good interoperability."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self, "main.cpp", self.line, loc_exact=True)
Expand Down
Expand Up @@ -17,7 +17,7 @@ def test_phi_node_support(self):
"""Test support for PHI nodes in the IR interpreter."""

self.build()
exe = os.path.join(os.getcwd(), 'a.out')
exe = self.getBuildArtifact("a.out")
self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)

# Break on the first assignment to i
Expand Down
Expand Up @@ -34,7 +34,7 @@ def build_and_run(self):
"""Test the IR interpreter"""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
Expand Down
Expand Up @@ -28,7 +28,7 @@ def test_with_run_commands(self):
"""Test that multiline expressions work correctly"""
self.build()
import pexpect
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
prompt = "(lldb) "

# So that the child gets torn down after the test.
Expand Down
Expand Up @@ -28,7 +28,7 @@ def setUp(self):
self.main_source = "main.cpp"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
self.line = line_number('main.cpp', '// breakpoint_in_main')
self.exe = os.path.join(os.getcwd(), "a.out")
self.exe = self.getBuildArtifact("a.out")

def test_expr_options(self):
"""These expression command options should work as expected."""
Expand Down
Expand Up @@ -34,7 +34,7 @@ def cleanup():
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self, "main.m", self.line, loc_exact=True)
Expand Down
Expand Up @@ -28,7 +28,7 @@ def cleanup():
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

self.runCmd('break set -p here')

Expand Down
Expand Up @@ -22,7 +22,7 @@ def test_persistent_types(self):
"""Test that nested persistent types work."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

self.runCmd("breakpoint set --name main")

Expand Down
Expand Up @@ -22,7 +22,7 @@ def test_persistent_types(self):
"""Test that lldb persistent types works correctly."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

self.runCmd("breakpoint set --name main")

Expand Down
Expand Up @@ -19,7 +19,7 @@ def test_persistent_variables(self):
"""Test that lldb persistent variables works correctly."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

self.runCmd("breakpoint set --source-pattern-regexp break")

Expand Down
Expand Up @@ -37,7 +37,7 @@ def cleanup():
self.addTearDownHook(cleanup)

"""Test expr + formatters for good interoperability."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self, "main.m", self.line, loc_exact=True)
Expand Down
Expand Up @@ -19,7 +19,7 @@ def test_expr_commands(self):
"""The following expression commands should not crash."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

self.runCmd("breakpoint set -n c")

Expand Down
Expand Up @@ -23,7 +23,7 @@ def test_expr_commands(self):
"""The evaluating printf(...) after break stop and then up a stack frame."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_symbol(
self, 'foo', sym_exact=True, num_expected_locations=1)
Expand Down
Expand Up @@ -29,7 +29,7 @@ def test_expr_commands(self):
"""The following expression commands should just work."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self,
Expand Down
Expand Up @@ -45,7 +45,7 @@ def build_and_run(self):
"""These basic expression commands should work as expected."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
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)
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_evaluate_expression_python(self):
"""Test SBFrame.EvaluateExpression() API for evaluating an expression."""
self.build()

exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")

target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_expr_commands_can_handle_quotes(self):
"""Throw some expression commands with quotes at lldb."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
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)
Expand Down
Expand Up @@ -31,7 +31,7 @@ def test_more_expr_commands(self):
"""Test some more expression commands."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
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)
Expand Down
Expand Up @@ -37,7 +37,7 @@ def build_and_run(self):
"""Test top-level expressions."""
self.build()

self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
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)
Expand Down
Expand Up @@ -28,7 +28,7 @@ def setUp(self):
def test(self):
"""The expression parser's type search should be wider than the current compilation unit."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

lldbutil.run_break_set_by_file_and_line(
self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
Expand Down
Expand Up @@ -26,7 +26,7 @@ def setUp(self):
def test_apropos_with_process(self):
"""Test that apropos env doesn't crash trying to touch the process plugin commmand."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

# Break in main() aftre the variables are assigned values.
Expand Down
Expand Up @@ -35,7 +35,7 @@ def test(self):
"""Break inside a() and b() defined within libfoo.a."""
self.build()

exe = os.path.join(os.getcwd(), "a.out")
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

# Break inside a() by file and line first.
Expand Down

0 comments on commit 595048f

Please sign in to comment.