Skip to content

Commit

Permalink
chore: Update vcpkg to c4467cb686f92671f0172aa8299a77d908175b4e
Browse files Browse the repository at this point in the history
  • Loading branch information
Tradias committed Jun 22, 2024
1 parent 2a969e3 commit 73c16bf
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- 'CMakePresets.json'

env:
VCPKG_VERSION: '59aeb8fe8fe1c980de6bd5ba634cf21024522d81'
VCPKG_VERSION: 'c4467cb686f92671f0172aa8299a77d908175b4e'
CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=Release -DVCPKG_MANIFEST_INSTALL=off -DASIO_GRPC_ENABLE_PKGCONFIG_FALLBACK=off -DCMAKE_COMPILE_WARNING_AS_ERROR=on -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=on'
CTEST_ARGS: '-T test --output-on-failure --timeout 180 --no-tests=error --parallel 25'

Expand Down
5 changes: 2 additions & 3 deletions src/agrpc/detail/basic_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <agrpc/detail/forward.hpp>
#include <agrpc/detail/operation_implementation.hpp>
#include <agrpc/detail/operation_initiation.hpp>
#include <agrpc/detail/receiver.hpp>
#include <agrpc/detail/sender_implementation.hpp>
#include <agrpc/detail/sender_of.hpp>
#include <agrpc/detail/stop_callback_lifetime.hpp>
Expand Down Expand Up @@ -200,10 +199,10 @@ class BasicSenderRunningOperation : public detail::BaseForSenderImplementationTy
}

template <AllocationType, class... Args>
void complete(const agrpc::GrpcContext&, Args... args)
void complete(const agrpc::GrpcContext&, Args... args) noexcept
{
reset_stop_callback();
detail::satisfy_receiver(static_cast<Receiver&&>(receiver()), static_cast<Args&&>(args)...);
exec::set_value(static_cast<Receiver&&>(receiver()), static_cast<Args&&>(args)...);
}

void done() noexcept
Expand Down
11 changes: 6 additions & 5 deletions src/agrpc/detail/execution_asio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ template <class Sender>
inline constexpr bool is_sender_v = true;

template <class Sender, class Receiver>
auto connect(Sender&& sender, Receiver&& receiver)
auto connect(Sender&& sender, Receiver&& receiver) noexcept(
noexcept(static_cast<Sender&&>(sender).connect(static_cast<Receiver&&>(receiver))))
{
return static_cast<Sender&&>(sender).connect(static_cast<Receiver&&>(receiver));
}
Expand All @@ -62,25 +63,25 @@ template <class Sender, class Receiver>
using connect_result_t = decltype(exec::connect(std::declval<Sender>(), std::declval<Receiver>()));

template <class Receiver>
void set_done(Receiver&& receiver)
void set_done(Receiver&& receiver) noexcept
{
static_cast<Receiver&&>(receiver).set_done();
}

template <class Receiver, class... T>
void set_error(Receiver&& receiver, T&&... t)
void set_error(Receiver&& receiver, T&&... t) noexcept
{
static_cast<Receiver&&>(receiver).set_error(static_cast<T&&>(t)...);
}

template <class Receiver, class... T>
void set_value(Receiver&& receiver, T&&... t)
void set_value(Receiver&& receiver, T&&... t) noexcept
{
static_cast<Receiver&&>(receiver).set_value(static_cast<T&&>(t)...);
}

template <class OperationState>
void start(OperationState&& state)
void start(OperationState&& state) noexcept
{
static_cast<OperationState&&>(state).start();
}
Expand Down
5 changes: 2 additions & 3 deletions src/agrpc/detail/manual_reset_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <agrpc/detail/association.hpp>
#include <agrpc/detail/execution.hpp>
#include <agrpc/detail/forward.hpp>
#include <agrpc/detail/receiver.hpp>
#include <agrpc/detail/sender_of.hpp>
#include <agrpc/detail/stop_callback_lifetime.hpp>
#include <agrpc/detail/tuple.hpp>
Expand Down Expand Up @@ -247,12 +246,12 @@ struct ManualResetEventRunningOperationState<void(Args...), Receiver> : ManualRe
this->event_.op_.store(this, std::memory_order_release);
}

void complete()
void complete() noexcept
{
detail::apply(
[&](Args&&... args)
{
detail::satisfy_receiver(static_cast<Receiver&&>(receiver()), static_cast<Args&&>(args)...);
exec::set_value(static_cast<Receiver&&>(receiver()), static_cast<Args&&>(args)...);
},
static_cast<Event&&>(this->event_).args());
}
Expand Down
45 changes: 0 additions & 45 deletions src/agrpc/detail/receiver.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/agrpc/detail/submit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct SubmitToFunctionReceiver
void set_done() noexcept { complete(); }

template <class... Args>
void set_value(Args&&... args)
void set_value(Args&&... args) noexcept
{
complete(static_cast<Args&&>(args)...);
}
Expand Down
2 changes: 1 addition & 1 deletion test/cmake/subdirectory/src/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
"gtest",
"stdexec"
],
"builtin-baseline": "59aeb8fe8fe1c980de6bd5ba634cf21024522d81"
"builtin-baseline": "c4467cb686f92671f0172aa8299a77d908175b4e"
}
2 changes: 1 addition & 1 deletion test/cmake/superbuild/src/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
"gtest",
"stdexec"
],
"builtin-baseline": "59aeb8fe8fe1c980de6bd5ba634cf21024522d81"
"builtin-baseline": "c4467cb686f92671f0172aa8299a77d908175b4e"
}
9 changes: 5 additions & 4 deletions test/src/test_asio_grpc_17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,20 @@ TEST_CASE("constexpr algorithm: replace_sequence_with_value")
CHECK_EQ("find this x in the haystack", result);
}

TEST_CASE_FIXTURE(test::GrpcClientServerTest, " agrpc::notify_on_state_change")
TEST_CASE_FIXTURE(test::GrpcClientServerTest, "agrpc::notify_on_state_change")
{
bool actual_ok{false};
bool expected_ok{true};
auto deadline = test::five_seconds_from_now();
SUBCASE("success") {}
grpc_connectivity_state state{};
SUBCASE("success") { state = channel->GetState(true); }
SUBCASE("deadline expires")
{
actual_ok = true;
expected_ok = false;
deadline = test::now() - std::chrono::seconds(5);
deadline = test::now();
state = channel->GetState(false);
}
const auto state = channel->GetState(true);
const auto callback = [&](bool ok)
{
actual_ok = ok;
Expand Down
34 changes: 28 additions & 6 deletions test/src/test_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ TEST_CASE_FIXTURE(test::ExecutionGrpcContextTest,
CHECK_EQ(expected_thread_id, actual_thread_id);
}

#if !UNIFEX_NO_COROUTINES
TEST_CASE_TEMPLATE("ScheduleSender start with shutdown GrpcContext", T, std::true_type, std::false_type)
{
test::DeleteGuard del;
Expand Down Expand Up @@ -174,7 +173,6 @@ TEST_CASE_TEMPLATE("ScheduleSender start with shutdown GrpcContext", T, std::tru
CHECK(state.was_done);
CHECK_FALSE(state.exception);
}
#endif

TEST_CASE_FIXTURE(test::ExecutionGrpcContextTest, "stdexec agrpc::Alarm.wait from different thread")
{
Expand Down Expand Up @@ -223,8 +221,33 @@ TEST_CASE_FIXTURE(test::GrpcClientServerTest, "RegisterSenderRPCHandlerSender fu
CHECK(std::is_invocable_v<decltype(stdexec::start), OperationState&>);
}

#if !UNIFEX_NO_COROUTINES
TEST_CASE_FIXTURE(test::ExecutionClientRPCTest<test::UnaryClientRPC>, "stdexec UnaryClientRPC coroutine success")
template <class RPC>
struct StdexecExecutionClientRPCTest : test::ExecutionTestMixin<test::ClientServerRPCTest<RPC>>
{
using Base = test::ClientServerRPCTest<RPC>;

template <class RPCHandler, class... ClientFunctions>
void register_and_perform_requests(RPCHandler&& handler, ClientFunctions&&... client_functions)
{
int counter{};
this->run(
agrpc::register_sender_rpc_handler<typename Base::ServerRPC>(this->grpc_context, this->service, handler),
stdexec::on(this->get_executor(),
[&counter, &client_functions, &server_shutdown = this->server_shutdown]() -> exec::task<void>
{
typename Base::ClientRPC::Request request;
typename Base::ClientRPC::Response response;
co_await client_functions(request, response);
++counter;
if (counter == sizeof...(client_functions))
{
server_shutdown.initiate();
}
}())...);
}
};

TEST_CASE_FIXTURE(StdexecExecutionClientRPCTest<test::UnaryClientRPC>, "stdexec UnaryClientRPC coroutine success")
{
auto client_func = [&](Request& request, Response& response) -> exec::task<void>
{
Expand All @@ -248,7 +271,7 @@ TEST_CASE_FIXTURE(test::ExecutionClientRPCTest<test::UnaryClientRPC>, "stdexec U
client_func, client_func, client_func);
}

TEST_CASE_FIXTURE(test::ExecutionClientRPCTest<test::BidirectionalStreamingClientRPC>,
TEST_CASE_FIXTURE(StdexecExecutionClientRPCTest<test::BidirectionalStreamingClientRPC>,
"stdexec BidirectionalStreamingClientRPC coroutine success")
{
auto client_func = [&](Request& request, Response& response) -> exec::task<void>
Expand Down Expand Up @@ -278,7 +301,6 @@ TEST_CASE_FIXTURE(test::ExecutionClientRPCTest<test::BidirectionalStreamingClien
},
client_func, client_func, client_func);
}
#endif

TEST_CASE_FIXTURE(test::ExecutionRpcHandlerTest, "stdexec rpc_handler unary - shutdown server")
{
Expand Down
47 changes: 45 additions & 2 deletions test/src/test_grpc_context_17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ struct GrpcContextAndIoContextTest : test::GrpcContextTest, test::IoContextTest
TEST_CASE_FIXTURE(GrpcContextAndIoContextTest, "GrpcContext.poll() with asio::post")
{
bool invoked{false};
asio::steady_timer timer{io_context};
asio::post(io_context,
[&]()
{
Expand All @@ -440,8 +441,13 @@ TEST_CASE_FIXTURE(GrpcContextAndIoContextTest, "GrpcContext.poll() with asio::po
{
invoked = true;
});
CHECK_FALSE(invoked);
CHECK(grpc_context.poll());
timer.expires_after(std::chrono::milliseconds(100));
timer.async_wait(
[&](auto&&)
{
CHECK_FALSE(invoked);
CHECK(grpc_context.poll());
});
});
io_context.run();
CHECK(invoked);
Expand Down Expand Up @@ -532,6 +538,43 @@ TEST_CASE_FIXTURE(test::GrpcContextTest, "GrpcContext.run_completion_queue()")
CHECK_FALSE(grpc_context.run_completion_queue());
}

inline void wait_some(agrpc::GrpcContext& grpc_context)
{
agrpc::Alarm{grpc_context}.wait(test::now(),
[&](auto&&...)
{
wait_some(grpc_context);
});
}

TEST_CASE_FIXTURE(test::GrpcContextTest, "GrpcContext.run_completion_queue() parallel")
{
asio::thread_pool pool{3};
for (size_t i{}; i != 3; ++i)
{
asio::post(pool,
[&]
{
wait_some(grpc_context);
});
}
for (size_t i{}; i != 2; ++i)
{
asio::post(pool,
[&]
{
grpc_context.run_completion_queue();
});
}
asio::steady_timer timer{pool, std::chrono::seconds(1)};
timer.async_wait(
[&](auto&&...)
{
grpc_context.stop();
});
pool.wait();
}

TEST_CASE_FIXTURE(test::GrpcContextTest, "GrpcContext.poll() within run()")
{
int count{};
Expand Down
1 change: 1 addition & 0 deletions test/src/test_run_17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ TEST_CASE_FIXTURE(RunTest, "agrpc::run Traits can specify zero max latency")
{
invoked = true;
});
std::this_thread::sleep_until(test::hundred_milliseconds_from_now());
agrpc::run<MyIntrusiveTraits>(grpc_context, io_context,
[count = 0]() mutable
{
Expand Down
2 changes: 1 addition & 1 deletion test/utils/utils/asio_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct FunctionAsReceiver
static void set_done() noexcept {}

template <class... Args>
void set_value(Args&&... args) const
void set_value(Args&&... args) const noexcept
{
function(std::forward<Args>(args)...);
}
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
"gtest",
"stdexec"
],
"builtin-baseline": "59aeb8fe8fe1c980de6bd5ba634cf21024522d81"
"builtin-baseline": "c4467cb686f92671f0172aa8299a77d908175b4e"
}

0 comments on commit 73c16bf

Please sign in to comment.