Skip to content

Commit 5dde822

Browse files
committed
Basic aws-sdk-cpp-core-tests build
1 parent c300546 commit 5dde822

37 files changed

+657
-482
lines changed

CMakeLists.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ else ()
4242
set(CMAKE_CXX_EXTENSIONS OFF)
4343
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4444

45+
# Setting flags for telling compiler this is a non-legacy build
46+
add_definitions(-DNON_LEGACY_BUILD)
47+
4548
# Setting build to hide symbols in targets by default
4649
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
4750
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
@@ -56,6 +59,13 @@ else ()
5659
@ONLY
5760
)
5861

62+
message(STATUS "Generating source file SDKConfig.h for setting memory management options")
63+
configure_file(
64+
SDKConfig.h.in
65+
src/aws-cpp-sdk-core/include/aws/core/SDKConfig.h
66+
@ONLY
67+
)
68+
5969
# Validating config type and setting default if needed
6070
get_property(is_multi_conf_build GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
6171
if (NOT is_multi_conf_build)
@@ -86,13 +96,25 @@ else ()
8696

8797
# -- Dependencies --
8898
add_subdirectory(dependencies)
99+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
100+
# Testing Dependencies
101+
if (BUILD_TESTING)
102+
message(STATUS "Building tests")
103+
# Testing dependency
104+
find_package(GTest 1.11 REQUIRED)
105+
include(GoogleTest) # for gtest_discover_tests()
106+
endif ()
107+
endif ()
89108

90109
# -- main build targets --
91110
add_subdirectory(src)
92111

93112
# -- Tests and packaging if running this as top project --
94113
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
95-
add_subdirectory(tests)
114+
# Testing Dependencies
115+
if (BUILD_TESTING)
116+
add_subdirectory(tests)
117+
endif ()
96118
add_subdirectory(packaging)
97119
endif ()
98120
message(WARNING "The dependencies are currently checked only for a basic Linux build, new ones need to be added for other platforms yet")

SDKConfig.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0.
4+
*/
5+
6+
#cmakedefine USE_AWS_MEMORY_MANAGEMENT
7+

cmake/Findaws-crt-cpp.cmake

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@ message(WARNING "aws-crt-cpp package is mocked for testing of experimental featu
55
# Setting include path to the submodule temporarily to unblock testing
66
# To make it build the crt submodule needs to be in-source build before calling this so generated files are created.
77
# Removing this work around soon, working in parallel in making aws-crt-cpp consumable by normal means
8-
set(aws-crt-cpp_INCLUDE_DIRS
9-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/include
10-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-common/include
11-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-io/include
12-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-mqtt/include
13-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-cal/include
14-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-auth/include
15-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-http/include
16-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-event-stream/include
17-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-checksums/include
18-
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-common/generated/include
19-
PARENT_SCOPE
20-
)
8+
9+
set(aws-crt-cpp_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include PARENT_SCOPE)
10+
set(aws-crt-cpp_LIB_DIRS ${CMAKE_INSTALL_PREFIX}/lib PARENT_SCOPE)
11+
2112

crt/aws-crt-cpp

Submodule aws-crt-cpp deleted from 3e55d53

dependencies/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# Testing Dependencies
2-
if (BUILD_TESTING)
3-
message(STATUS "Building tests")
4-
# Testing dependency
5-
find_package(GTest 1.11 REQUIRED)
6-
include(GoogleTest) # for gtest_discover_tests()
7-
endif ()
8-
91
# Project dependencies http library (curl or OS), tinyxml2, cJSON, ssl (open or other), CRT
102
find_package(CURL REQUIRED)
113
find_package(ZLIB REQUIRED)

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
if (NOT LEGACY_BUILD)
2-
message(WARNING "Building core with new cmake scripts not yet implemented")
2+
add_library(aws-sdk-cpp-test-resources)
3+
add_library(aws-sdk-cpp::test-resources ALIAS aws-sdk-cpp-test-resources)
4+
target_link_libraries(
5+
aws-sdk-cpp-test-resources
6+
aws-sdk-cpp::core
7+
)
8+
add_subdirectory(testing-resources)
9+
10+
add_executable(
11+
aws-core-version
12+
${CMAKE_CURRENT_LIST_DIR}/VersionTests.cpp
13+
${CMAKE_CURRENT_LIST_DIR}/RunTests.cpp
14+
)
15+
target_link_libraries(
16+
aws-core-version
17+
PRIVATE GTest::GTest
18+
PRIVATE aws-sdk-cpp::core
19+
PRIVATE aws-sdk-cpp::test-resources
20+
)
21+
22+
# add_subdirectory(monitoring)
23+
message(WARNING "Not testing everything yet...")
324
else ()
425
add_project(aws-cpp-sdk-core-tests
526
"Tests for the AWS Core C++ Library"

src/aws-cpp-sdk-core-tests/VersionTests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
* SPDX-License-Identifier: Apache-2.0.
44
*/
55

6+
#ifdef NON_LEGACY_BUILD
7+
#include <gtest/gtest.h>
8+
#else
69
#include <aws/external/gtest.h>
10+
#endif
711
#include <aws/core/utils/StringUtils.h>
812
#include <aws/core/Version.h>
913

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
add_executable(
2+
aws-core-monitoring
3+
${CMAKE_CURRENT_LIST_DIR}/MonitoringEndToEndTest.cpp
4+
${CMAKE_CURRENT_LIST_DIR}/MonitoringTest.cpp
5+
)
6+
target_include_directories(
7+
aws-core-monitoring
8+
PRIVATE GTest::GTest
9+
)
10+
target_link_libraries(
11+
aws-core-monitoring
12+
PRIVATE GTest::GTest
13+
PRIVATE aws-sdk-cpp::core
14+
)

src/aws-cpp-sdk-core-tests/monitoring/MonitoringEndToEndTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
* SPDX-License-Identifier: Apache-2.0.
44
*/
55

6+
#ifdef NON_LEGACY_BUILD
7+
#include <gtest/gtest.h>
8+
#else
69
#include <aws/external/gtest.h>
10+
#endif
711
#include <aws/core/client/AWSError.h>
812
#include <aws/testing/mocks/aws/client/MockAWSClient.h>
913
#include <aws/testing/platform/PlatformTesting.h>

0 commit comments

Comments
 (0)