Skip to content

Commit 47f39a3

Browse files
committed
Made Testing-Resources a library, DDB integ test works
Moved Testing-Resources target to be a library since we use it in all the tests, integ and unit. Fixed missed inclussion in platform testing that prevented symbols to be accessible for the consumers of the library. Added generated Testing-Resources export. Added build of DynamoDB integration tests.
1 parent a992f33 commit 47f39a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+96
-54
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
add_subdirectory(aws-cpp-sdk-core)
22
if (BUILD_TESTING)
3+
add_subdirectory(testing-resources)
34
add_subdirectory(aws-cpp-sdk-core-tests)
45
endif ()

src/aws-cpp-sdk-core-tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if (NOT LEGACY_BUILD)
55
aws-sdk-cpp-core-test
66
GTest::GTest
77
aws-sdk-cpp::core
8+
aws-sdk-cpp::testing-resources
89
aws-crt-cpp
910
)
1011
target_sources(
@@ -17,7 +18,6 @@ if (NOT LEGACY_BUILD)
1718
add_subdirectory(aws)
1819
add_subdirectory(http)
1920
add_subdirectory(monitoring)
20-
add_subdirectory(testing-resources)
2121
add_subdirectory(utils)
2222

2323
gtest_discover_tests(aws-sdk-cpp-core-test)

src/aws-cpp-sdk-core-tests/testing-resources/include/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/aws-cpp-sdk-core-tests/testing-resources/include/aws/testing/Testing_EXPORTS.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/aws-cpp-sdk-core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ if (NOT LEGACY_BUILD)
2828
EXPORT_MACRO_NAME AWS_CORE_API # to be backward compatible during LEGACY_BUILD exist until 1.11
2929
)
3030

31-
3231
add_subdirectory(include)
3332
add_subdirectory(source)
3433
else ()

src/aws-cpp-sdk-core-tests/testing-resources/CMakeLists.txt renamed to src/testing-resources/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# SPDX-License-Identifier: Apache-2.0.
33
#
44
if (NOT LEGACY_BUILD)
5+
add_library(aws-sdk-cpp-testing-resources)
6+
add_library(aws-sdk-cpp::testing-resources ALIAS aws-sdk-cpp-testing-resources)
7+
8+
target_link_libraries(
9+
aws-sdk-cpp-testing-resources
10+
aws-sdk-cpp::core
11+
GTest::GTest
12+
)
13+
514
add_subdirectory(include)
615
add_subdirectory(source)
716
else()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
target_include_directories(
2+
aws-sdk-cpp-testing-resources
3+
BEFORE
4+
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
5+
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
6+
)
7+
8+
include(GenerateExportHeader)
9+
generate_export_header(
10+
aws-sdk-cpp-testing-resources
11+
EXPORT_MACRO_NAME AWS_TESTING_API # to be backward compatible during LEGACY_BUILD exist until 1.11
12+
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0.
4+
*/
5+
6+
#pragma once
7+
8+
#ifdef NON_LEGACY_BUILD
9+
#include "aws-sdk-cpp-testing-resources_export.h"
10+
#else
11+
#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
12+
#ifdef _MSC_VER
13+
#pragma warning(disable : 4251)
14+
#endif // MSVC
15+
16+
#ifdef USE_IMPORT_EXPORT
17+
#ifdef AWS_TESTING_EXPORTS
18+
#define AWS_TESTING_API __declspec(dllexport)
19+
#else
20+
#define AWS_TESTING_API __declspec(dllimport)
21+
#endif /* AWS_TESTING_EXPORTS */
22+
#else
23+
#define AWS_TESTING_API
24+
#endif // USE_IMPORT_EXPORT
25+
#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
26+
#define AWS_TESTING_API
27+
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
28+
#endif

src/aws-cpp-sdk-core-tests/testing-resources/source/CMakeLists.txt renamed to src/testing-resources/source/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
target_sources(
2-
aws-sdk-cpp-core-test
2+
aws-sdk-cpp-testing-resources
33
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/MemoryTesting.cpp
44
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/TestingEnvironment.cpp
55
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/platform/linux-shared/PlatformTesting.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <stdlib.h>
77

8+
#include <aws/testing/platform/PlatformTesting.h>
89
#include <aws/core/Aws.h>
910

1011
namespace Aws

tests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (BUILD_TESTING)
2+
add_subdirectory(aws-cpp-sdk-dynamodb-integration-tests)
3+
endif ()
Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
1-
add_project(aws-cpp-sdk-dynamodb-integration-tests
2-
"Tests for the AWS DynamoDb C++ SDK"
3-
aws-cpp-sdk-dynamodb
4-
testing-resources
5-
aws-cpp-sdk-core)
1+
if (NOT LEGACY_BUILD)
2+
add_executable(aws-cpp-sdk-dynamodb-integration-tests)
63

7-
# Headers are included in the source so that they show up in Visual Studio.
8-
# They are included elsewhere for consistency.
4+
target_link_libraries(
5+
aws-cpp-sdk-dynamodb-integration-tests
6+
GTest::GTest
7+
aws-sdk-cpp::dynamodb
8+
aws-sdk-cpp::testing-resources
9+
)
10+
target_sources(
11+
aws-cpp-sdk-dynamodb-integration-tests
12+
PRIVATE
13+
${CMAKE_CURRENT_SOURCE_DIR}/RunTests.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/TableOperationTest.cpp
15+
)
16+
gtest_discover_tests(aws-cpp-sdk-dynamodb-integration-tests)
917

10-
file(GLOB AWS_DYNAMO_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
11-
file(GLOB AWS_DYNAMO_INTEGRATION_TESTS_SRC ${AWS_DYNAMO_SRC})
18+
else()
19+
add_project(aws-cpp-sdk-dynamodb-integration-tests
20+
"Tests for the AWS DynamoDb C++ SDK"
21+
aws-cpp-sdk-dynamodb
22+
testing-resources
23+
aws-cpp-sdk-core)
1224

13-
if(MSVC AND BUILD_SHARED_LIBS)
14-
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
15-
endif()
25+
# Headers are included in the source so that they show up in Visual Studio.
26+
# They are included elsewhere for consistency.
1627

17-
enable_testing()
28+
file(GLOB AWS_DYNAMO_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
29+
file(GLOB AWS_DYNAMO_INTEGRATION_TESTS_SRC ${AWS_DYNAMO_SRC})
1830

19-
if(PLATFORM_ANDROID AND BUILD_SHARED_LIBS)
20-
add_library(${PROJECT_NAME} ${AWS_DYNAMO_INTEGRATION_TESTS_SRC})
21-
else()
22-
add_executable(${PROJECT_NAME} ${AWS_DYNAMO_INTEGRATION_TESTS_SRC})
23-
endif()
31+
if(MSVC AND BUILD_SHARED_LIBS)
32+
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
33+
endif()
34+
35+
enable_testing()
36+
37+
if(PLATFORM_ANDROID AND BUILD_SHARED_LIBS)
38+
add_library(${PROJECT_NAME} ${AWS_DYNAMO_INTEGRATION_TESTS_SRC})
39+
else()
40+
add_executable(${PROJECT_NAME} ${AWS_DYNAMO_INTEGRATION_TESTS_SRC})
41+
endif()
2442

25-
set_compiler_flags(${PROJECT_NAME})
26-
set_compiler_warnings(${PROJECT_NAME})
43+
set_compiler_flags(${PROJECT_NAME})
44+
set_compiler_warnings(${PROJECT_NAME})
2745

28-
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})
46+
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})
47+
endif()

0 commit comments

Comments
 (0)