Skip to content

Commit

Permalink
Misc OpenSSL 3.x fixes (#5650)
Browse files Browse the repository at this point in the history
  • Loading branch information
jumaffre authored Sep 14, 2023
1 parent dbb38e5 commit 4d74c1d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .daily_canary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-^- ___ ___
(- -) (= =) | Y & +--???
( V ) / . \ O +---=---'
/--x-m- /--n-n---xXx--/--yY--------
(- -) (= =) | Y & +--?
( V ) / . \ | +---=---'
/--x-m- /--n-n---xXx--/--yY------
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -949,13 +949,13 @@ if(BUILD_TESTS)
target_link_libraries(
historical_queries_test PRIVATE http_parser.host sss.host ccf_kv.host
)

# Temporarily disabled flaky test
# https://github.com/microsoft/CCF/issues/4403 add_unit_test( indexing_test
# ${CMAKE_CURRENT_SOURCE_DIR}/src/indexing/test/indexing.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/indexing/test/lfs.cpp )
# target_link_libraries( indexing_test PRIVATE ccf_endpoints.host sss.host
# ccf_kv.host )
# ccf_kv.host ) target_link_libraries( indexing_test PRIVATE
# ccf_endpoints.host sss.host ccf_kv.host )

add_unit_test(
snapshot_test ${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/snapshot.cpp
Expand Down
3 changes: 3 additions & 0 deletions src/apps/tpcc/clients/tpcc_client.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#include "../tpcc_serializer.h"
#include "crypto/openssl/hash.h"
#include "perf_client.h"

using namespace std;
Expand Down Expand Up @@ -156,13 +157,15 @@ int main(int argc, char** argv)
{
logger::config::default_init();
logger::config::level() = LoggerLevel::INFO;
crypto::openssl_sha256_init();

CLI::App cli_app{"Tpcc Client"};
TpccClientOptions options(cli_app, argv[0]);
CLI11_PARSE(cli_app, argc, argv);

TpccClient client(options);
client.run();
crypto::openssl_sha256_shutdown();

return 0;
}
16 changes: 7 additions & 9 deletions src/apps/tpcc/tpcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ sign_app_library(
add_unit_test(tpcc_test ${CMAKE_CURRENT_LIST_DIR}/app/test/tpcc.cpp)

if(BUILD_TESTS)
foreach(CONSENSUS ${CONSENSUSES})
set(TPCC_ITERATIONS 50000)
set(TPCC_ITERATIONS 50000)

add_perf_test(
NAME tpcc
PYTHON_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/tests/tpcc.py
CLIENT_BIN ./tpcc_client
ADDITIONAL_ARGS --transactions ${TPCC_ITERATIONS} --max-writes-ahead 250
)
endforeach()
add_perf_test(
NAME tpcc
PYTHON_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/tests/tpcc.py
CLIENT_BIN ./tpcc_client
ADDITIONAL_ARGS --transactions ${TPCC_ITERATIONS} --max-writes-ahead 250
)
endif()
26 changes: 25 additions & 1 deletion src/indexing/test/indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ccf/indexing/strategies/seqnos_by_key_in_memory.h"
#include "consensus/aft/raft.h"
#include "consensus/aft/test/logging_stub.h"
#include "crypto/openssl/hash.h"
#include "ds/test/stub_writer.h"
#include "host/lfs_file_handler.h"
#include "indexing/enclave_lfs_access.h"
Expand All @@ -13,7 +14,7 @@
#include "node/share_manager.h"

#include <thread>
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_IMPLEMENT
#include <doctest/doctest.h>

// Transitively see a header that tries to use ThreadMessaging, so need to
Expand Down Expand Up @@ -509,6 +510,7 @@ TEST_CASE(
std::atomic<size_t> writes_to_42 = 0;

auto tx_advancer = [&]() {
crypto::openssl_sha256_init();
size_t i = 0;
while (i < 1'000)
{
Expand All @@ -530,6 +532,7 @@ TEST_CASE(
++i;
std::this_thread::yield();
}
crypto::openssl_sha256_shutdown();
finished = true;
};

Expand Down Expand Up @@ -569,6 +572,7 @@ TEST_CASE(
std::atomic<bool> work_done = false;

std::thread index_ticker([&]() {
crypto::openssl_sha256_init();
while (!work_done)
{
size_t post_work_done_loops = 0;
Expand Down Expand Up @@ -621,6 +625,7 @@ TEST_CASE(
std::this_thread::yield();
}
}
crypto::openssl_sha256_shutdown();
});

std::vector<std::thread> threads;
Expand Down Expand Up @@ -793,6 +798,7 @@ TEST_CASE(
std::atomic<size_t> writes_to_42 = 0;

auto tx_advancer = [&]() {
crypto::openssl_sha256_init();
size_t i = 0;
constexpr auto tx_count =
#if NDEBUG
Expand Down Expand Up @@ -822,10 +828,12 @@ TEST_CASE(
std::this_thread::yield();
}
all_submitted = true;
crypto::openssl_sha256_shutdown();
};

auto get_all =
[&](const std::string& key) -> std::optional<ccf::SeqNoCollection> {
crypto::openssl_sha256_init();
const auto max_range = index_a->max_requestable_range();
auto range_start = 0;

Expand Down Expand Up @@ -857,13 +865,15 @@ TEST_CASE(

if (range_end == end_seqno)
{
crypto::openssl_sha256_shutdown();
return all_results;
}
else
{
range_start = range_end + 1;
}
}
crypto::openssl_sha256_shutdown();
};

auto fetch_index_a = [&]() {
Expand Down Expand Up @@ -920,13 +930,15 @@ TEST_CASE(
});

std::thread index_ticker([&]() {
crypto::openssl_sha256_init();
while (!work_done)
{
while (indexer.update_strategies(step_time, kv_store.current_txid()))
{
std::this_thread::yield();
}
}
crypto::openssl_sha256_shutdown();
});

std::thread watchdog([&]() {
Expand All @@ -951,3 +963,15 @@ TEST_CASE(
index_ticker.join();
watchdog.join();
}

int main(int argc, char** argv)
{
crypto::openssl_sha256_init();
doctest::Context context;
context.applyCommandLine(argc, argv);
int res = context.run();
crypto::openssl_sha256_shutdown();
if (context.shouldExit())
return res;
return res;
}

0 comments on commit 4d74c1d

Please sign in to comment.