#!/usr/bin/env bash ################################################################################ # Test objective: check if a receive copy monitor receives frames when its # monitored ephemeral VALE port is receiving, even if the # monitored port hasn't yet read the frame. # Operations: # 0) restart fd_server to have a clean starting state # 1) connect two ephemeral VALE ports (v0, v1) to the same VALE switch. # 2) open a receiving copy monitor vo/r for v0. # 3) send from v1 and don't read from v0, check that v0/r receives the frame. # 4) receive from v0. ################################################################################ source test_lib parse_send_recv_arguments "$@" verbosity="${verbosity:-}" fill="${fill:-d}" len="${len:-150}" num="${num:-1}" seq="${seq:-}" restart_fd_server # Pre-opening interface that will be needed. This is needed to avoid a race # condition between the sending and receiving ports. functional $verbosity -i vale0:v0 check_success $? "pre-open vale0:v0" functional $verbosity -i vale0:v0/r check_success $? "pre-open vale0:v0/r" functional $verbosity -i vale0:v1 check_success $? "pre-open vale0:v1" # First we send without reading from v0 functional $verbosity -i vale0:v0/r -r "${len}:${fill}:${num}" $seq & p1=$! functional $verbosity -i vale0:v1 -t "${len}:${fill}:${num}" $seq e2=$? wait $p1 e1=$? check_success $e1 "receive-${num} vale0:v0/r" check_success $e2 "send-${num} vale0:v1" # Then we read from v0 functional $verbosity -i vale0:v0 -r "${len}:${fill}:${num}" $seq e3=$? check_success $e3 "receive-${num} vale0:v0" test_successful "$0"