mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 13:26:16 +01:00
tests: Skip assert-msg-test.py if gdb is non-functional
Some of the CI runners disable ptrace, as they’re running inside a container and ptrace would allow container escape. On those systems, gdb can’t work, so skip the gdb test. Add some additional stderr debug output to make it clear that’s the case. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
5e4fa36680
commit
6e44151bf7
@ -95,6 +95,7 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
result = Result(info, out, err)
|
result = Result(info, out, err)
|
||||||
|
|
||||||
print("Output:", result.out)
|
print("Output:", result.out)
|
||||||
|
print("Error:", result.err)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def runGdbAssertMessage(self, *args):
|
def runGdbAssertMessage(self, *args):
|
||||||
@ -118,13 +119,14 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
env=env,
|
env=env,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
info.check_returncode()
|
|
||||||
out = info.stdout.strip()
|
out = info.stdout.strip()
|
||||||
err = info.stderr.strip()
|
err = info.stderr.strip()
|
||||||
|
|
||||||
result = Result(info, out, err)
|
result = Result(info, out, err)
|
||||||
|
|
||||||
print("Output:", result.out)
|
print("Output:", result.out)
|
||||||
|
print("Error:", result.err)
|
||||||
|
print(result.info)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def test_gassert(self):
|
def test_gassert(self):
|
||||||
@ -146,6 +148,15 @@ class TestAssertMessage(unittest.TestCase):
|
|||||||
tmp.flush()
|
tmp.flush()
|
||||||
|
|
||||||
result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
|
result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
|
||||||
|
|
||||||
|
# Some CI environments disable ptrace (as they’re running in a
|
||||||
|
# container). If so, skip the test as there’s nothing we can do.
|
||||||
|
if (
|
||||||
|
result.info.returncode != 0
|
||||||
|
and "ptrace: Operation not permitted" in result.err
|
||||||
|
):
|
||||||
|
self.skipTest("GDB is not functional due to ptrace being disabled")
|
||||||
|
|
||||||
self.assertEqual(result.info.returncode, 0)
|
self.assertEqual(result.info.returncode, 0)
|
||||||
self.assertIn("$1 = 0x", result.out)
|
self.assertIn("$1 = 0x", result.out)
|
||||||
self.assertIn("assertion failed: (42 < 0)", result.out)
|
self.assertIn("assertion failed: (42 < 0)", result.out)
|
||||||
|
Loading…
Reference in New Issue
Block a user