Skip to content

Commit

Permalink
Perform InitAPI ShutdownAPI per each test suite in S3 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyRyabinin committed Apr 16, 2024
1 parent 1ddf39e commit c646018
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})
if(MSVC AND BUILD_SHARED_LIBS)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS
"/DELAYLOAD:aws-cpp-sdk-access-management.dll /DELAYLOAD:aws-cpp-sdk-cognito-identity /DELAYLOAD:aws-cpp-sdk-iam /DELAYLOAD:aws-cpp-sdk-core.dll")
target_link_libraries(${PROJECT_NAME} delayimp.lib)
endif()
1 change: 1 addition & 0 deletions tests/aws-cpp-sdk-s3-crt-integration-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})

if(MSVC AND BUILD_SHARED_LIBS)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DELAYLOAD:aws-cpp-sdk-s3-crt.dll /DELAYLOAD:aws-cpp-sdk-core.dll")
target_link_libraries(${PROJECT_NAME} delayimp.lib)
endif()

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/aws-cpp-sdk-s3-integration-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})

if(MSVC AND BUILD_SHARED_LIBS)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DELAYLOAD:aws-cpp-sdk-s3.dll /DELAYLOAD:aws-cpp-sdk-core.dll")
target_link_libraries(${PROJECT_NAME} delayimp.lib)
endif()
16 changes: 1 addition & 15 deletions tests/aws-cpp-sdk-s3-integration-tests/RunTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,14 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#include <gtest/gtest.h>
#include <aws/core/Aws.h>
#include <aws/testing/platform/PlatformTesting.h>
#include <aws/testing/AwsCppSdkGTestSuite.h>
#include <aws/testing/TestingEnvironment.h>
#include <aws/testing/MemoryTesting.h>

int main(int argc, char** argv)
{
Aws::Testing::SetDefaultSigPipeHandler();
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
AWS_BEGIN_MEMORY_TEST_EX(options, 1024, 128);

Aws::Testing::InitPlatformTest(options);
Aws::Testing::ParseArgs(argc, argv);

Aws::InitAPI(options);
::testing::InitGoogleTest(&argc, argv);
int exitCode = RUN_ALL_TESTS();

Aws::ShutdownAPI(options);
AWS_END_MEMORY_TEST_EX;
Aws::Testing::ShutdownPlatformTest(options);
return exitCode;
}
4 changes: 2 additions & 2 deletions tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#include <gtest/gtest.h>
#include <aws/testing/AwsCppSdkGTestSuite.h>
#include <aws/testing/AwsTestHelpers.h>
#include <aws/core/platform/Environment.h>
#include <aws/core/http/HttpResponse.h>
Expand Down Expand Up @@ -53,7 +53,7 @@ namespace {
const char* ALLOCATION_TAG = "S3ClientS3ExpressTest";
const char* S3_EXPRESS_SUFFIX = "--use1-az6--x-s3";

class S3ExpressTest : public ::testing::Test {
class S3ExpressTest : public Aws::Testing::AwsCppSdkGTestSuite {
public:
CreateBucketOutcome CreateBucket(const Aws::String &bucketName = randomString() + S3_EXPRESS_SUFFIX) {
bucketsToCleanup.push_back(bucketName);
Expand Down
1 change: 1 addition & 0 deletions tests/aws-cpp-sdk-s3-unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})

if(MSVC AND BUILD_SHARED_LIBS)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DELAYLOAD:aws-cpp-sdk-s3.dll /DELAYLOAD:aws-cpp-sdk-core.dll")
target_link_libraries(${PROJECT_NAME} delayimp.lib)
endif()

include(GoogleTest)
Expand Down

0 comments on commit c646018

Please sign in to comment.