Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] [full-ci] Check for newline at end of expected-failures file #39726

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jan 28, 2022

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:

while read SUITE_SCENARIO
  do
    ...
  done < ${EXPECTED_FAILURES_FILE}

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:

if [ $(tail -c1 "${EXPECTED_FAILURES_FILE}" | wc -l) -eq 0 ]

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

Copy link
Member

@individual-it individual-it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update needed?

@sonarcloud
Copy link

sonarcloud bot commented Jan 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@phil-davis
Copy link
Contributor Author

doc update needed?

I couldn't find expected-failures mentioned at all in the developer acceptance test docs. So I raised a general docs issue to document it.

owncloud/docs-server#57

@phil-davis phil-davis merged commit 137c3c0 into master Jan 28, 2022
@delete-merged-branch delete-merged-branch bot deleted the test-for-newline branch January 28, 2022 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants