Pass GHC --package-db options to cabal queries
Fix test cases