Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions cpp/src/arrow/filesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,13 @@ if(ARROW_S3)
get_target_property(AWS_CPP_SDK_S3_TYPE aws-cpp-sdk-s3 TYPE)
# We need to initialize AWS C++ SDK for direct use (not via
# arrow::fs::S3FileSystem) in arrow-s3fs-test if we use static AWS
# C++ SDK. Because AWS C++ SDK has internal static variables that
# aren't shared in libarrow and arrow-s3fs-test. It means that
# arrow::fs::InitializeS3() doesn't initialize AWS C++ SDK that is
# directly used in arrow-s3fs-test.
#
# But it seems that internal static variables in AWS C++ SDK are
# shared on macOS even if we link static AWS C++ SDK to both
# libarrow and arrow-s3fs-test. So we don't need to initialize AWS
# C++ SDK in arrow-s3fs-test on macOS.
if(AWS_CPP_SDK_S3_TYPE STREQUAL "STATIC_LIBRARY" AND NOT APPLE)
list(APPEND ARROW_S3FS_TEST_COMPILE_DEFINITIONS "AWS_CPP_SDK_S3_NOT_SHARED")
# C++ SDK and hide symbols of them. Because AWS C++ SDK has
# internal static variables that aren't shared in libarrow and
# arrow-s3fs-test. It means that arrow::fs::InitializeS3() doesn't
# initialize AWS C++ SDK that is directly used in arrow-s3fs-test.
if(AWS_CPP_SDK_S3_TYPE STREQUAL "STATIC_LIBRARY"
AND CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
list(APPEND ARROW_S3FS_TEST_COMPILE_DEFINITIONS "AWS_CPP_SDK_S3_PRIVATE_STATIC")
endif()
target_compile_definitions(arrow-s3fs-test
PRIVATE ${ARROW_S3FS_TEST_COMPILE_DEFINITIONS})
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/filesystem/s3fs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ShortRetryStrategy : public S3RetryStrategy {
class AwsTestMixin : public ::testing::Test {
public:
void SetUp() override {
#ifdef AWS_CPP_SDK_S3_NOT_SHARED
#ifdef AWS_CPP_SDK_S3_PRIVATE_STATIC
auto aws_log_level = Aws::Utils::Logging::LogLevel::Fatal;
aws_options_.loggingOptions.logLevel = aws_log_level;
aws_options_.loggingOptions.logger_create_fn = [&aws_log_level] {
Expand All @@ -161,13 +161,13 @@ class AwsTestMixin : public ::testing::Test {
}

void TearDown() override {
#ifdef AWS_CPP_SDK_S3_NOT_SHARED
#ifdef AWS_CPP_SDK_S3_PRIVATE_STATIC
Aws::ShutdownAPI(aws_options_);
#endif
}

private:
#ifdef AWS_CPP_SDK_S3_NOT_SHARED
#ifdef AWS_CPP_SDK_S3_PRIVATE_STATIC
Aws::SDKOptions aws_options_;
#endif
};
Expand Down