Skip to content

Commit fe0a9df

Browse files
committed
fixup! add tests
1 parent 2615807 commit fe0a9df

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tests/test_shm.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ struct MockSession {
2121
bool &handle_called;
2222
int &received_fd;
2323
int32_t result;
24-
bool &should_throw;
24+
std::atomic<bool> &should_throw;
2525

2626
ex::task<int32_t> handle(int memfd, ex::counting_scope &) noexcept {
2727
handle_called = true;
2828
received_fd = memfd;
2929
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch)
30-
if (should_throw) {
30+
if (should_throw.load()) {
3131
throw std::system_error(EIO, std::generic_category());
3232
}
3333
co_return result;
@@ -61,7 +61,7 @@ TEST_CASE("test shm") {
6161
bool handle_called = false;
6262
int received_fd = -1;
6363
int32_t expected_result = 42;
64-
bool should_throw = false;
64+
std::atomic<bool> should_throw{false};
6565
MockSession session{handle_called, received_fd, expected_result,
6666
should_throw};
6767

@@ -93,7 +93,7 @@ TEST_CASE("test shm") {
9393

9494
SUBCASE("session handle throws error") {
9595
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
96-
should_throw = true;
96+
should_throw.store(true);
9797
int client_fd = connect_to_server(sock_path);
9898
auto d = ublk::detail::defer([&]() noexcept { close(client_fd); });
9999

0 commit comments

Comments
 (0)