Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
Test plan:

build locally with VS 2019 Build Tools

before, broken

after, works
  • Loading branch information
ahornby committed Feb 15, 2024
1 parent 7df4349 commit dc1930e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 23 deletions.
49 changes: 32 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
BENCHMARK foreach_benchmark SOURCES ForeachBenchmark.cpp
TEST foreach_test SOURCES ForeachTest.cpp
TEST merge_test SOURCES MergeTest.cpp
BENCHMARK sparse_byte_set_benchmark SOURCES SparseByteSetBenchmark.cpp
BENCHMARK sparse_byte_set_benchmark WINDOWS_DISABLED
SOURCES SparseByteSetBenchmark.cpp
TEST sparse_byte_set_test SOURCES SparseByteSetTest.cpp
TEST util_test SOURCES UtilTest.cpp

Expand Down Expand Up @@ -667,13 +668,14 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
TEST simple_simd_string_utils_test SOURCES SimpleSimdStringUtilsTest.cpp

DIRECTORY detail/test/
TEST split_string_simd_test SOURCES SplitStringSimdTest.cpp
TEST split_string_simd_test WINDOWS_DISABLED
SOURCES SplitStringSimdTest.cpp

DIRECTORY detail/test/
TEST unroll_utils_test SOURCES UnrollUtilsTest.cpp

DIRECTORY detail/base64_detail/tests/
TEST base64_detail_test
TEST base64_detail_test WINDOWS_DISABLED
SOURCES
Base64AgainstScalarTest.cpp
Base64PlatformTest.cpp
Expand All @@ -685,10 +687,11 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
BENCHMARK edf_thread_pool_executor_benchmark
SOURCES EDFThreadPoolExecutorBenchmark.cpp
TEST executor_test SOURCES ExecutorTest.cpp
TEST fiber_io_executor_test WINDOWS_DISABLED
TEST fiber_io_executor_test
SOURCES FiberIOExecutorTest.cpp
TEST global_executor_test SOURCES GlobalExecutorTest.cpp
TEST serial_executor_test SOURCES SerialExecutorTest.cpp
TEST serial_executor_test WINDOWS_DISABLED
SOURCES SerialExecutorTest.cpp
# Fails in ThreadPoolExecutorTest.RequestContext:719 data2 != nullptr
TEST thread_pool_executor_test BROKEN WINDOWS_DISABLED
SOURCES ThreadPoolExecutorTest.cpp
Expand Down Expand Up @@ -738,7 +741,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
TEST config_update_test SOURCES ConfigUpdateTest.cpp
TEST file_handler_factory_test WINDOWS_DISABLED
SOURCES FileHandlerFactoryTest.cpp
TEST glog_formatter_test SOURCES GlogFormatterTest.cpp
TEST glog_formatter_test WINDOWS_DISABLED
SOURCES GlogFormatterTest.cpp
TEST immediate_file_writer_test SOURCES ImmediateFileWriterTest.cpp
TEST log_category_test SOURCES LogCategoryTest.cpp
TEST logger_db_test SOURCES LoggerDBTest.cpp
Expand All @@ -760,13 +764,15 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)

DIRECTORY fibers/test/
# FiberManager swapWithException fails with segfault
BENCHMARK fibers_benchmark SOURCES FibersBenchmark.cpp
BENCHMARK fibers_benchmark WINDOWS_DISABLED
SOURCES FibersBenchmark.cpp
TEST fibers_test BROKEN SOURCES FibersTest.cpp

DIRECTORY functional/test/
TEST apply_tuple_test WINDOWS_DISABLED
SOURCES ApplyTupleTest.cpp
TEST functional_invoke_test SOURCES InvokeTest.cpp
TEST functional_invoke_test WINDOWS_DISABLED
SOURCES InvokeTest.cpp
TEST partial_test SOURCES PartialTest.cpp
TEST functional_protocol_test SOURCES protocol_test.cpp
TEST functional_traits_test SOURCES traits_test.cpp
Expand Down Expand Up @@ -822,7 +828,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
TEST parallel_test SOURCES ParallelTest.cpp

DIRECTORY hash/test/
BENCHMARK checksum_benchmark SOURCES ChecksumBenchmark.cpp
BENCHMARK checksum_benchmark WINDOWS_DISABLED
SOURCES ChecksumBenchmark.cpp
TEST checksum_test SOURCES ChecksumTest.cpp
TEST farm_hash_test SOURCES FarmHashTest.cpp
BENCHMARK hash_benchmark WINDOWS_DISABLED
Expand Down Expand Up @@ -935,7 +942,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
TEST libgen-test SOURCES LibgenTest.cpp
TEST openssl_portability_test SOURCES OpenSSLPortabilityTest.cpp
TEST pthread_test SOURCES PThreadTest.cpp
TEST time-test SOURCES TimeTest.cpp
TEST time-test WINDOWS_DISABLED
SOURCES TimeTest.cpp

DIRECTORY ssl/test/
TEST openssl_hash_test SOURCES OpenSSLHashTest.cpp
Expand Down Expand Up @@ -978,7 +986,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
DIRECTORY synchronization/test/
TEST atomic_struct_test SOURCES AtomicStructTest.cpp
TEST small_locks_test SOURCES SmallLocksTest.cpp
TEST atomic_util_test SOURCES AtomicUtilTest.cpp
TEST atomic_util_test WINDOWS_DISABLED
SOURCES AtomicUtilTest.cpp

DIRECTORY test/
TEST ahm_int_stress_test SOURCES AHMIntStressTest.cpp
Expand All @@ -997,7 +1006,8 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
BENCHMARK concurrent_skip_list_benchmark
SOURCES ConcurrentSkipListBenchmark.cpp
TEST concurrent_skip_list_test SOURCES ConcurrentSkipListTest.cpp
TEST constexpr_math_test SOURCES ConstexprMathTest.cpp
TEST constexpr_math_test WINDOWS_DISABLED
SOURCES ConstexprMathTest.cpp
TEST conv_test WINDOWS_DISABLED SOURCES ConvTest.cpp
TEST cpu_id_test SOURCES CpuIdTest.cpp
TEST demangle_test SOURCES DemangleTest.cpp
Expand All @@ -1009,19 +1019,22 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
SOURCES ExceptionWrapperBenchmark.cpp
TEST exception_wrapper_test WINDOWS_DISABLED
SOURCES ExceptionWrapperTest.cpp
TEST expected_test SOURCES ExpectedTest.cpp
TEST expected_test WINDOWS_DISABLED
SOURCES ExpectedTest.cpp
BENCHMARK fbstring_benchmark WINDOWS_DISABLED
SOURCES FBStringBenchmark.cpp
HEADERS FBStringTestBenchmarks.cpp.h
TEST fbstring_test WINDOWS_DISABLED SOURCES FBStringTest.cpp
BENCHMARK fbvector_benchmark
SOURCES FBVectorBenchmark.cpp
HEADERS FBVectorBenchmarks.cpp.h
TEST fbvector_test SOURCES FBVectorTest.cpp
TEST fbvector_test WINDOWS_DISABLED
SOURCES FBVectorTest.cpp
TEST file_test SOURCES FileTest.cpp
# Open-source linux build can't handle running this.
#TEST file_lock_test SOURCES FileLockTest.cpp
TEST file_util_test SOURCES FileUtilTest.cpp
TEST file_util_test WINDOWS_DISABLED
SOURCES FileUtilTest.cpp
BENCHMARK fingerprint_benchmark SOURCES FingerprintBenchmark.cpp
TEST fingerprint_test SOURCES FingerprintTest.cpp
TEST fixed_string_test SOURCES FixedStringTest.cpp
Expand Down Expand Up @@ -1060,11 +1073,13 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS)
TEST optional_test SOURCES OptionalTest.cpp
TEST packed_sync_ptr_test HANGING
SOURCES PackedSyncPtrTest.cpp
TEST padded_test SOURCES PaddedTest.cpp
TEST padded_test WINDOWS_DISABLED
SOURCES PaddedTest.cpp
#TEST poly_test SOURCES PolyTest.cpp
TEST portability_test SOURCES PortabilityTest.cpp
# Turns out this benchmark uses Linux only API for setting CPU affinity i.e. cpu_set_t.
BENCHMARK producer_consumer_queue_benchmark APPLE_DISABLED SOURCES ProducerConsumerQueueBenchmark.cpp
BENCHMARK producer_consumer_queue_benchmark APPLE_DISABLED WINDOWS_DISABLED
SOURCES ProducerConsumerQueueBenchmark.cpp
TEST producer_consumer_queue_test SLOW
SOURCES ProducerConsumerQueueTest.cpp
BENCHMARK range_find_benchmark SOURCES RangeFindBenchmark.cpp
Expand Down
1 change: 1 addition & 0 deletions folly/container/detail/BitIteratorDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <type_traits>

#include <boost/iterator/iterator_adaptor.hpp>
#include <folly/portability/SysTypes.h>

#include <folly/portability/SysTypes.h>

Expand Down
8 changes: 4 additions & 4 deletions folly/io/async/test/TestSSLServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ TestSSLServer::~TestSSLServer() {
/* static */ std::unique_ptr<SSLContext> TestSSLServer::getDefaultSSLContext() {
// Set up a default SSL context
std::unique_ptr<SSLContext> sslContext = std::make_unique<SSLContext>();
sslContext->loadCertificate(find_resource(kTestCert).c_str());
sslContext->loadPrivateKey(find_resource(kTestKey).c_str());
sslContext->loadCertificate(find_resource(kTestCert).string().c_str());
sslContext->loadPrivateKey(find_resource(kTestKey).string().c_str());
sslContext->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
// By default, SSLContext disables OpenSSL's internal session cache.
// Enable it here on the server for testing session reuse.
Expand All @@ -64,8 +64,8 @@ TestSSLServer::TestSSLServer(SSLServerAcceptCallbackBase* acb, bool enableTFO)
}

void TestSSLServer::loadTestCerts() {
ctx_->loadCertificate(find_resource(kTestCert).c_str());
ctx_->loadPrivateKey(find_resource(kTestKey).c_str());
ctx_->loadCertificate(find_resource(kTestCert).string().c_str());
ctx_->loadPrivateKey(find_resource(kTestKey).string().c_str());
}

TestSSLServer::TestSSLServer(
Expand Down
4 changes: 2 additions & 2 deletions folly/test/base64_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ namespace {
template <std::size_t N>
constexpr auto base64EncodeArray(const std::array<char, N>& in) {
std::array<char, folly::base64EncodedSize(N) + 1> res{};
folly::base64Encode(in.begin(), in.end(), res.data());
folly::base64Encode(in.data(), in.data() + in.size(), res.data());
res.back() = 0;
return res;
}

template <std::size_t N>
constexpr auto base64URLEncodeArray(const std::array<char, N>& in) {
std::array<char, folly::base64URLEncodedSize(N) + 1> res{};
folly::base64URLEncode(in.begin(), in.end(), res.data());
folly::base64URLEncode(in.data(), in.data() + in.size(), res.data());
res.back() = 0;
return res;
}
Expand Down

0 comments on commit dc1930e

Please sign in to comment.