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

Do not report file input rewind if nothing was read repeatedly. #22

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

mbroz
Copy link
Contributor

@mbroz mbroz commented Feb 23, 2024

Some tests require a fixed amount of data.
Currently, with file input, if the size is exact, the file rewind is reported, although nothing is being read repeatedly (only EOF was reached).
The file must contain more bytes than needed to avoid it.

As we use the file rewind message to detect problems with input size, this patch modifies the rewind count function not to detect rewind if nothing has been read repeatedly yet.
The function is used in output.c only, this seems the simplest solution.

Simple reproducible with the DBA OPSO2 test that requires exactly 256M:
dd if=/dev/urandom of=test.img bs=1M count=256
dieharder -d 211 -g 201 -f test.img

This message appears
The file file_input_raw was rewound 1 times

Adding 4 more bytes (that are never read), the test is happy again
truncate -s 268435460 test.img

With this patch, adding more data is no longer needed, while real rewind reads are still reported.

Some tests require a fixed amount of data.
Currently, with file input, if the size is exact, the file rewind
is reported, although nothing is being read repeatedly
(only EOF was reached).
The file must contain more bytes than needed to avoid it.

As we use the file rewind message to detect problems with input size,
this patch modifies the rewind count function not to detect rewind
if nothing has been read repeatedly yet.
The function is used in output.c only, this seems the simplest solution.

Simple reproducible with the DBA OPSO2 test that requires exactly 256M:

dd if=/dev/urandom of=test.img bs=1M count=256
dieharder -d 211 -g 201 -f test.img

This message appears
  The file file_input_raw was rewound 1 times

Adding 4 more bytes (that are never read), the test is happy again

truncate -s 268435460 test.img

With this patch, adding more data is no longer needed, while
real rewind reads are still reported.
Copy link
Owner

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

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

Thank you for the analysis and PR!

This looks good to me.

@eddelbuettel eddelbuettel merged commit 2d4763a into eddelbuettel:master Feb 23, 2024
1 check passed
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.

2 participants