Rework and simplify the "lcov" support for the testsuite.
[sliver-openvswitch.git] / tests / ovsdb-file.at
1 AT_BANNER([OVSDB -- file storage])
2
3 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
4 #
5 # Creates a database with the given SCHEMA and runs each of the
6 # TRANSACTIONS (which should be a quoted list of quoted strings)
7 # against it with ovsdb-tool one at a time.  
8 #
9 # Checks that the overall output is OUTPUT, but UUIDs in the output
10 # are replaced by markers of the form <N> where N is a number.  The
11 # first unique UUID is replaced by <0>, the next by <1>, and so on.
12 # If a given UUID appears more than once it is always replaced by the
13 # same marker.
14 #
15 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
16 m4_define([OVSDB_CHECK_EXECUTION], 
17   [AT_SETUP([$1])
18    AT_KEYWORDS([ovsdb file positive $5])
19    AT_DATA([schema], [$2
20 ])
21    touch .db.~lock~
22    AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
23    m4_foreach([txn], [$3], 
24      [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [stdout], [ignore])
25 cat stdout >> output
26 ])
27    AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$4])
28    AT_CLEANUP])
29
30 EXECUTION_EXAMPLES
31
32 AT_SETUP([transaction comments])
33 AT_KEYWORDS([ovsdb file positive])
34 AT_DATA([schema], [ORDINAL_SCHEMA
35 ])
36 touch .db.~lock~
37 AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
38 AT_CHECK([[ovsdb-tool transact db '
39     [{"op": "insert",
40       "table": "ordinals",
41       "row": {"name": "five", "number": 5}},
42      {"op": "comment",
43       "comment": "add row for 5"}]']], [0], [stdout], [ignore])
44 AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0],
45  [[[{"uuid":["uuid","<0>"]},{}]
46 ]])
47 AT_CHECK([grep -q "add row for 5" db])
48 AT_CLEANUP