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

Fix random UT failures on PosixFile #2862

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

rlcheng
Copy link
Collaborator

@rlcheng rlcheng commented Sep 5, 2024

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

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.

 * 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.
 * Fix additional issue where randomly generate file name may be
   too large for POSIX.
@thomas-bc thomas-bc changed the title Fix/random ut failure posixfile Fix random UT failures on PosixFile Sep 10, 2024
 * 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));
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@LeStarch LeStarch left a 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.

@LeStarch
Copy link
Collaborator

Merging despite known CI failure.

@LeStarch LeStarch merged commit 3f8830b into nasa:devel Sep 18, 2024
33 of 34 checks 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.

3 participants