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 flakiness in cp_files_002_pos #16029

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

rrevans
Copy link
Contributor

@rrevans rrevans commented Mar 26, 2024

Motivation and Context

cp_files_002_pos fails 26 out of 500 times

The $RANDOM count argument to dd can be zero sometimes leading to spurious errors.

Description

Example failing log:

11:25:52.09 SUCCESS: zpool sync testpool
11:25:52.10 SUCCESS: dd if=/dev/urandom of=src.data bs=2048 seek=240 count=0 conv=notrunc
11:25:52.13 ERROR: cp --reflink=always src.data dst.data unexpectedly exited 0

Overwriting with dd ... count=0 does not exercise any code, so then cp --reflink=always spuriously succeeds because it does not test anything.

The fix is to adjust sizes so that $RANDOM yielding zero does not affect the test outcome.

How Has This Been Tested?

Ran cp_files_002_pos 500 times with zero failures.

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)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Fix RANDOM to not return zero.

Overwriting with `dd ... count=0` does not test anything.

Signed-off-by: Robert Evans <evansr@google.com>
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Mar 27, 2024
@behlendorf behlendorf merged commit e39e20b into openzfs:master Mar 27, 2024
22 of 26 checks passed
tonyhutter pushed a commit that referenced this pull request May 2, 2024
Fix RANDOM to not return zero.

Overwriting with `dd ... count=0` does not test anything.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Robert Evans <evansr@google.com>
Closes #16029
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
Fix RANDOM to not return zero.

Overwriting with `dd ... count=0` does not test anything.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Robert Evans <evansr@google.com>
Closes openzfs#16029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants