Skip to content

Commit

Permalink
Fix Random UT Failure: PosixFile (nasa#2835)
Browse files Browse the repository at this point in the history
 * Update get_test_filename() to exclude certain special characters
   and change minimum filename length to prevent posix open() from
   getting an unintentional bad file name.
  • Loading branch information
rlcheng committed Oct 10, 2024
1 parent 7d0bb43 commit 1f78ffc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Os/Posix/test/ut/PosixFileTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ std::shared_ptr<std::string> get_test_filename(bool random) {
if (random) {
filename = buffer;
size_t i = 0;
for (i = 0; i < STest::Pick::lowerUpper(1, (sizeof buffer) - 1); i++) {
char selected_character = static_cast<char>(STest::Pick::lowerUpper(32, 126));
for (i = 0; i < STest::Pick::lowerUpper(2, (sizeof buffer) - 1); i++) {
char selected_character = static_cast<char>(STest::Pick::lowerUpper(48, 126));
selected_character =
(selected_character == '/') ? static_cast<char>(selected_character + 1) : selected_character;
buffer[i] = selected_character;
Expand Down

0 comments on commit 1f78ffc

Please sign in to comment.