Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c0885c4

Browse files
committed
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 ed7a509 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
1 parent 347d2b0 commit c0885c4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/test/regress/expected/explain.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ begin
2020
ln := regexp_replace(ln, '\m\d+\M', 'N', 'g');
2121
-- In sort output, the above won't match units-suffixed numbers
2222
ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g');
23-
-- Text-mode buffers output varies depending on the system state
24-
ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]');
23+
-- Ignore text-mode buffers output because it varies depending
24+
-- on the system state
25+
CONTINUE WHEN (ln ~ ' +Buffers: .*');
2526
return next ln;
2627
end loop;
2728
end;
@@ -71,10 +72,9 @@ select explain_filter('explain (analyze, buffers, format text) select * from int
7172
explain_filter
7273
-----------------------------------------------------------------------------------------------
7374
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)
74-
Buffers: shared [read]
7575
Planning Time: N.N ms
7676
Execution Time: N.N ms
77-
(4 rows)
77+
(3 rows)
7878

7979
select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8');
8080
explain_filter

src/test/regress/sql/explain.sql

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ begin
2222
ln := regexp_replace(ln, '\m\d+\M', 'N', 'g');
2323
-- In sort output, the above won't match units-suffixed numbers
2424
ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g');
25-
-- Text-mode buffers output varies depending on the system state
26-
ln := regexp_replace(ln, '^( +Buffers: shared)( hit=N)?( read=N)?', '\1 [read]');
25+
-- Ignore text-mode buffers output because it varies depending
26+
-- on the system state
27+
CONTINUE WHEN (ln ~ ' +Buffers: .*');
2728
return next ln;
2829
end loop;
2930
end;

0 commit comments

Comments
 (0)