X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Flockfile.at;h=2e2a74b47f2f2e6cc6310eb0dbcff2af3a27d79d;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=1fa0342f2d3d26dc3200a6c42b63892fff9f7653;hpb=77c513a44ab85264aed7c38387ef221ad30e461c;p=sliver-openvswitch.git diff --git a/tests/lockfile.at b/tests/lockfile.at index 1fa0342f2..2e2a74b47 100644 --- a/tests/lockfile.at +++ b/tests/lockfile.at @@ -3,19 +3,49 @@ AT_BANNER([lockfile unit tests]) m4_define([CHECK_LOCKFILE], [AT_SETUP([m4_translit([$1], [_], [ ])]) AT_KEYWORDS([lockfile]) - AT_CHECK([test-lockfile $1], [0], [$1: success (m4_if( + AT_CHECK([ovstest test-lockfile $1], [0], [$1: success (m4_if( [$2], [1], [$2 child], [$2 children])) -]) +], [stderr]) + AT_CHECK([sed 's/pid [[0-9]]*/pid /' stderr], [0], [$3]) AT_CLEANUP]) CHECK_LOCKFILE([lock_and_unlock], [0]) + CHECK_LOCKFILE([lock_and_unlock_twice], [0]) -CHECK_LOCKFILE([lock_blocks_same_process], [0]) -CHECK_LOCKFILE([lock_blocks_same_process_twice], [0]) -CHECK_LOCKFILE([lock_blocks_other_process], [1]) -CHECK_LOCKFILE([lock_twice_blocks_other_process], [1]) + +CHECK_LOCKFILE([lock_blocks_same_process], [0], + [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it +]) + +CHECK_LOCKFILE([lock_blocks_same_process_twice], [0], + [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it +lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it +]) + +CHECK_LOCKFILE([lock_blocks_other_process], [1], + [lockfile|WARN|.file.~lock~: child does not inherit lock +lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid +]) + +CHECK_LOCKFILE([lock_twice_blocks_other_process], [1], + [lockfile|WARN|.file.~lock~: cannot lock file because this process has already locked it +lockfile|WARN|.file.~lock~: child does not inherit lock +lockfile|WARN|.file.~lock~: cannot lock file because it is already locked by pid +]) + CHECK_LOCKFILE([lock_and_unlock_allows_other_process], [1]) -CHECK_LOCKFILE([lock_timeout_gets_the_lock], [1]) -CHECK_LOCKFILE([lock_timeout_runs_out], [1]) -CHECK_LOCKFILE([lock_multiple], [0]) -CHECK_LOCKFILE([lock_symlink], [0]) + +CHECK_LOCKFILE([lock_multiple], [0], + [lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it +]) + +CHECK_LOCKFILE([lock_symlink], [0], + [lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it +lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it +lockfile|WARN|.b.~lock~: cannot lock file because this process has already locked it +lockfile|WARN|.a.~lock~: cannot lock file because this process has already locked it +]) + +CHECK_LOCKFILE([lock_symlink_to_dir], [0], + [lockfile|WARN|dir/.b.~lock~: cannot lock file because this process has already locked it +])