Skip to content

Commit

Permalink
selftests/bpf: print traceback when test fails
Browse files Browse the repository at this point in the history
Figuring out which exact check in test_offload.py takes more
time than it should.  Print the traceback (to the screen and
the logs).

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Jakub Kicinski authored and Daniel Borkmann committed Feb 6, 2019
1 parent 9ee963d commit d7f3563
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/testing/selftests/bpf/test_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import struct
import subprocess
import time
import traceback

logfile = None
log_level = 1
Expand Down Expand Up @@ -78,7 +79,9 @@ def fail(cond, msg):
if not cond:
return
print("FAIL: " + msg)
log("FAIL: " + msg, "", level=1)
tb = "".join(traceback.extract_stack().format())
print(tb)
log("FAIL: " + msg, tb, level=1)
os.sys.exit(1)

def start_test(msg):
Expand Down

0 comments on commit d7f3563

Please sign in to comment.