2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-13 14:07:02 +00:00
Files
openvswitch/tests/jsonrpc-py.at
Ben Pfaff 9a403b0760 tests: Always use --no-chdir with --detach.
With --detach but not --no-chdir, core files and Address Sanitizer logs
don't go into the testsuite directory but end up dropped because it tries
to write them in the root directory.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-19 08:47:53 -08:00

47 lines
1.9 KiB
Plaintext

AT_BANNER([JSON-RPC - Python])
m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
[AT_SETUP([JSON-RPC request and successful reply - $1])
AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK(
[[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
[[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
]])
AT_CLEANUP])
JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
[AT_SETUP([JSON-RPC request and error reply - $1])
AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK(
[[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
[[{"error":{"error":"unknown method"},"id":0,"result":null}
]])
AT_CLEANUP])
JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
m4_define([JSONRPC_NOTIFICATION_PYN],
[AT_SETUP([JSON-RPC notification - $1])
AT_SKIP_IF([test $2 = no])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK([test -e test-jsonrpc.py.pid])
AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
# Wait for test-jsonrpc to die, based on its pidfile disappearing
OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
AT_CLEANUP])
JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
JSONRPC_NOTIFICATION_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])