Update gitignore
Fix some warnings in read tests
Use pkg-config to find needed libs for check.

Also add -lpthread explicitly