Skip to content

Test failures in aws-cpp-sdk-core-tests with MinGW/gcc 11.4.0 on Windows 11 (Aws::FileSystem::CreateDirectoryIfNotExists) #3552

@timothy-he

Description

@timothy-he

Describe the bug

While I compile the project, the test case DirectoryTreeTest.CreateDirectoryIfNotExistedTest in aws-cpp-sdk-core-tests fail with assertion errors when building aws-sdk-cpp using MinGW (gcc 11.4.0) on Windows 11. The failures output errors such as assertion failures.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

All test cases should pass and the compilation procedure should complete successfully.

Current Behavior

D:/Pyronix/Code/aws-sdk-cpp/tests/aws-cpp-sdk-core-tests/utils/FileSystemUtilsTest.cpp:288: Failure
Value of: FileSystem::CreateDirectoryIfNotExists(FileSystem::Join(FileSystem::Join(dir2, "dir3"), longDirName).c_str(), true )
Actual: false
Expected: true
[ FAILED ] DirectoryTreeTest.CreateDirectoryIfNotExistedTest (6 ms)

Reproduction Steps

  1. Build the project with:
    cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DAWS_SDK_WARNINGS_ARE_ERRORS=off
    ninja
    
  2. Run the test suite.

Possible Solution

The root cause is the first if condition i != 0 in for loop of function CreateDirectoryIfNotExists; While parameter createParentDirs set to true, it will create intermediate directories one by one through the delimiter \, but the first directoryName trimmed by \ is C: in Windows System which is not able to create obviously, so the if condition should be changed to i > 2 to skip trimming the single drive letter C:.
The PR #3551 I have been created can fix this.

Additional Information/Context

No response

AWS CPP SDK version used

1.11.643

Compiler and Version used

gcc.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 11.4.0

Operating System and version

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions