mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
a5845e63d4
Stephen Brennan reported a flaky test while working on #121: ====================================================================== ERROR: test_by_task_struct (tests.helpers.linux.test_stack_trace.TestStackTrace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/runner/work/drgn/drgn/tests/helpers/linux/test_stack_trace.py", line 22, in test_by_task_struct self.assertIn("pause", str(self.prog.stack_trace(find_task(self.prog, pid)))) ValueError: cannot unwind stack of running task The problem is that the stack trace tests wait for the thread state to change to "S". However, the state is updated while the thread is still technically running. For example, the pause() system call is implemented as: SYSCALL_DEFINE0(pause) { while (!signal_pending(current)) { __set_current_state(TASK_INTERRUPTIBLE); schedule(); } return -ERESTARTNOHAND; } If Program.stack_trace() accesses the thread after the state is changed but before the thread has actually been scheduled out (namely, before task_struct::on_cpu is set to 0), it will fail. Instead, let's check /proc/$pid/syscall, which contains "running" until the thread is completely scheduled out. Signed-off-by: Omar Sandoval <osandov@osandov.com> |
||
---|---|---|
.. | ||
helpers | ||
__init__.py | ||
assembler.py | ||
dwarf.py | ||
dwarfwriter.py | ||
elf.py | ||
elfwriter.py | ||
libdrgn.py | ||
test_docs.py | ||
test_dwarf.py | ||
test_language_c.py | ||
test_lexer.py | ||
test_object.py | ||
test_path.py | ||
test_platform.py | ||
test_program.py | ||
test_python.py | ||
test_serialize.py | ||
test_type.py | ||
test_util.py |