AT_BANNER([OVSDB -- execution])
-m4_define([ORDINAL_SCHEMA],
- [[{"name": "ordinals",
+m4_divert_push([PREPARE_TESTS])
+[
+
+ordinal_schema () {
+ cat <<'EOF'
+ {"name": "ordinals",
"tables": {
"ordinals": {
"columns": {
"name": {"type": "string"}},
"indexes": [["number"]]}},
"version": "5.1.3",
- "cksum": "12345678 9"}]])
+ "cksum": "12345678 9"}
+EOF
+}
-m4_define([CONSTRAINT_SCHEMA],
- [[{"name": "constraints",
+constraint_schema () {
+ cat << 'EOF'
+ {"name": "constraints",
"tables": {
"a": {
"columns": {
"columns": {
"positive": {"type": {"key": {"type": "integer",
"minInteger": 1}}}},
- "maxRows": 1}}}]])
+ "maxRows": 1}}}
+EOF
+}
-m4_define([WEAK_SCHEMA],
- [[{"name": "weak",
+weak_schema () {
+ cat <<'EOF'
+ {"name": "weak",
"tables": {
"a": {
"columns": {
"b2a": {"type": {"key": {"type": "uuid",
"refTable": "a",
"refType": "weak"},
- "min": 0, "max": "unlimited"}}}}}}]])
+ "min": 0, "max": "unlimited"}}}}}}
+EOF
+}
-m4_define([GC_SCHEMA],
- [[{"name": "gc",
+gc_schema () {
+ cat <<'EOF'
+ {"name": "gc",
"tables": {
"root": {
"columns": {
"refTable": "a",
"refType": "weak"},
"min": 0, "max": "unlimited"}}},
- "isRoot": false}}}]])
+ "isRoot": false}}}
+EOF
+}
+]
+m4_divert_pop([PREPARE_TESTS])
# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
#
# same marker.
#
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
-m4_define([OVSDB_CHECK_EXECUTION],
+m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb execute execution positive $5])
- AT_CHECK([test-ovsdb execute '$2' m4_foreach([txn], [$3], [ 'txn'])],
+ AT_CHECK([test-ovsdb execute "`$2`" m4_foreach([txn], [$3], [ 'txn'])],
[0], [stdout], [])
AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [$4])
AT_CLEANUP])
OVSDB_CHECK_EXECUTION([uuid-name must be <id>],
- [CONSTRAINT_SCHEMA],
+ [constraint_schema],
[[[["constraints",
{"op": "insert",
"table": "a",
]])
OVSDB_CHECK_EXECUTION([named-uuid must be <id>],
- [CONSTRAINT_SCHEMA],
+ [constraint_schema],
[[[["constraints",
{"op": "insert",
"table": "a",
]])
OVSDB_CHECK_EXECUTION([duplicate uuid-name not allowed],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
dnl At one point the "commit" code ignored new rows with all-default values,
dnl so this checks for that problem.
OVSDB_CHECK_EXECUTION([insert default row, query table],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert row, query table],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, query by value],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, update rows by value],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, mutate rows],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, delete rows by value],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert rows, delete all],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert row, query table, commit],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert row, query table, commit durably],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([equality wait with correct rows],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([equality wait with extra row],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([equality wait with missing row],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([inequality wait with correct rows],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([inequality wait with extra row],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([inequality wait with missing row],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_EXECUTION([insert and update constraints],
- [CONSTRAINT_SCHEMA],
+ [constraint_schema],
[[[["constraints",
{"op": "insert",
"table": "constrained",
]])
OVSDB_CHECK_EXECUTION([index uniqueness checking],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
dnl Insert initial row.
[[[["ordinals",
{"op": "insert",
]])
OVSDB_CHECK_EXECUTION([referential integrity -- simple],
- [CONSTRAINT_SCHEMA],
+ [constraint_schema],
[[[["constraints",
{"op": "insert",
"table": "b",
]])
OVSDB_CHECK_EXECUTION([referential integrity -- mutual references],
- [CONSTRAINT_SCHEMA],
+ [constraint_schema],
[[[["constraints",
{"op": "insert",
"table": "a",
]])
OVSDB_CHECK_EXECUTION([weak references],
- [WEAK_SCHEMA],
+ [weak_schema],
[[[["weak",
{"op": "insert",
"table": "a",
]])
OVSDB_CHECK_EXECUTION([garbage collection],
- [GC_SCHEMA],
+ [gc_schema],
[dnl Check that inserting a row without any references is a no-op.
[[["gc",
{"op": "insert",
m4_define([OVSDB_CHECK_MONITOR],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb server monitor positive $9])
- AT_DATA([schema], [$2
-])
+ $2 > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
m4_foreach([txn], [$3],
[AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])])
AT_CLEANUP])
OVSDB_CHECK_MONITOR([monitor insert into empty table],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[],
[ordinals], [ordinals],
[[[["ordinals",
]])
OVSDB_CHECK_MONITOR([monitor insert into populated table],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor delete],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor row update],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor no-op row updates],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor insert-and-update transaction],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_MONITOR([monitor weak reference change],
- [WEAK_SCHEMA],
+ [weak_schema],
[[[["weak",
{"op": "insert",
"table": "a",
]])
OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction],
- [ORDINAL_SCHEMA],
+ [ordinal_schema],
[[[["ordinals",
{"op": "insert",
"table": "ordinals",
"where": []}]]]])
OVSDB_CHECK_MONITOR([monitor all operations],
- [ORDINAL_SCHEMA], [OVSDB_MONITOR_INITIAL],
+ [ordinal_schema], [OVSDB_MONITOR_INITIAL],
[ordinals], [ordinals], [OVSDB_MONITOR_TXNS],
[[row,action,name,number,_version
<0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
dnl A monitor with "initial" only doesn't really make sense,
dnl but it's still allowed and should work.
OVSDB_CHECK_MONITOR([monitor initial only],
- [ORDINAL_SCHEMA], [OVSDB_MONITOR_INITIAL],
+ [ordinal_schema], [OVSDB_MONITOR_INITIAL],
[ordinals], [ordinals], [OVSDB_MONITOR_TXNS],
[[row,action,name,number,_version
<0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
]], [!insert,!delete,!modify])
OVSDB_CHECK_MONITOR([monitor insert only],
- [ORDINAL_SCHEMA], [OVSDB_MONITOR_INITIAL],
+ [ordinal_schema], [OVSDB_MONITOR_INITIAL],
[ordinals], [ordinals], [OVSDB_MONITOR_TXNS],
[[row,action,name,number,_version
<0>,insert,"""five""",5,"[""uuid"",""<1>""]"
]], [!initial,!delete,!modify])
OVSDB_CHECK_MONITOR([monitor delete only],
- [ORDINAL_SCHEMA], [OVSDB_MONITOR_INITIAL],
+ [ordinal_schema], [OVSDB_MONITOR_INITIAL],
[ordinals], [ordinals], [OVSDB_MONITOR_TXNS],
[[row,action,name,number,_version
<0>,delete,"""FIVE""",5,"[""uuid"",""<1>""]"
]], [!initial,!insert,!modify])
OVSDB_CHECK_MONITOR([monitor modify only],
- [ORDINAL_SCHEMA], [OVSDB_MONITOR_INITIAL],
+ [ordinal_schema], [OVSDB_MONITOR_INITIAL],
[ordinals], [ordinals], [OVSDB_MONITOR_TXNS],
[[row,action,name,number,_version
<0>,old,"""five""",,"[""uuid"",""<1>""]"
m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb server positive unix $5])
- AT_DATA([schema], [$2
-])
+ $2 > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
m4_foreach([txn], [$3],
\f
AT_SETUP([truncating corrupted database log])
AT_KEYWORDS([ovsdb server positive unix])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
dnl Do one transaction and save the output.
AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
AT_SETUP([truncating database log with bad transaction])
AT_KEYWORDS([ovsdb server positive unix])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
dnl Do one transaction and save the output.
AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
AT_SETUP([ovsdb-client get-schema-version])
AT_KEYWORDS([ovsdb server positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --unixctl=$PWD/unixctl --remote=punix:socket db], [0], [ignore], [ignore])
AT_CHECK([ovsdb-client get-schema-version unix:socket ordinals], [0], [5.1.3
AT_SETUP([database multiplexing implementation])
AT_KEYWORDS([ovsdb server positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --unixctl=$PWD/unixctl --remote=punix:socket db], [0], [ignore], [ignore])
AT_CHECK(
AT_SETUP([compacting online])
AT_KEYWORDS([ovsdb server compact])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --unixctl=$PWD/unixctl --remote=punix:socket --log-file=$PWD/ovsdb-server.log db], [0], [ignore], [ignore])
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb server positive ssl $5])
AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
- AT_DATA([schema], [$2
-])
+ $2 > schema
AT_CHECK([perl $srcdir/choose-port.pl], [0], [stdout])
SSL_PORT=`cat stdout`
PKIDIR=$abs_top_builddir/tests
m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb server positive transient $5])
- AT_DATA([schema], [$2
-])
+ $2 > schema
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
m4_foreach([txn], [$3],
[AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn'
m4_define([OVSDB_CHECK_EXECUTION],
[AT_SETUP([$1])
AT_KEYWORDS([ovsdb file positive $5])
- AT_DATA([schema], [$2
-])
+ $2 > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
m4_foreach([txn], [$3],
AT_SETUP([transaction comments])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
AT_CHECK([[ovsdb-tool transact db '
AT_SETUP([ovsdb-tool compact])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
dnl Do a bunch of random transactions that put crap in the database log.
AT_SETUP([ovsdb-tool convert -- removing a column])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_DATA([new-schema],
[[{"name": "ordinals",
"tables": {
"columns": {
"number": {"type": "integer"}}}}}
]])
-AT_DATA([new-schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > new-schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
dnl Put some data in the database.
AT_SETUP([ovsdb-tool schema-version])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool schema-version schema], [0], [5.1.3
])
AT_CLEANUP
AT_SETUP([ovsdb-tool db-version])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
AT_CHECK([ovsdb-tool db-version db], [0], [5.1.3
AT_SETUP([ovsdb-tool schema-cksum])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
AT_CHECK([ovsdb-tool schema-cksum schema], [0], [12345678 9
])
AT_CLEANUP
AT_SETUP([ovsdb-tool db-cksum])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
AT_CHECK([ovsdb-tool db-cksum db], [0], [12345678 9
AT_SETUP([ovsdb-tool needs-conversion (no conversion needed)])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
AT_CHECK([ovsdb-tool needs-conversion db schema], [0], [no
AT_SETUP([ovsdb-tool needs-conversion (conversion needed)])
AT_KEYWORDS([ovsdb file positive])
-AT_DATA([schema], [ORDINAL_SCHEMA
-])
+ordinal_schema > schema
touch .db.~lock~
AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
sed 's/5\.1\.3/5.1.4/' < schema > schema2
AT_CLEANUP])
OVSDB_CHECK_TRIGGER([trigger fires immediately],
- ['ORDINAL_SCHEMA' [\
+ ["`ordinal_schema`" [\
'["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_TRIGGER([trigger times out],
- ['ORDINAL_SCHEMA' [\
+ ["`ordinal_schema`" [\
'["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_TRIGGER([trigger fires after delay],
- ['ORDINAL_SCHEMA' [\
+ ["`ordinal_schema`" [\
'["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_TRIGGER([delayed trigger modifies database],
- ['ORDINAL_SCHEMA' [\
+ ["`ordinal_schema`" [\
'["ordinals",
{"op": "insert",
"table": "ordinals",
]])
OVSDB_CHECK_TRIGGER([one delayed trigger wakes up another],
- ['ORDINAL_SCHEMA' [\
+ ["`ordinal_schema`" [\
'["ordinals",
{"op": "insert",
"table": "ordinals",