diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-05-26 23:28:04 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-05-27 00:39:49 +0200 |
commit | 8e379c62a48d68cd5ab2a32c6fc9244b1ae94084 (patch) | |
tree | dd3656ac60fe10c1e1739a88350f77c2f2a417f9 /tests/00-db-exclusive/run | |
parent | 456946609aa1e64a42578ff1c4962ea939d31da4 (diff) |
Add test-suite (requires dovecot-imapd).
Diffstat (limited to 'tests/00-db-exclusive/run')
-rw-r--r-- | tests/00-db-exclusive/run | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/00-db-exclusive/run b/tests/00-db-exclusive/run new file mode 100644 index 0000000..1ae27b6 --- /dev/null +++ b/tests/00-db-exclusive/run @@ -0,0 +1,25 @@ +# verify that database isn't created in --watch mode +! interimap --watch=60 +xgrep -E "^DBI connect\(.*\) failed: unable to open database file at " <"$STDERR" + +# now create database +interimap + +# start a background process +interimap --watch=60 & pid=$! +cleanup() { + # kill interimap process and its children + pkill -P "$pid" -TERM + kill -TERM "$pid" + wait +} +trap cleanup EXIT INT TERM + +sleep .05 # wait a short while so we have time to lock the database (ugly and racy...) +# verify that subsequent runs fail as we can't acquire the exclusive lock +! interimap + +# line 177 is `$DBH->do("PRAGMA locking_mode = EXCLUSIVE");` +xgrep -Fx "DBD::SQLite::db do failed: database is locked at ./interimap line 177." <"$STDERR" + +# vim: set filetype=sh : |