Skip to content

Commit 2604b6e

Browse files
committed
tests: bt: get rid of the UEK4 exception
There's no reason to exempt UEK4 from this test: it's not that drgn can't do stack traces on UEK4, it's really that "crashed_thread()" doesn't work on UEK4 vmcores. Let's work around that so we can still smoke test the actual bt operation. Signed-off-by: Stephen Brennan <[email protected]>
1 parent a2aff4e commit 2604b6e

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/test_bt.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
# Copyright (c) 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33
import drgn
4-
import pytest
4+
from drgn.helpers.linux import cpu_curr
55

66
from drgn_tools import bt
77

88

9-
@pytest.mark.skip_vmcore("*-uek4")
10-
def test_bt_smoke(prog, request, debuginfo_type):
9+
def test_bt_smoke(prog):
1110
if prog.flags & drgn.ProgramFlags.IS_LIVE:
1211
thread = prog.thread(1)
1312
else:
14-
thread = prog.crashed_thread()
13+
try:
14+
thread = prog.crashed_thread()
15+
except Exception:
16+
# On x86_64 uek4, the sysrq does not actually trigger a panic, it
17+
# triggers a NULL pointer dereference, which triggers an "oops", and
18+
# that directly calls into the kexec code without ever calling
19+
# panic(). Thus, panic_cpu == -1, and prog.crashing_cpu() page
20+
# faults because it tries to index the wrong per-cpu variables.
21+
# To handle this, use the x86_64-specific "crashing_cpu" variable.
22+
# Note that on some drgn versions we get "FaultError", others we get
23+
# "Exception". So we just catch Exception here.
24+
pid = cpu_curr(prog, prog["crashing_cpu"]).pid.value_()
25+
thread = prog.thread(pid)
1526

1627
print("===== STACK TRACE [show_vars=False] =====")
1728
bt.bt(thread, show_vars=False)

0 commit comments

Comments
 (0)