Summary:
For a long time, the regress test framework has used a preprocessor
that, among several things, trims trailing whitespace and excessive
trailing newlines from the expected and result ".out" files, then
compares them. Often, developers take the result ".out" file lines and
copy them over to the expected ".out" file. In case of ported tests,
developers may also copy lines over from the original test's expected
".out". This results in a mixture of the presence and absence of
trailing whitespace. And lazy copy-pasting could result in unrelated
output lines switching back and forth between having trailing whitespace
and not (for example, commit 3575926b8089d77376f18e6f01a1cbc076091119).
With that as the main motivation, enforce that all trailing whitespace
should be preserved exactly. To clarify, before this change:
- expected/foo.out: preserve trailing whitespace
- expected/yb.port.foo.out: don't care
- results/yb.port.foo.out: trim trailing whitespace
After this change:
- expected/foo.out: preserve trailing whitespace
- expected/yb.port.foo.out: preserve trailing whitespace
- results/yb.port.foo.out: preserve trailing whitespace
Do this by changing the preprocessor
(python/yugabyte/pg_regress_postprocess_output.py) to not rstrip all
kinds of whitespace and only rstrip the newline character. Also notice
that the way it was splitting the file into lines did not properly
account for carriage return characters, such as in the yb.port.name
test. This destructively maps both carriage return and newline
characters to newline, so it reduces test coverage. Fix by specifying
only the newline character to be considered as newline. Finally, get
rid of the code that removes extra lines at the end of the file.
Further, change SideBySideDiff.java to not ignore trailing whitespace.
Jira: DB-15543
Test Plan:
jenkins
Close: #26198
Depends on D42304
Reviewers: sanketh
Reviewed By: sanketh
Subscribers: sanketh, yql
Differential Revision: https://phorge.dev.yugabyte.com/D42307