Skip to content

Commit

Permalink
Merge branch 'selftests-openvswitch-address-some-flakes-in-the-ci-env…
Browse files Browse the repository at this point in the history
…ironment'

Aaron Conole says:

====================
selftests: openvswitch: Address some flakes in the CI environment

These patches aim to make using the openvswitch testsuite more reliable.
These should address the major sources of flakiness in the openvswitch
test suite allowing the CI infrastructure to exercise the openvswitch
module for patch series.  There should be no change for users who simply
run the tests (except that patch 3/3 does make some of the debugging a bit
easier by making some output more verbose).
====================

Link: https://patch.msgid.link/20240702132830.213384-1-aconole@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jul 4, 2024
2 parents 1a16cdf + 7abfd8e commit e19f67d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tools/testing/selftests/net/openvswitch/openvswitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ tests="
drop_reason drop: test drop reasons are emitted"

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

ovs_base=`pwd`
Expand Down Expand Up @@ -65,7 +67,8 @@ ovs_setenv() {

ovs_sbx() {
if test "X$2" != X; then
(ovs_setenv $1; shift; "$@" >> ${ovs_dir}/debug.log)
(ovs_setenv $1; shift;
info "run cmd: $@"; "$@" >> ${ovs_dir}/debug.log)
else
ovs_setenv $1
fi
Expand Down Expand Up @@ -139,7 +142,7 @@ ovs_add_flow () {
info "Adding flow to DP: sbx:$1 br:$2 flow:$3 act:$4"
ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-flow "$2" "$3" "$4"
if [ $? -ne 0 ]; then
echo "Flow [ $3 : $4 ] failed" >> ${ovs_dir}/debug.log
info "Flow [ $3 : $4 ] failed"
return 1
fi
return 0
Expand Down Expand Up @@ -613,16 +616,20 @@ run_test() {
tname="$1"
tdesc="$2"

if ! lsmod | grep openvswitch >/dev/null 2>&1; then
stdbuf -o0 printf "TEST: %-60s [NOMOD]\n" "${tdesc}"
return $ksft_skip
fi

if python3 ovs-dpctl.py -h 2>&1 | \
grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then
stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}"
return $ksft_skip
fi

python3 ovs-dpctl.py show >/dev/null 2>&1 || \
echo "[DPCTL] show exception."

if ! lsmod | grep openvswitch >/dev/null 2>&1; then
stdbuf -o0 printf "TEST: %-60s [NOMOD]\n" "${tdesc}"
return $ksft_skip
fi

printf "TEST: %-60s [START]\n" "${tname}"

unset IFS
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/net/openvswitch/settings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
timeout=900

0 comments on commit e19f67d

Please sign in to comment.