diff options
author | Fujii Masao <fujii@postgresql.org> | 2020-04-04 01:25:44 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2020-04-04 01:26:39 +0900 |
commit | c0885c4c30698a1beef40a8df0edb253750d3b43 (patch) | |
tree | eb5e9578dd5ea9f6a4a47f98033fe0632ef0e0ba | |
parent | 347d2b07fcc250680f75b5f89ba49d4805782c6b (diff) | |
download | postgresql-c0885c4c30698a1beef40a8df0edb253750d3b43.tar.gz postgresql-c0885c4c30698a1beef40a8df0edb253750d3b43.zip |
Improve stability of explain regression test.
The explain regression test runs EXPLAIN commands via the function
that filters unstable outputs. To produce more stable test output,
this commit improves the function so that it also filters out text-mode
Buffers lines. This is necessary because text-mode Buffers lines vary
depending the system state.
This improvement will get rid of the regression test failure that
the commit ed7a509571 caused on the buildfarm members prion and
dory because of the instability of Buffers lines.
Author: Fujii Masao
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/20200403025751.GB1759@paquier.xyz
-rw-r--r-- | src/test/regress/expected/explain.out | 8 | ||||
-rw-r--r-- | src/test/regress/sql/explain.sql | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/test/regress/expected/explain.out b/src/test/regress/expected/explain.out index 8f31c308c60..3ec66ceda3c 100644 --- a/src/test/regress/expected/explain.out +++ b/src/test/regress/expected/explain.out @@ -20,8 +20,9 @@ begin ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); -- In sort output, the above won't match units-suffixed numbers ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g'); - -- Text-mode buffers output varies depending on the system state - ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]'); + -- Ignore text-mode buffers output because it varies depending + -- on the system state + CONTINUE WHEN (ln ~ ' +Buffers: .*'); return next ln; end loop; end; @@ -71,10 +72,9 @@ select explain_filter('explain (analyze, buffers, format text) select * from int explain_filter ----------------------------------------------------------------------------------------------- Seq Scan on int8_tbl i8 (cost=N.N..N.N rows=N width=N) (actual time=N.N..N.N rows=N loops=N) - Buffers: shared [read] Planning Time: N.N ms Execution Time: N.N ms -(4 rows) +(3 rows) select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8'); explain_filter diff --git a/src/test/regress/sql/explain.sql b/src/test/regress/sql/explain.sql index e09371f97b8..dce2a342072 100644 --- a/src/test/regress/sql/explain.sql +++ b/src/test/regress/sql/explain.sql @@ -22,8 +22,9 @@ begin ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); -- In sort output, the above won't match units-suffixed numbers ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g'); - -- Text-mode buffers output varies depending on the system state - ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]'); + -- Ignore text-mode buffers output because it varies depending + -- on the system state + CONTINUE WHEN (ln ~ ' +Buffers: .*'); return next ln; end loop; end; |