Hi Ilya I went back to this patch and propose dropping it (see below).
On Wed, Jul 1, 2026 at 2:33 PM Xavier Simonart <[email protected]> wrote: > Hi Ilya > > Thanks for the review. > > On Mon, Jun 29, 2026 at 7:41 PM Ilya Maximets <[email protected]> wrote: > >> On 6/29/26 2:40 PM, Xavier Simonart via dev wrote: >> > Macro can be used to wait for ofport creation in ovsdb and >> > to retrieve its value. >> > >> > Signed-off-by: Xavier Simonart <[email protected]> >> > --- >> > tests/ovn-macros.at | 10 ++++++++++ >> > 1 file changed, 10 insertions(+) >> > >> > diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at >> > index 8879c2fa1..2636b34cd 100644 >> > --- a/tests/ovn-macros.at >> > +++ b/tests/ovn-macros.at >> > @@ -1485,6 +1485,16 @@ wake_up_nb() { >> > AT_CHECK([kill -CONT $(cat ovn-nb/ovsdb-server.pid)]) >> > } >> > >> > +wait_and_get_ofport() { >> > + local ofport >> > + local condition=$1 >> > + OVS_WAIT_UNTIL([ >> > + ofport=$(ovs-vsctl --bare --columns ofport find Interface >> $condition) >> > + echo "$condition port=$ofport" >&2 >> > + test -n "$ofport" && test "$ofport" -ge 0]) >> >> Can we use something like: >> >> AT_CHECK([ovs-vsctl wait-until interface $1 'ofport>0']) >> AT_CEHCK([ovs-vsctl get interface $1 ofport], [0], [stdout]) >> cat stdout >> > >> ? >> > Yes, I think it is a good idea. It will avoid launching a new ovs-vsctl > every second in the OVS_WAIT_UNTIL loop and might > slighly speed up the test (by avoiding the sleep 0.1/sleep 1 in the > OVS_WAIT_UNTIL). > - Macro does not add much value (only used a few times in tests) + a few times it was used with more complex conditions. - Both OVS_WAIT_UNTIL and AT_CHECK inside wait_and_get_ofport fail to report failure (on timeout) as the exit is swallowed by xxx=wait_and_get_ofport(...). Instead of failing after 30 seconds, the test continues and fails later due to no ofport. - We would need something like xxx=wait_and_get_ofport(...) || AT_FAIL_IF(:), which makes using the macro almost as complex as w/o the macro... - If not exiting on timeout (e.g. forgetting AT_FAIL_IF(:)), having AT_CHECK([ovs-vsctl wait-until interface $1 'ofport>0']) inside the macro makes debugging more complex. - So dropping the patch in v2 of the serie. - When some patches in the serie need waiting for ofport, then they will use (w/o the macro) AT_CHECK([ovs-vsctl wait-until interface ... 'ofport>0']) if name is available. > >> > >> >> Or are you using some more complex conditions somewhere? >> > No, I think it should work. I'll send a v2. > I was wrong - there were a few more complex conditions. > >> Best regards, Ilya Maximets. >> > Thanks > Xavier > Thanks Xavier _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
