mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-11 08:56:09 +00:00

Summary: A lot of tests do this trick but the vast majority of them don't even call `print()`. Most of this patch was generated by a script that just looks at all the files and deletes the line if there is no `print (` or `print(` anywhere else in the file. I checked the remaining tests manually and deleted the import if we never call print (but instead do stuff like `expr print(...)` and similar false-positives). I also corrected the additional empty lines after the import in the files that I manually edited. Reviewers: JDevlieghere, labath, jfb Reviewed By: labath Subscribers: dexonsmith, wuzish, nemanjai, kbarton, christof, arphaman, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71452
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""
|
|
Describe the purpose of the test class here.
|
|
"""
|
|
|
|
|
|
|
|
import lldb
|
|
import lldbsuite.test.lldbutil as lldbutil
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
|
|
class RenameThisSampleTestTestCase(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
# If your test case doesn't stress debug info, the
|
|
# set this to true. That way it won't be run once for
|
|
# each debug info format.
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
def test_sample_rename_this(self):
|
|
"""There can be many tests in a test case - describe this test here."""
|
|
self.build()
|
|
self.main_source_file = lldb.SBFileSpec("main.c")
|
|
self.sample_test()
|
|
|
|
def setUp(self):
|
|
# Call super's setUp().
|
|
TestBase.setUp(self)
|
|
# Set up your test case here. If your test doesn't need any set up then
|
|
# remove this method from your TestCase class.
|
|
|
|
def sample_test(self):
|
|
"""You might use the test implementation in several ways, say so here."""
|
|
|
|
# This function starts a process, "a.out" by default, sets a source
|
|
# breakpoint, runs to it, and returns the thread, process & target.
|
|
# It optionally takes an SBLaunchOption argument if you want to pass
|
|
# arguments or environment variables.
|
|
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
|
|
"Set a breakpoint here", self.main_source_file)
|
|
|
|
frame = thread.GetFrameAtIndex(0)
|
|
test_var = frame.FindVariable("test_var")
|
|
self.assertTrue(test_var.GetError().Success(), "Failed to fetch test_var")
|
|
test_value = test_var.GetValueAsUnsigned()
|
|
self.assertEqual(test_value, 10, "Got the right value for test_var")
|
|
|