1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/external/gtest.h> 7 #include <aws/core/Aws.h> 8 #include <aws/testing/TestingEnvironment.h> 9 #include <aws/testing/platform/PlatformTesting.h> 10 #include <aws/testing/MemoryTesting.h> 11 12 #if defined(HAS_UMASK) 13 #include <sys/stat.h> 14 #endif 15 main(int argc,char ** argv)16int main(int argc, char** argv) 17 { 18 #if defined(HAS_UMASK) 19 // In order to fix github issue at https://github.com/aws/aws-sdk-cpp/issues/232 20 // Created dir by this process will be set with mode 0777, so that multiple users can build on the same machine 21 umask(0); 22 #endif 23 24 Aws::Testing::RedirectHomeToTempIfAppropriate(); 25 26 Aws::SDKOptions options; 27 options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace; 28 options.httpOptions.installSigPipeHandler = true; 29 AWS_BEGIN_MEMORY_TEST_EX(options, 1024, 128); 30 31 Aws::Testing::InitPlatformTest(options); 32 Aws::InitAPI(options); 33 // Disable EC2 metadata in client configuration to avoid requests retrieving EC2 metadata in unit tests. 34 Aws::Testing::SaveEnvironmentVariable("AWS_EC2_METADATA_DISABLED"); 35 Aws::Environment::SetEnv("AWS_EC2_METADATA_DISABLED", "true", 1/*override*/); 36 ::testing::InitGoogleTest(&argc, argv); 37 int retVal = RUN_ALL_TESTS(); 38 Aws::Testing::RestoreEnvironmentVariables(); 39 Aws::ShutdownAPI(options); 40 AWS_END_MEMORY_TEST_EX; 41 42 Aws::Testing::ShutdownPlatformTest(options); 43 44 return retVal; 45 } 46