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

ZTS: fix spurious failures in mv_files #7258

Merged
merged 1 commit into from
Mar 2, 2018
Merged

Conversation

chrisrd
Copy link
Contributor

@chrisrd chrisrd commented Mar 1, 2018

Fix spurious failures in mv_files.

Description

The test could fail because of a race condition between the files being generated in the background and attempting to move the files. Wait for all file generation to complete before trying to move the files around.

Also, clean up the waiting: the 'wait' command without arguments waits for all child pids. There's no need to imperfectly look to see if each pid exists and then wait for that pid explicitly. (Imperfectly: no need to look at all pids on the system with -e, just our own pids would have been fine, and looking for pid 123 with grep would find 1234 thus negating the purpose of the check).

Note: the leading whitespace in this file is atrocious, but fixing it all hides what's being fixed.

Motivation and Context

Spurious failures are annoying and time wasting.

How Has This Been Tested?

Run zfs-tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

The test could fail because of a race condition between the files being
generated in the background and attempting to move the files. Wait for
all file generation to complete before trying to move the files around.

Also, clean up the waiting: the 'wait' command without arguments waits
for all child pids.

Signed-off-by: Chris Dunlop <[email protected]>
@chrisrd chrisrd changed the title ZFS: fix spurious failures in mv_files ZTS: fix spurious failures in mv_files Mar 2, 2018
Copy link
Member

@gmelikov gmelikov left a comment

Choose a reason for hiding this comment

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

LGTM, thanks, great find!

@codecov
Copy link

codecov bot commented Mar 2, 2018

Codecov Report

Merging #7258 into master will decrease coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7258      +/-   ##
==========================================
- Coverage   76.57%   76.42%   -0.16%     
==========================================
  Files         327      327              
  Lines      103866   103866              
==========================================
- Hits        79537    79380     -157     
- Misses      24329    24486     +157
Flag Coverage Δ
#kernel 76.18% <ø> (-0.21%) ⬇️
#user 65.7% <ø> (-0.22%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e086e71...4e8c3e3. Read the comment docs.

@chrisrd
Copy link
Contributor Author

chrisrd commented Mar 2, 2018

Worth mentioning: I checked for similar faulty idioms in the rest of tests and didn't find any...

Look for cut/pasted code:

$ grep -riI 'GANGPIDS' tests || grep none
none

Manually inspect for backgrounding without waiting:

$ pat='[^&]&[[:space:]]*$'; vi +/"$pat" $(grep -rlI "$pat" tests)

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks!

@behlendorf behlendorf merged commit d0f6fba into openzfs:master Mar 2, 2018
@chrisrd chrisrd deleted the mv_files branch March 2, 2018 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants