From: Ansis Atteka Date: Tue, 3 Nov 2015 23:29:32 +0000 (-0800) Subject: tests: add documentation for OVS_WAIT_UNTIL and OVS_WAIT_WHILE macros X-Git-Tag: v2.5.0~357 X-Git-Url: http://git.cascardo.info/?a=commitdiff_plain;h=3ee7cc6c37c2477295c816fab54d8c6adb8f3003;p=cascardo%2Fovs.git tests: add documentation for OVS_WAIT_UNTIL and OVS_WAIT_WHILE macros It is very easy to misuse these macros, because when the COMMAND returns exit code "0" it is actually considered as if condition evaluated to "true" and not "false" as some might think. This patch ensures that this is clearly reflected in documentation. Acked-by: Ben Pfaff Signed-off-by: Ansis Atteka --- diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index 541b0425e..9195f6713 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -103,7 +103,21 @@ m4_define([OVS_WAIT], [ovs_wait_cond () { $1 } ovs_wait], [0], [ignore], [ignore], [$2])]) + +dnl OVS_WAIT_UNTIL(COMMAND) +dnl +dnl Executes shell COMMAND in a loop until it returns +dnl zero return code. If COMMAND did not return +dnl zero code within reasonable time limit, then +dnl the test fails. m4_define([OVS_WAIT_UNTIL], [OVS_WAIT([$1], [$2])]) + +dnl OVS_WAIT_WHILE(COMMAND) +dnl +dnl Executes shell COMMAND in a loop until it returns +dnl non-zero return code. If COMMAND did not return +dnl non-zero code within reasonable time limit, then +dnl the test fails. m4_define([OVS_WAIT_WHILE], [OVS_WAIT([if $1; then return 1; else return 0; fi], [$2])])