Skip to content

Commit

Permalink
fmt_pkt: make sure scapy-server is started once
Browse files Browse the repository at this point in the history
When running fmt_pkt in parallel, before the patch, there could be
several attempts to start scapy-server. Using flock on a test case
specific file should guarantee that only one of the subshells will
actually be able to start a daemon, which is designed to be a singleton.

Now that start_scapy_server doesn't necessarily start a server (only the
first lucky subshell will do), wait for server socket file before
proceeding with ovs-appctl call.

Signed-off-by: Ihar Hrachyshka <[email protected]>
Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Mark Michelson <[email protected]>
  • Loading branch information
booxter authored and putnopvut committed Dec 4, 2023
1 parent e6f1df6 commit 037b1dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/ovn-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -796,17 +796,19 @@ fmt_pkt() {
if [[ ! -S $ctlfile ]]; then
start_scapy_server
fi
while [[ ! -S $ctlfile ]]; do sleep 0.1; done
ovs-appctl -t $ctlfile payload "$1"
}

start_scapy_server() {
pidfile=$ovs_base/scapy.pid
ctlfile=$ovs_base/scapy.ctl
logfile=$ovs_base/scapy.log
lockfile=$ovs_base/scapy.lock

"$top_srcdir"/tests/scapy-server.py \
--pidfile=$pidfile --unixctl=$ctlfile --log-file=$logfile --detach
on_exit "test -e \"$pidfile\" && ovs-appctl -t $ctlfile exit"
flock -n $lockfile "$top_srcdir"/tests/scapy-server.py \
--pidfile=$pidfile --unixctl=$ctlfile --log-file=$logfile --detach \
&& on_exit "test -e \"$pidfile\" && ovs-appctl -t $ctlfile exit"
}

trim_zeros() {
Expand Down

0 comments on commit 037b1dc

Please sign in to comment.