[tests-only] [full-ci] Check for newline at end of expected-failures file #39726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
See discussion in cs3org/reva#2482
If the last line in an expected-failures file does not have a newline at the end then the test-runner
run.sh
script loop:does not actually read the last line. That is a "feature" of the definition of what is a "line" in a text file/
So expected-failures files must always end with a newline, to be sure that all lines are processed.
The following check does that:
tail -c1
gets the last character of a file.If the last character is not a newline (if it is just an ordinary character) then the count of lines
wc -l
returns 0.If gthe last character is a newline, the
wc -l
returns 1 - a single newline character is a "line".How Has This Been Tested?
CI and cs3org/reva#2485 - see my comments in the PR.
Types of changes
Checklist: