[ovs-dev] [PATCH] tests: fix issue in use of OVS_APP_EXIT_AND_WAIT

Alin Serdean aserdean at cloudbasesolutions.com
Tue Jun 7 00:52:37 UTC 2016


Hi Lance,

Thanks a lot for the patch just one small nit on the windows side, please see inlined comment.

Thanks,
Alin.

> diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index
> e5710a0..fadd2be 100644
> --- a/tests/ovs-macros.at
> +++ b/tests/ovs-macros.at
> @@ -132,20 +132,22 @@ m4_define([OVS_WAIT_WHILE],
> 
>  dnl OVS_APP_EXIT_AND_WAIT(DAEMON)
>  dnl
> -dnl Ask the daemon named DAEMON to exit, via ovs-appctl, and then waits
> for it
> +dnl Ask the daemon named DAEMON to exit, via ovs-appctl, and then wait
> +for it
>  dnl to exit.
>  m4_define([OVS_APP_EXIT_AND_WAIT],
> -  [TMPPID=$(cat "$OVS_RUNDIR"/$1.pid 2>/dev/null)
> +  [AT_CHECK([test -e $OVS_RUNDIR/$1.pid])
> +   TMPPID=$(cat $OVS_RUNDIR/$1.pid)
>     AT_CHECK([ovs-appctl -t $1 exit])
>     OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null])])
> 
> -dnl OVS_APP_EXIT_AND_WAIT_BY_TARGET(DAEMON)
> +dnl OVS_APP_EXIT_AND_WAIT_BY_TARGET(TARGET, PIDFILE)
>  dnl
> -dnl Ask the daemon named DAEMON to exit, via ovs-appctl (using the target
> -dnl argument), and then waits for it to exit.
> +dnl Ask the daemon identified by TARGET to exit, via ovs-appctl (using
> +the target dnl argument), and then wait for it to exit.
>  m4_define([OVS_APP_EXIT_AND_WAIT_BY_TARGET],
> -  [TMPPID=`cat "$OVS_RUNDIR"/$1.pid 2>/dev/null`
> -   AT_CHECK([ovs-appctl --target=$OVS_RUNDIR/ovsdb-server.$TMPPID.ctl
> exit])
> +  [AT_CHECK([test -e $2])
> +   TMPPID=$(cat $2)
> +   AT_CHECK([ovs-appctl --target=$1 exit])
[Alin Gabriel Serdean: ] We need something like the following in some situations:
AT_CHECK([ovs-appctl --target=$1 exit], [0], [ignore], [ignore])
The reason behind it is that we do not want to append the commands generated by ovs-appctl to be logged (like in the case of a kill command).
Allowing more arguments to the current macro or adding another one which disables logging might do the trick.
I.E. difference between Linux / Windows on test 1747 (testing monitor insert into empty table ):
On Linux:
## ------------------------------ ##
## openvswitch 2.5.90 test suite. ##
## ------------------------------ ##
1747. ovsdb-monitor.at:47: testing monitor insert into empty table ...
./ovsdb-monitor.at:47: ovsdb-tool create db schema
stderr:
stdout:
./ovsdb-monitor.at:47: ovsdb-server --detach --no-chdir --pidfile="`pwd`"/server-pid --remote=punix:socket --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1
./ovsdb-monitor.at:47: ovsdb-client -vjsonrpc --detach --no-chdir --pidfile="`pwd`"/client-pid -d json monitor --format=csv unix:socket ordinals ordinals  > output
stderr:
2016-06-06T23:57:06Z|00001|jsonrpc|DBG|unix:socket: send request, method="list_dbs", params=[], id=0
2016-06-06T23:57:06Z|00002|jsonrpc|DBG|unix:socket: received reply, result=["ordinals"], id=0
2016-06-06T23:57:06Z|00003|jsonrpc|DBG|unix:socket: send request, method="get_schema", params=["ordinals"], id=1
2016-06-06T23:57:06Z|00004|jsonrpc|DBG|unix:socket: received reply, result={"cksum":"12345678 9","name":"ordinals","version":"5.1.3","tables":{"ordinals":{"indexes":[["number"]],"columns":{"number":{"type":"integer"},"name":{"type":"string"}}}}}, id=1
2016-06-06T23:57:06Z|00005|jsonrpc|DBG|unix:socket: send request, method="monitor", params=["ordinals",null,{"ordinals":[{"columns":["name","number","_version"]}]}], id=2
2016-06-06T23:57:06Z|00006|jsonrpc|DBG|unix:socket: received reply, result={}, id=2
stdout:
./ovsdb-monitor.at:47: ovsdb-client transact unix:socket '["ordinals",
      {"op": "insert",
       "table": "ordinals",
       "row": {"number": 0, "name": "zero"}}]'
stderr:
stdout:
[{"uuid":["uuid","215b361f-cd20-476a-8f05-d97a7940b53c"]}]
./ovsdb-monitor.at:47: ovsdb-client transact unix:socket '["ordinals"]'
stderr:
stdout:
[]
./ovsdb-monitor.at:47: ovs-appctl -t "`pwd`"/unixctl exit
./ovsdb-monitor.at:47: ${PERL} $srcdir/ovsdb-monitor-sort.pl < output | ${PERL} $srcdir/uuidfilt.pl
stderr:
1747. ovsdb-monitor.at:47:  ok
On Windows:
## ------------------------------ ##
## openvswitch 2.5.90 test suite. ##
## ------------------------------ ##
1747. ovsdb-monitor.at:47: testing monitor insert into empty table ...
./ovsdb-monitor.at:47: ovsdb-tool create db schema
stderr:
stdout:
./ovsdb-monitor.at:47: ovsdb-server --detach --no-chdir --pidfile="`pwd`"/server-pid --remote=punix:socket --unixctl="`pwd`"/unixctl --log-file="`pwd`"/ovs
db-server-log db >/dev/null 2>&1
./ovsdb-monitor.at:47: ovsdb-client -vjsonrpc --pidfile="`pwd`"/client-pid -d json monitor --format=csv unix:socket ordinals ordinals  > output &
stderr:
stdout:
./ovsdb-monitor.at:47: ovsdb-client transact unix:socket '["ordinals",
      {"op": "insert",
       "table": "ordinals",
       "row": {"number": 0, "name": "zero"}}]'
stderr:
stdout:
[{"uuid":["uuid","4a367308-dc78-449e-9243-fd007ff10690"]}]
./ovsdb-monitor.at:47: ovsdb-client transact unix:socket '["ordinals"]'
stderr:
stdout:
[]
./ovsdb-monitor.at:47: test -e `pwd`/server-pid
./ovsdb-monitor.at:47: ovs-appctl --target=`pwd`/unixctl exit
--- /dev/null   2016-06-07 02:48:42 +0300
+++ /c/_2016/june/ovs/tests/testsuite.dir/at-groups/1747/stderr 2016-06-07 02:48:42 +0300
@@ -0,0 +1,8 @@
+2016-06-06T23:48:40Z|00001|jsonrpc|DBG|unix:socket: send request, method="list_dbs", params=[], id=0
+2016-06-06T23:48:40Z|00002|jsonrpc|DBG|unix:socket: received reply, result=["ordinals"], id=0
+2016-06-06T23:48:40Z|00003|jsonrpc|DBG|unix:socket: send request, method="get_schema", params=["ordinals"], id=1
+2016-06-06T23:48:40Z|00004|jsonrpc|DBG|unix:socket: received reply, result={"cksum":"12345678 9","name":"ordinals","version":"5.1.3","tables":{"ordinals":
{"indexes":[["number"]],"columns":{"number":{"type":"integer"},"name":{"type":"string"}}}}}, id=1
+2016-06-06T23:48:40Z|00005|jsonrpc|DBG|unix:socket: send request, method="monitor", params=["ordinals",null,{"ordinals":[{"columns":["name","number","_ver
sion"]}]}], id=2
+2016-06-06T23:48:40Z|00006|jsonrpc|DBG|unix:socket: received reply, result={}, id=2
+2016-06-06T23:48:41Z|00007|jsonrpc|DBG|unix:socket: received notification, method="update", params=[null,{"ordinals":{"4a367308-dc78-449e-9243-fd007ff1069
0":{"new":{"name":"zero","number":0,"_version":["uuid","c5574fef-e08f-4304-9879-762d04d9d9ed"]}}}}]
+ovsdb-client: unix:socket: receive failed (End of file)
ovsdb-server-log:
> 2016-06-06T23:48:40.644Z|00001|vlog|INFO|opened log file c:/_2016/june/ovs/tests/testsuite.dir/1747/ovsdb-server-log
> 2016-06-06T23:48:40.806Z|00002|ovsdb_server|INFO|ovsdb-server (Open vSwitch) 2.5.90
1747. ovsdb-monitor.at:47:  FAILED (ovsdb-monitor.at:47)
>     OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null])])
> 



More information about the dev mailing list