mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Continue the cleanup started on r158737
Adds a utility class method to TestBase that checks and removes a temp file. Removed every use of system() to execute rm -f. llvm-svn: 158809
This commit is contained in:
parent
8cb8e9987b
commit
0eec15acf2
@ -14,7 +14,8 @@ class BreakpointCommandTestCase(TestBase):
|
||||
@classmethod
|
||||
def classCleanup(cls):
|
||||
"""Cleanup the test byproduct of breakpoint_command_sequence(self)."""
|
||||
system(["/bin/sh", "-c", "rm -f output.txt output2.txt"])
|
||||
cls.RemoveTempFile("output.txt")
|
||||
cls.RemoveTempFile("output2.txt")
|
||||
|
||||
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
|
||||
@dsym_test
|
||||
@ -109,10 +110,8 @@ class BreakpointCommandTestCase(TestBase):
|
||||
patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 1"])
|
||||
|
||||
# Run the program. Remove 'output.txt' if it exists.
|
||||
if os.path.exists('output.txt'):
|
||||
os.remove('output.txt')
|
||||
if os.path.exists('output2.txt'):
|
||||
os.remove('output2.txt')
|
||||
self.RemoveTempFile("output.txt")
|
||||
self.RemoveTempFile("output2.txt")
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
||||
# Check that the file 'output.txt' exists and contains the string "lldb".
|
||||
|
@ -1222,3 +1222,8 @@ class TestBase(Base):
|
||||
return
|
||||
|
||||
print child
|
||||
|
||||
@classmethod
|
||||
def RemoveTempFile(cls, file):
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
@ -14,10 +14,10 @@ class SettingsCommandTestCase(TestBase):
|
||||
@classmethod
|
||||
def classCleanup(cls):
|
||||
"""Cleanup the test byproducts."""
|
||||
system(["/bin/sh", "-c", "rm -f output1.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f output2.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f stderr.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f stdout.txt"])
|
||||
cls.RemoveTempFile("output1.txt")
|
||||
cls.RemoveTempFile("output2.txt")
|
||||
cls.RemoveTempFile("stderr.txt")
|
||||
cls.RemoveTempFile("stdout.txt")
|
||||
|
||||
def test_apropos_should_also_search_settings_description(self):
|
||||
"""Test that 'apropos' command should also search descriptions for the settings variables."""
|
||||
|
@ -15,10 +15,10 @@ class CommandLineCompletionTestCase(TestBase):
|
||||
@classmethod
|
||||
def classCleanup(cls):
|
||||
"""Cleanup the test byproducts."""
|
||||
system(["/bin/sh", "-c", "rm -f child_send1.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f child_read1.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f child_send2.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f child_read2.txt"])
|
||||
cls.RemoveTempFile("child_send1.txt")
|
||||
cls.RemoveTempFile("child_read1.txt")
|
||||
cls.RemoveTempFile("child_send2.txt")
|
||||
cls.RemoveTempFile("child_read2.txt")
|
||||
|
||||
def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
|
||||
"""Test that 'stty -a' displays the same output before and after running the lldb command."""
|
||||
|
@ -14,8 +14,8 @@ class UUIDMismatchWarningCase(TestBase):
|
||||
@classmethod
|
||||
def classCleanup(cls):
|
||||
"""Cleanup the test byproducts."""
|
||||
system(["/bin/sh", "-c", "rm -f child_send.txt"])
|
||||
system(["/bin/sh", "-c", "rm -f child_read.txt"])
|
||||
cls.RemoveTempFile("child_send.txt")
|
||||
cls.RemoveTempFile("child_read.txt")
|
||||
|
||||
def setUp(self):
|
||||
TestBase.setUp(self)
|
||||
|
Loading…
Reference in New Issue
Block a user