summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-03-21 15:29:32 +0000
committerPavel Labath <labath@google.com>2018-03-21 15:29:32 +0000
commit292178e10463ad40c73bd86c6783180ddf351586 (patch)
tree11335b95d4c7d492d038f4f1ca860a7201ac2220 /lldb/packages/Python/lldbsuite/test/functionalities
parentbab6ce018fde9a0a9d720b5d0660022bf782e526 (diff)
downloadbcm5719-llvm-292178e10463ad40c73bd86c6783180ddf351586.tar.gz
bcm5719-llvm-292178e10463ad40c73bd86c6783180ddf351586.zip
Last batch of test-tree cleaning changes
- postmortem tests: make sure the core files are created in the build folder - TestSourceManager: copy the .c file into the build dir before modifying it - TestLogging: create log files in the build folder After these changes I get a clean test run (on linux) even if I set the source tree to be read only. It's possible some of the skipped/xfailed tests are still creating files in the source tree, but at the moment, I don't have plans to go hunting for those. llvm-svn: 328106
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py46
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py39
2 files changed, 38 insertions, 47 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
index 4d41a158069..4f73d48dfcf 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -87,30 +87,28 @@ class LinuxCoreTestCase(TestBase):
def test_same_pid_running(self):
"""Test that we read the information from the core correctly even if we have a running
process with the same PID around"""
- try:
- shutil.copyfile("linux-x86_64.out", "linux-x86_64-pid.out")
- shutil.copyfile("linux-x86_64.core", "linux-x86_64-pid.core")
- with open("linux-x86_64-pid.core", "r+b") as f:
- # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note
- # segment of the core file. If you update the file, these offsets may need updating
- # as well. (Notes can be viewed with readelf --notes.)
- for pid_offset in [0x1c4, 0x320]:
- f.seek(pid_offset)
- self.assertEqual(
- struct.unpack(
- "<I",
- f.read(4))[0],
- self._x86_64_pid)
-
- # We insert our own pid, and make sure the test still
- # works.
- f.seek(pid_offset)
- f.write(struct.pack("<I", os.getpid()))
- self.do_test("linux-x86_64-pid", os.getpid(), self._x86_64_regions,
- "a.out")
- finally:
- self.RemoveTempFile("linux-x86_64-pid.out")
- self.RemoveTempFile("linux-x86_64-pid.core")
+ exe_file = self.getBuildArtifact("linux-x86_64-pid.out")
+ core_file = self.getBuildArtifact("linux-x86_64-pid.core")
+ shutil.copyfile("linux-x86_64.out", exe_file)
+ shutil.copyfile("linux-x86_64.core", core_file)
+ with open(core_file, "r+b") as f:
+ # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note
+ # segment of the core file. If you update the file, these offsets may need updating
+ # as well. (Notes can be viewed with readelf --notes.)
+ for pid_offset in [0x1c4, 0x320]:
+ f.seek(pid_offset)
+ self.assertEqual(
+ struct.unpack(
+ "<I",
+ f.read(4))[0],
+ self._x86_64_pid)
+
+ # We insert our own pid, and make sure the test still
+ # works.
+ f.seek(pid_offset)
+ f.write(struct.pack("<I", os.getpid()))
+ self.do_test(self.getBuildArtifact("linux-x86_64-pid"), os.getpid(),
+ self._x86_64_regions, "a.out")
@skipIf(oslist=['windows'])
@skipIf(triple='^mips')
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
index 4e587b92c1d..18c4c348aa4 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -162,32 +162,25 @@ class MiniDumpNewTestCase(TestBase):
def test_deeper_stack_in_minidump_with_same_pid_running(self):
"""Test that we read the information from the core correctly even if we
have a running process with the same PID"""
- try:
- self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
- "linux-x86_64_not_crashed-pid.dmp",
- self._linux_x86_64_not_crashed_pid_offset,
- str(self._linux_x86_64_not_crashed_pid),
- str(os.getpid()))
- self.do_test_deeper_stack("linux-x86_64_not_crashed",
- "linux-x86_64_not_crashed-pid.dmp",
- os.getpid())
- finally:
- self.RemoveTempFile("linux-x86_64_not_crashed-pid.dmp")
+ new_core = self.getBuildArtifact("linux-x86_64_not_crashed-pid.dmp")
+ self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
+ new_core,
+ self._linux_x86_64_not_crashed_pid_offset,
+ str(self._linux_x86_64_not_crashed_pid),
+ str(os.getpid()))
+ self.do_test_deeper_stack("linux-x86_64_not_crashed", new_core, os.getpid())
def test_two_cores_same_pid(self):
"""Test that we handle the situation if we have two core files with the same PID """
- try:
- self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
- "linux-x86_64_not_crashed-pid.dmp",
- self._linux_x86_64_not_crashed_pid_offset,
- str(self._linux_x86_64_not_crashed_pid),
- str(self._linux_x86_64_pid))
- self.do_test_deeper_stack("linux-x86_64_not_crashed",
- "linux-x86_64_not_crashed-pid.dmp",
- self._linux_x86_64_pid)
- self.test_stack_info_in_minidump()
- finally:
- self.RemoveTempFile("linux-x86_64_not_crashed-pid.dmp")
+ new_core = self.getBuildArtifact("linux-x86_64_not_crashed-pid.dmp")
+ self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
+ new_core,
+ self._linux_x86_64_not_crashed_pid_offset,
+ str(self._linux_x86_64_not_crashed_pid),
+ str(self._linux_x86_64_pid))
+ self.do_test_deeper_stack("linux-x86_64_not_crashed",
+ new_core, self._linux_x86_64_pid)
+ self.test_stack_info_in_minidump()
def test_local_variables_in_minidump(self):
"""Test that we can examine local variables in a Minidump."""
OpenPOWER on IntegriCloud