Commit c0885c4c authored by Fujii Masao's avatar Fujii Masao

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 ed7a5095 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
parent 347d2b07
...@@ -20,8 +20,9 @@ begin ...@@ -20,8 +20,9 @@ begin
ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); ln := regexp_replace(ln, '\m\d+\M', 'N', 'g');
-- In sort output, the above won't match units-suffixed numbers -- In sort output, the above won't match units-suffixed numbers
ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g'); ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g');
-- Text-mode buffers output varies depending on the system state -- Ignore text-mode buffers output because it varies depending
ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]'); -- on the system state
CONTINUE WHEN (ln ~ ' +Buffers: .*');
return next ln; return next ln;
end loop; end loop;
end; end;
...@@ -71,10 +72,9 @@ select explain_filter('explain (analyze, buffers, format text) select * from int ...@@ -71,10 +72,9 @@ select explain_filter('explain (analyze, buffers, format text) select * from int
explain_filter 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) 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 Planning Time: N.N ms
Execution 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'); select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8');
explain_filter explain_filter
......
...@@ -22,8 +22,9 @@ begin ...@@ -22,8 +22,9 @@ begin
ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); ln := regexp_replace(ln, '\m\d+\M', 'N', 'g');
-- In sort output, the above won't match units-suffixed numbers -- In sort output, the above won't match units-suffixed numbers
ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g'); ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g');
-- Text-mode buffers output varies depending on the system state -- Ignore text-mode buffers output because it varies depending
ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]'); -- on the system state
CONTINUE WHEN (ln ~ ' +Buffers: .*');
return next ln; return next ln;
end loop; end loop;
end; end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment