selftests/bpf: print traceback when test fails
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>
This commit is contained in:
committed by
Daniel Borkmann
parent
9ee963d6a1
commit
d7f3563802
@ -23,6 +23,7 @@ import string
|
|||||||
import struct
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
logfile = None
|
logfile = None
|
||||||
log_level = 1
|
log_level = 1
|
||||||
@ -78,7 +79,9 @@ def fail(cond, msg):
|
|||||||
if not cond:
|
if not cond:
|
||||||
return
|
return
|
||||||
print("FAIL: " + msg)
|
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)
|
os.sys.exit(1)
|
||||||
|
|
||||||
def start_test(msg):
|
def start_test(msg):
|
||||||
|
Reference in New Issue
Block a user