From 1071ac193589338bc055e338926d661ab5bf93f6 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 7 Nov 2016 09:58:58 +0000 Subject: Make space for FreeBSD core file tests This renames the functionalities/postmortem/linux-core to elf-core and puts the "linux" part into the individual names of the core files. Since the tests for linux and freebsd core files are going to be very similar, having them close together means they can reuse most of the plumbing. llvm-svn: 286101 --- .../postmortem/elf-core/TestLinuxCore.py | 199 +++++++++++++++++++++ .../functionalities/postmortem/elf-core/altmain.c | 6 + .../postmortem/elf-core/altmain.core | Bin 0 -> 40960 bytes .../postmortem/elf-core/altmain.out | Bin 0 -> 2330 bytes .../postmortem/elf-core/linux-i386.core | Bin 0 -> 28672 bytes .../postmortem/elf-core/linux-i386.out | Bin 0 -> 1971 bytes .../postmortem/elf-core/linux-s390x.core | Bin 0 -> 16384 bytes .../postmortem/elf-core/linux-s390x.out | Bin 0 -> 2824 bytes .../postmortem/elf-core/linux-x86_64.core | Bin 0 -> 40960 bytes .../postmortem/elf-core/linux-x86_64.out | Bin 0 -> 2575 bytes .../functionalities/postmortem/elf-core/main.c | 17 ++ .../postmortem/elf-core/make-core.sh | 61 +++++++ .../postmortem/linux-core/TestLinuxCore.py | 199 --------------------- .../postmortem/linux-core/altmain.c | 6 - .../postmortem/linux-core/altmain.core | Bin 40960 -> 0 bytes .../postmortem/linux-core/altmain.out | Bin 2330 -> 0 bytes .../postmortem/linux-core/i386.core | Bin 28672 -> 0 bytes .../functionalities/postmortem/linux-core/i386.out | Bin 1971 -> 0 bytes .../functionalities/postmortem/linux-core/main.c | 17 -- .../postmortem/linux-core/make-core.sh | 61 ------- .../postmortem/linux-core/s390x.core | Bin 16384 -> 0 bytes .../postmortem/linux-core/s390x.out | Bin 2824 -> 0 bytes .../postmortem/linux-core/x86_64.core | Bin 40960 -> 0 bytes .../postmortem/linux-core/x86_64.out | Bin 2575 -> 0 bytes 24 files changed, 283 insertions(+), 283 deletions(-) create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core create mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core create mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core create mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core create mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c create mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.c delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.core delete mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.out delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.core delete mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.out delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/main.c delete mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core delete mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core delete mode 100755 lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out (limited to 'lldb/packages/Python/lldbsuite/test/functionalities') 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 new file mode 100644 index 00000000000..42542099b9f --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -0,0 +1,199 @@ +""" +Test basics of linux core file debugging. +""" + +from __future__ import print_function + +import shutil +import struct + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class LinuxCoreTestCase(TestBase): + NO_DEBUG_INFO_TESTCASE = True + + mydir = TestBase.compute_mydir(__file__) + + _i386_pid = 32306 + _x86_64_pid = 32259 + _s390x_pid = 1045 + + _i386_regions = 4 + _x86_64_regions = 5 + _s390x_regions = 2 + + @skipIf(oslist=['windows']) + @skipIf(triple='^mips') + def test_i386(self): + """Test that lldb can read the process information from an i386 linux core file.""" + self.do_test("linux-i386", self._i386_pid, self._i386_regions) + + @skipIf(oslist=['windows']) + @skipIf(triple='^mips') + def test_x86_64(self): + """Test that lldb can read the process information from an x86_64 linux core file.""" + self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions) + + # This seems to hang on non-s390x platforms for some reason. Disabling + # for now. + @skipIf(archs=no_match(['s390x'])) + @skipIf(triple='^mips') + def test_s390x(self): + """Test that lldb can read the process information from an s390x linux core file.""" + self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions) + + @skipIf(oslist=['windows']) + @skipIf(triple='^mips') + 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( + "&2 + exit 1 + ;; +esac + +set -e -x + +file=$1 +if [ -z "$file" ]; then + cat < smaller core files. +exec ./a.out diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py deleted file mode 100644 index da6098f88f9..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py +++ /dev/null @@ -1,199 +0,0 @@ -""" -Test basics of linux core file debugging. -""" - -from __future__ import print_function - -import shutil -import struct - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LinuxCoreTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - _i386_pid = 32306 - _x86_64_pid = 32259 - _s390x_pid = 1045 - - _i386_regions = 4 - _x86_64_regions = 5 - _s390x_regions = 2 - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_i386(self): - """Test that lldb can read the process information from an i386 linux core file.""" - self.do_test("i386", self._i386_pid, self._i386_regions) - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_x86_64(self): - """Test that lldb can read the process information from an x86_64 linux core file.""" - self.do_test("x86_64", self._x86_64_pid, self._x86_64_regions) - - # This seems to hang on non-s390x platforms for some reason. Disabling - # for now. - @skipIf(archs=no_match(['s390x'])) - @skipIf(triple='^mips') - def test_s390x(self): - """Test that lldb can read the process information from an s390x linux core file.""" - self.do_test("s390x", self._s390x_pid, self._s390x_regions) - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - 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("x86_64.out", "x86_64-pid.out") - shutil.copyfile("x86_64.core", "x86_64-pid.core") - with open("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( - "&2 - exit 1 - ;; -esac - -set -e -x - -file=$1 -if [ -z "$file" ]; then - cat < smaller core files. -exec ./a.out diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core deleted file mode 100644 index b97fc43e967..00000000000 Binary files a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core and /dev/null differ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out deleted file mode 100755 index 640fbdc257d..00000000000 Binary files a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out and /dev/null differ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core deleted file mode 100644 index e2fa69e4558..00000000000 Binary files a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core and /dev/null differ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out deleted file mode 100755 index 842402fd519..00000000000 Binary files a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out and /dev/null differ -- cgit v1.2.3