-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix random UT failures on PosixFile #2862
Conversation
* Fix UT failing FinalizeCrc test when crc calculation miss match. Miss match due to file crc and shadow being out of sync when both are not reinialized at the same time. * Update File::open in File.ccp to match shadow operation in FileRules.cpp to only reset crc when status is OP_OK. * Update FileRules.cpp to print out rule name during test. * Remove changing file mode in shadow_open() in FileRules.cpp to OPEN_NO_MODE when status is not OP_OK.
2fbcb65
to
c6bcae4
Compare
* Fix additional issue where randomly generate file name may be too large for POSIX.
c6bcae4
to
2e39bf6
Compare
* Fix preallocate test from picking 0 for length, which causes unintentional error in preallocate cmd. * Fix seek() in SyntheticFileSystem and assert_file_seek() to allow for offset being 0.
@@ -497,7 +497,7 @@ void Os::Test::File::Tester::Preallocate::action( | |||
state.assert_file_consistent(); | |||
FileState original_file_state = state.current_file_state(); | |||
FwSignedSizeType offset = static_cast<FwSignedSizeType>(STest::Pick::lowerUpper(0, FILE_DATA_MAXIMUM)); | |||
FwSignedSizeType length = static_cast<FwSignedSizeType>(STest::Pick::lowerUpper(0, FILE_DATA_MAXIMUM)); | |||
FwSignedSizeType length = static_cast<FwSignedSizeType>(STest::Pick::lowerUpper(1, FILE_DATA_MAXIMUM)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rlcheng do we have a test that proves that preallocate errors on a "0" size argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We dont have one. Currently the SeekInvalidSize test randomly picks using the range original_file_state.position + 1, std::numeric+_limits. Seems to be always a positive non zero value that gets multiplied by -1. We can change the range to: 0, std::numeric_limits.
This should guarantee in a randomized test we can get a 0 or negative value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's track as a separate issue. Rather than randomizing, we should just add a specific test to the interface tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick question, but otherwise this looks good.
Merging despite known CI failure. |
Change Description
A description of the changes contained in the PR.
Rationale
A rationale for this change. e.g. fixes bug, or most projects need XYZ feature.
Testing/Review Recommendations
Fill in testing procedures, specific items to focus on for review, or other info to help the team verify these changes are flight-quality.
Future Work
Note any additional work that will be done relating to this issue.