Fix unstable test
[qtcontacts-sqlite] Verify database integrity at open

Integrity check takes too long to run at startup; use a semaphore
to track whether some other process has already opened the database,
and thus performed the integrity check and any required upgrades.
In practice this means that UI app startup won't need to perform the
check since contactsd will be running first.
Merge pull request #137 from matthewvogt/integrity-check

[qtcontacts-sqlite] Verify database integrity at open