Skip to content

Commit 7abfd8e

Browse files
apconolekuba-moo
authored andcommitted
selftests: openvswitch: Be more verbose with selftest debugging.
The openvswitch selftest is difficult to debug for anyone that isn't directly familiar with the openvswitch module and the specifics of the test cases. Many times when something fails, the debug log will be sparsely populated and it takes some time to understand where a failure occured. Increase the amount of details logged to the debug log by trapping all 'info' logs, and all 'ovs_sbx' commands. Signed-off-by: Aaron Conole <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 818481d commit 7abfd8e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/testing/selftests/net/openvswitch/openvswitch.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ tests="
2323
drop_reason drop: test drop reasons are emitted"
2424

2525
info() {
26-
[ $VERBOSE = 0 ] || echo $*
26+
[ "${ovs_dir}" != "" ] &&
27+
echo "`date +"[%m-%d %H:%M:%S]"` $*" >> ${ovs_dir}/debug.log
28+
[ $VERBOSE = 0 ] || echo $*
2729
}
2830

2931
ovs_base=`pwd`
@@ -65,7 +67,8 @@ ovs_setenv() {
6567

6668
ovs_sbx() {
6769
if test "X$2" != X; then
68-
(ovs_setenv $1; shift; "$@" >> ${ovs_dir}/debug.log)
70+
(ovs_setenv $1; shift;
71+
info "run cmd: $@"; "$@" >> ${ovs_dir}/debug.log)
6972
else
7073
ovs_setenv $1
7174
fi
@@ -139,7 +142,7 @@ ovs_add_flow () {
139142
info "Adding flow to DP: sbx:$1 br:$2 flow:$3 act:$4"
140143
ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-flow "$2" "$3" "$4"
141144
if [ $? -ne 0 ]; then
142-
echo "Flow [ $3 : $4 ] failed" >> ${ovs_dir}/debug.log
145+
info "Flow [ $3 : $4 ] failed"
143146
return 1
144147
fi
145148
return 0

0 commit comments

Comments
 (0)