postgresql 的回归测试初探
os: centos 7.4
postgresql: 10.4
Regression Tests
回归测试,是一个用于验证PostgreSQL在你的系统上是否按照开发人员设想的那样运行的测试套件。
看来这个回归测试时必须的
开始回归测试
在 make world 执行完之后,make install-world 执行前,运行 make check 进行回归测试。
如果是已经安装好的postgresql,则需要运行 make installcheck、make installcheck-parallel
$ make check
parallel group (17 tests): init_privs drop_operator lock security_label password tablesample replica_identity object_address collate groupingsets gin spgist matview brin rowsecurity gist privileges
rowsecurity ... FAILED
tablesample ... FAILED
parallel group (20 tests): json_encoding portals_p2 tsdicts advisory_lock combocid equivclass xmlmap guc select_views dependency json functional_deps tsearch window jsonb cluster bitmapops foreign_key indirect_toast foreign_data
select_views ... FAILED
indirect_toast ... FAILED
============== shutting down postmaster ==============
========================
4 of 178 tests failed.
========================
The differences that caused some tests to fail can be viewed in the
file "/tmp/postgresql-10.4/src/test/regress/regression.diffs". A copy of the test summary that you see
above is saved in the file "/tmp/postgresql-10.4/src/test/regress/regression.out".
make[1]: *** [check] Error 1
make[1]: Leaving directory `/tmp/postgresql-10.4/src/test/regress'
make: *** [check] Error 2
发现有几个失败提示。
失败结果分析
查看文件/tmp/postgresql-10.4/src/test/regress/regression.diffs
rowsecurity … FAILED
*** /tmp/postgresql-10.4/src/test/regress/expected/rowsecurity.out 2018-05-08 04:51:40.000000000 +0800
--- /tmp/postgresql-10.4/src/test/regress/results/rowsecurity.out 2018-07-26 10:45:51.518000000 +0800
发现内容是一些执行计划有差异的信息。
tablesample … FAILED
*** /tmp/postgresql-10.4/src/test/regress/expected/tablesample.out 2018-05-08 04:51:40.000000000 +0800
--- /tmp/postgresql-10.4/src/test/regress/results/tablesample.out 2018-07-26 10:45:50.506000000 +0800
发现内容是一些表的数据输出有差异的信息。
select_views … FAILED
*** /tmp/postgresql-10.4/src/test/regress/expected/select_views.out 2018-05-08 04:51:40.000000000 +0800
--- /tmp/postgresql-10.4/src/test/regress/results/select_views.out 2018-07-26 10:45:54.626000000 +0800
也是执行计划的一些差异。
indirect_toast … FAILED
*** /tmp/postgresql-10.4/src/test/regress/expected/indirect_toast.out 2018-05-08 04:51:40.000000000 +0800
--- /tmp/postgresql-10.4/src/test/regress/results/indirect_toast.out 2018-07-26 10:45:55.400000000 +0800
一堆 SELECT substring(toasttest::text, 1, 200) FROM toasttest 的输出
暂时还不清楚这个东西怎么看,待以后弄清楚再补充。
或者路过的大神指点下。
参考:
http://postgres.cn/docs/10/install-procedure.html
http://postgres.cn/docs/10/regress.html
下面是 make chekc 的完整输出,记录一下
rm -rf '/tmp/postgresql-10.4'/tmp_install
/bin/mkdir -p '/tmp/postgresql-10.4'/tmp_install/log
make -C '.' DESTDIR='/tmp/postgresql-10.4'/tmp_install install >'/tmp/postgresql-10.4'/tmp_install/log/install.log 2>&1
make -C src/test/regress check
make[1]: Entering directory `/tmp/postgresql-10.4/src/test/regress'
make -C ../../../src/port all
make[2]: Entering directory `/tmp/postgresql-10.4/src/port'
make -C ../backend submake-errcodes
make[3]: Entering directory `/tmp/postgresql-10.4/src/backend'
make[3]: Nothing to be done for `submake-errcodes'.
make[3]: Leaving directory `/tmp/postgresql-10.4/src/backend'
make[2]: Leaving directory `/tmp/postgresql-10.4/src/port'
make -C ../../../src/common all
make[2]: Entering directory `/tmp/postgresql-10.4/src/common'
make -C ../backend submake-errcodes
make[3]: Entering directory `/tmp/postgresql-10.4/src/backend'
make[3]: Nothing to be done for `submake-errcodes'.
make[3]: Leaving directory `/tmp/postgresql-10.4/src/backend'
make[2]: Leaving directory `/tmp/postgresql-10.4/src/common'
make -C ../../../src/backend generated-headers
make[2]: Entering directory `/tmp/postgresql-10.4/src/backend'
make -C catalog schemapg.h
make[3]: Entering directory `/tmp/postgresql-10.4/src/backend/catalog'
make[3]: `schemapg.h' is up to date.
make[3]: Leaving directory `/tmp/postgresql-10.4/src/backend/catalog'
make[2]: Leaving directory `/tmp/postgresql-10.4/src/backend'
make -C ../../../contrib/spi
make[2]: Entering directory `/tmp/postgresql-10.4/contrib/spi'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/tmp/postgresql-10.4/contrib/spi'
rm -rf ./testtablespace
mkdir ./testtablespace
PATH="/tmp/postgresql-10.4/tmp_install/usr/pgsql-10/bin:$PATH" LD_LIBRARY_PATH="/tmp/postgresql-10.4/tmp_install/usr/pgsql-10/lib:$LD_LIBRARY_PATH" ../../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=. --bindir= --dlpath=. --schedule=./parallel_schedule
============== creating temporary instance ==============
============== initializing database system ==============
============== starting postmaster ==============
running on port 50852 with PID 19444
============== creating database "regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test tablespace ... ok
parallel group (20 tests): regproc oid pg_lsn char varchar float4 int2 txid name text int4 money uuid boolean bit float8 int8 enum numeric rangetypes
boolean ... ok
char ... ok
name ... ok
varchar ... ok
text ... ok
int2 ... ok
int4 ... ok
int8 ... ok
oid ... ok
float4 ... ok
float8 ... ok
bit ... ok
numeric ... ok
txid ... ok
uuid ... ok
enum ... ok
money ... ok
rangetypes ... ok
pg_lsn ... ok
regproc ... ok
test strings ... ok
test numerology ... ok
parallel group (20 tests): lseg reltime time timetz circle path abstime tinterval polygon macaddr line macaddr8 point tstypes interval inet date box timestamp timestamptz
point ... ok
lseg ... ok
line ... ok
box ... ok
path ... ok
polygon ... ok
circle ... ok
date ... ok
time ... ok
timetz ... ok
timestamp ... ok
timestamptz ... ok
interval ... ok
abstime ... ok
reltime ... ok
tinterval ... ok
inet ... ok
macaddr ... ok
macaddr8 ... ok
tstypes ... ok
parallel group (9 tests): comments expressions misc_sanity geometry horology type_sanity oidjoins opr_sanity regex
geometry ... ok
horology ... ok
regex ... ok
oidjoins ... ok
type_sanity ... ok
opr_sanity ... ok
misc_sanity ... ok
comments ... ok
expressions ... ok
test insert ... ok
test insert_conflict ... ok
test create_function_1 ... ok
test create_type ... ok
test create_table ... ok
test create_function_2 ... ok
parallel group (3 tests): copyselect copydml copy
copy ... ok
copyselect ... ok
copydml ... ok
parallel group (2 tests): create_operator create_misc
create_misc ... ok
create_operator ... ok
parallel group (2 tests): create_view create_index
create_index ... ok
create_view ... ok
parallel group (14 tests): create_aggregate create_cast drop_if_exists roleattributes create_am create_function_3 typed_table create_table_like vacuum constraints rolenames triggers inherit updatable_views
create_aggregate ... ok
create_function_3 ... ok
create_cast ... ok
constraints ... ok
triggers ... ok
inherit ... ok
create_table_like ... ok
typed_table ... ok
vacuum ... ok
drop_if_exists ... ok
updatable_views ... ok
rolenames ... ok
roleattributes ... ok
create_am ... ok
test sanity_check ... ok
test errors ... ok
test select ... ok
parallel group (20 tests): select_distinct_on delete random select_having namespace select_distinct select_implicit case btree_index update select_into prepared_xacts transactions portals subselect union arrays aggregates join hash_index
select_into ... ok
select_distinct ... ok
select_distinct_on ... ok
select_implicit ... ok
select_having ... ok
subselect ... ok
union ... ok
case ... ok
join ... ok
aggregates ... ok
transactions ... ok
random ... ok
portals ... ok
arrays ... ok
btree_index ... ok
hash_index ... ok
update ... ok
namespace ... ok
prepared_xacts ... ok
delete ... ok
parallel group (17 tests): init_privs drop_operator lock security_label password tablesample replica_identity object_address collate groupingsets gin spgist matview brin rowsecurity gist privileges
brin ... ok
gin ... ok
gist ... ok
spgist ... ok
privileges ... ok
init_privs ... ok
security_label ... ok
collate ... ok
matview ... ok
lock ... ok
replica_identity ... ok
rowsecurity ... FAILED
object_address ... ok
tablesample ... FAILED
groupingsets ... ok
drop_operator ... ok
password ... ok
parallel group (11 tests): async misc_functions dbsize tidscan alter_operator tsrf psql sysviews alter_generic misc stats_ext
alter_generic ... ok
alter_operator ... ok
misc ... ok
psql ... ok
async ... ok
dbsize ... ok
misc_functions ... ok
sysviews ... ok
tsrf ... ok
tidscan ... ok
stats_ext ... ok
parallel group (3 tests): amutils psql_crosstab rules
rules ... ok
psql_crosstab ... ok
amutils ... ok
test select_parallel ... ok
parallel group (2 tests): subscription publication
publication ... ok
subscription ... ok
parallel group (20 tests): json_encoding portals_p2 tsdicts advisory_lock combocid equivclass xmlmap guc select_views dependency json functional_deps tsearch window jsonb cluster bitmapops foreign_key indirect_toast foreign_data
select_views ... FAILED
portals_p2 ... ok
foreign_key ... ok
cluster ... ok
dependency ... ok
guc ... ok
bitmapops ... ok
combocid ... ok
tsearch ... ok
tsdicts ... ok
foreign_data ... ok
window ... ok
xmlmap ... ok
functional_deps ... ok
advisory_lock ... ok
json ... ok
jsonb ... ok
json_encoding ... ok
indirect_toast ... FAILED
equivclass ... ok
parallel group (19 tests): conversion prepare limit returning plancache without_oid temp copy2 truncate polymorphism sequence with rowtypes domain rangefuncs largeobject xml alter_table plpgsql
plancache ... ok
limit ... ok
plpgsql ... ok
copy2 ... ok
temp ... ok
domain ... ok
rangefuncs ... ok
prepare ... ok
without_oid ... ok
conversion ... ok
truncate ... ok
alter_table ... ok
sequence ... ok
polymorphism ... ok
rowtypes ... ok
returning ... ok
largeobject ... ok
with ... ok
xml ... ok
test identity ... ok
test event_trigger ... ok
test stats ... ok
============== shutting down postmaster ==============
========================
4 of 178 tests failed.
========================
The differences that caused some tests to fail can be viewed in the
file "/tmp/postgresql-10.4/src/test/regress/regression.diffs". A copy of the test summary that you see
above is saved in the file "/tmp/postgresql-10.4/src/test/regress/regression.out".
make[1]: *** [check] Error 1
make[1]: Leaving directory `/tmp/postgresql-10.4/src/test/regress'
make: *** [check] Error 2