我发现可以在 PostgreSQL 中使用覆盖率报告运行运行测试,并且这也可用于 PostgreSQL 扩展(来自 PGXN)。
我发现两个包含覆盖率报告的存储库:
- https://github.com/theory/sqitch (不幸的是这是 Perl)
- https://github.com/citusdata/cstore_fdw (这是用 c 编写的,但我不知道如何从这个示例中运行覆盖率测试)
如何在扩展程序上本地运行覆盖率报告?我认为这应该由通用 PGXN Makefile 提供。
最佳答案
本地覆盖报告可以通过以下方式实现:
- 使用 --enable-coverage 标志安装 Postgres
- 针对 Postgres 安装及其 pg_config 构建扩展
- 从扩展的 Makefile 添加和调用目标
coverage: lcov -d . -c -o lcov.info genhtml --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=./src/ `find . -name lcov.info -print`
感谢来自 pgxn-users 邮件列表的 Ronan Dunklau。
关于postgresql - 如何在 Postgres 扩展上运行覆盖率报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31417900/