X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fovsdb-tool.at;h=e4f4a29e9e6f823c8dbc68c67738458eff9e6449;hb=1e3f34c7693bcabae8e443ac1b246680ef9b60e2;hp=4bc582c04ee36c54b0f31dfac1e7ef55274abcc3;hpb=39ab07affb2d155aaabfdecaec2ec908f9d05a3a;p=sliver-openvswitch.git diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at index 4bc582c04..e4f4a29e9 100644 --- a/tests/ovsdb-tool.at +++ b/tests/ovsdb-tool.at @@ -49,8 +49,18 @@ AT_CLEANUP AT_SETUP([ovsdb-tool compact]) AT_KEYWORDS([ovsdb file positive]) ordinal_schema > schema -touch .db.~lock~ +dnl Make sure that "ovsdb-tool create" works with a dangling symlink, +dnl creating the target of the symlink rather than replacing the symlink +dnl with a regular file, and that the lockfile gets created relative to +dnl the symlink's target. +mkdir dir +: > dir/.db.~lock~ +ln -s dir/db db +AT_SKIP_IF([test ! -h db]) AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore]) +AT_CHECK([test ! -e .db.~lock]) +AT_CHECK([test -h db]) +AT_CHECK([test -f dir/db]) dnl Do a bunch of random transactions that put crap in the database log. AT_CHECK( [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do @@ -101,7 +111,7 @@ AT_CHECK([[perl $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/ {"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}} ]]) dnl Dump out and check the actual database contents. -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -117,14 +127,18 @@ _uuid name number dnl Now compact the database in-place. touch .db.tmp.~lock~ AT_CHECK([[ovsdb-tool compact db]], [0], [], [ignore]) +dnl Make sure that "db" is still a symlink to dir/db instead of getting +dnl replaced by a regular file. +AT_CHECK([test ! -e .db.~lock]) +AT_CHECK([test -h db]) +AT_CHECK([test -f dir/db]) dnl We can't fully re-check the contents of the database log, because the dnl order of the records is not predictable, but there should only be 4 lines dnl in it now. AT_CAPTURE_FILE([db]) -AT_CHECK([wc -l < db], [0], [4 -]) +AT_CHECK([test `wc -l < db` -eq 4]) dnl And check that the dumped data is the same too: -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -165,7 +179,7 @@ AT_CHECK( done]], [0], [stdout], [ignore]) dnl Dump out and check the actual database contents. -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -185,10 +199,9 @@ dnl We can't fully re-check the contents of the database log, because the dnl order of the records is not predictable, but there should only be 4 lines dnl in it now. AT_CAPTURE_FILE([db]) -AT_CHECK([wc -l < db], [0], [4 -]) +AT_CHECK([test `wc -l < db` -eq 4]) dnl And check that the dumped data is the same except for the removed column: -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -228,7 +241,7 @@ AT_CHECK( done]], [0], [stdout], [ignore]) dnl Dump out and check the actual database contents. -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table @@ -248,10 +261,9 @@ dnl We can't fully re-check the contents of the database log, because the dnl order of the records is not predictable, but there should only be 4 lines dnl in it now. AT_CAPTURE_FILE([db]) -AT_CHECK([wc -l < db], [0], [4 -]) +AT_CHECK([test `wc -l < db` -eq 4]) dnl And check that the dumped data is the same except for the added column: -AT_CHECK([[ovsdb-server --unixctl=$PWD/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], +AT_CHECK([[ovsdb-server --unixctl="`pwd`"/unixctl --remote=punix:socket --run "ovsdb-client dump unix:socket ordinals" db]], [0], [stdout], [ignore]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table