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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-latest-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
build-and-test:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
timeout-minutes: 30

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-liburing-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
build-and-test:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
timeout-minutes: 15

strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
build-and-test:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
timeout-minutes: 15

strategy:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
timeout-minutes: 15

steps:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:

deploy:
needs: build
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
static-check:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
timeout-minutes: 10

steps:
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# False positive with GCC
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109224
add_compile_options(-Wno-mismatched-new-delete)
# False positive with GCC: coroutine frame variables (e.g.
# structured bindings from co_await) are reported as maybe-uninitialized
add_compile_options(-Wno-maybe-uninitialized)
endif()

if(BUILD_EXAMPLES)
Expand Down
7 changes: 5 additions & 2 deletions include/condy/detail/singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ namespace detail {

template <typename T> class ThreadLocalSingleton {
public:
ThreadLocalSingleton() = default;

CONDY_DELETE_COPY_MOVE(ThreadLocalSingleton);

static T &current() noexcept {
static thread_local T instance;
return instance;
}

private:
ThreadLocalSingleton() = default;

friend T;
};

} // namespace detail
Expand Down
4 changes: 2 additions & 2 deletions include/condy/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class [[nodiscard]] Task : public detail::TaskBase<T, Allocator> {
};

template <typename Allocator>
class [[nodiscard]] Task<void, Allocator>
: public detail::TaskBase<void, Allocator> {
class [[nodiscard]]
Task<void, Allocator> : public detail::TaskBase<void, Allocator> {
public:
using Base = detail::TaskBase<void, Allocator>;
using Base::Base;
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ while getopts "h" opt; do
esac
done

run-clang-tidy -p build/ '^.*(benchmarks|examples|tests)/.*\.(hpp|cpp)$'
run-clang-tidy -p build/ -header-filter='include/condy/.*' '^.*(benchmarks|examples|tests)/.*\.(hpp|cpp)$'
7 changes: 7 additions & 0 deletions scripts/vm-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,16 @@ if [ "$QUIET_MODE" = true ]; then
KERNEL_ARGS="$KERNEL_ARGS quiet"
fi

# Use the maximum CPU feature set available to QEMU.
CPU_MODEL="max"
if [ "$KVM_ENABLED" = true ]; then
CPU_MODEL="host"
fi

# Run the VM,
qemu-system-x86_64 \
$KVM_FLAG \
-cpu "$CPU_MODEL" \
-smp 4 \
-m 512M \
-kernel "$KERNEL_IMAGE" \
Expand Down
6 changes: 3 additions & 3 deletions tests/test_async_operations.1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TEST_CASE("test async_operations - recvmsg multishot") {
};

auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
msg_hdr.msg_iov = nullptr;
msg_hdr.msg_iovlen = 0;

Expand Down Expand Up @@ -1162,7 +1162,7 @@ TEST_CASE("test async_operations - test recvmsg - basic") {
ssize_t r = write(sv[1], msg.data(), msg.size());
REQUIRE(r == msg.size());
auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
char buf_storage[1024];
iovec iov{
.iov_base = buf_storage,
Expand Down Expand Up @@ -1195,7 +1195,7 @@ TEST_CASE("test async_operations - test recvmsg - multishot") {
close(sv[1]);

auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
size_t count = 0;
std::string actual;

Expand Down
20 changes: 10 additions & 10 deletions tests/test_async_operations.2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST_CASE("test async_operations - test sendmsg - basic") {

auto msg = generate_data(1024);
auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
iovec iov{
.iov_base = const_cast<char *>(msg.data()),
.iov_len = msg.size(),
Expand Down Expand Up @@ -58,7 +58,7 @@ TEST_CASE("test async_operations - test sendmsg - zero copy") {

auto msg = generate_data(1024);
auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
iovec iov{
.iov_base = const_cast<char *>(msg.data()),
.iov_len = msg.size(),
Expand Down Expand Up @@ -90,7 +90,7 @@ TEST_CASE("test async_operations - test sendmsg - zero copy fixed buffer") {

auto msg = generate_data(1024);
auto func = [&]() -> condy::Coro<void> {
struct msghdr msg_hdr {};
struct msghdr msg_hdr{};
iovec iov{
.iov_base = msg.data(),
.iov_len = msg.size(),
Expand Down Expand Up @@ -221,7 +221,7 @@ TEST_CASE("test async_operations - test accept - basic") {
auto main = [&]() -> condy::Coro<void> {
std::jthread client_thread(client);

struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);
for (int i = 0; i < 4; i++) {
int conn_fd = co_await condy::async_accept(
Expand Down Expand Up @@ -265,7 +265,7 @@ TEST_CASE("test async_operations - test accept - direct") {

condy::current_runtime().fd_table().init(2);

struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);
int fd1 = co_await condy::async_accept_direct(
listen_fd, (sockaddr *)&addr, &addrlen, 0, CONDY_FILE_INDEX_ALLOC);
Expand Down Expand Up @@ -317,7 +317,7 @@ TEST_CASE("test async_operations - test accept - multishot") {
std::jthread client_thread(client);

size_t count = 0;
struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);

condy::Channel<std::monostate> done_channel(1);
Expand Down Expand Up @@ -369,7 +369,7 @@ TEST_CASE("test async_operations - test accept - multishot direct") {
fd_table.init(4);

size_t count = 0;
struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);

condy::Channel<std::monostate> done_channel(1);
Expand Down Expand Up @@ -554,7 +554,7 @@ TEST_CASE("test async_operations - test fallocate - basic") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = fstat(fd, &st);
REQUIRE(r == 0);
REQUIRE(st.st_size == 1024 * 1024);
Expand All @@ -581,7 +581,7 @@ TEST_CASE("test async_operations - test fallocate - fixed fd") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = fstat(fd, &st);
REQUIRE(r == 0);
REQUIRE(st.st_size == 1024 * 1024);
Expand Down Expand Up @@ -944,7 +944,7 @@ TEST_CASE("test async_operations - test statx") {
auto d = condy::detail::defer([&] { unlink(name); });

auto func = [&]() -> condy::Coro<void> {
struct statx stx {};
struct statx stx{};
int r =
co_await condy::async_statx(AT_FDCWD, name, 0, STATX_SIZE, &stx);
REQUIRE(r == 0);
Expand Down
14 changes: 7 additions & 7 deletions tests/test_async_operations.3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ TEST_CASE("test async_operations - test recv - bundled multishot") {
close(sv[1]);

auto [n2, bufs2] = co_await condy::async_recv_multishot(
sv[0], condy::bundled(pool), 0, [&](auto) {
sv[0], condy::bundled(pool), 0, [&](const auto &) {
REQUIRE(false); // Should not be called
});
REQUIRE(n2 == 512);
Expand Down Expand Up @@ -831,7 +831,7 @@ TEST_CASE("test async_operations - test openat2 - basic") {
auto d = condy::detail::defer([&] { unlink(name); });

auto func = [&]() -> condy::Coro<void> {
struct open_how how {};
struct open_how how{};
how.flags = O_RDONLY;
how.mode = 0;

Expand All @@ -853,7 +853,7 @@ TEST_CASE("test async_operations - test openat2 - direct") {
auto &fd_table = condy::current_runtime().fd_table();
fd_table.init(1);

struct open_how how {};
struct open_how how{};
how.flags = O_RDONLY;
how.mode = 0;

Expand Down Expand Up @@ -915,7 +915,7 @@ TEST_CASE("test async_operations - test unlinkat") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == -1);
REQUIRE(errno == ENOENT);
Expand All @@ -933,7 +933,7 @@ TEST_CASE("test async_operations - test unlink") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == -1);
REQUIRE(errno == ENOENT);
Expand All @@ -959,7 +959,7 @@ TEST_CASE("test async_operations - test renameat") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(old_name, &st);
REQUIRE(r == -1);
REQUIRE(errno == ENOENT);
Expand Down Expand Up @@ -987,7 +987,7 @@ TEST_CASE("test async_operations - test rename") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(old_name, &st);
REQUIRE(r == -1);
REQUIRE(errno == ENOENT);
Expand Down
18 changes: 8 additions & 10 deletions tests/test_async_operations.4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_CASE("test async_operations - test mkdirat") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == 0);
REQUIRE(S_ISDIR(st.st_mode));
Expand All @@ -53,7 +53,7 @@ TEST_CASE("test async_operations - test mkdir") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == 0);
REQUIRE(S_ISDIR(st.st_mode));
Expand Down Expand Up @@ -126,8 +126,7 @@ TEST_CASE("test async_operations - test linkat") {
};
condy::sync_wait(func());

struct stat st1 {
}, st2{};
struct stat st1{}, st2{};
int r = stat(target_name, &st1);
REQUIRE(r == 0);
r = stat(link_name, &st2);
Expand All @@ -152,8 +151,7 @@ TEST_CASE("test async_operations - test link") {
};
condy::sync_wait(func());

struct stat st1 {
}, st2{};
struct stat st1{}, st2{};
int r = stat(target_name, &st1);
REQUIRE(r == 0);
r = stat(link_name, &st2);
Expand Down Expand Up @@ -624,7 +622,7 @@ TEST_CASE("test async_operations - test cmd_getsockname - basic") {
int listen_fd = create_accept_socket();

auto func = [&]() -> condy::Coro<void> {
struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);
int r = co_await condy::async_cmd_getsockname(
listen_fd, (struct sockaddr *)&addr, &addrlen, 0);
Expand All @@ -648,7 +646,7 @@ TEST_CASE("test async_operations - test cmd_getsockname - fixed fd") {
int r = co_await condy::async_files_update(&listen_fd, 1, 0);
REQUIRE(r == 1);

struct sockaddr_in addr {};
struct sockaddr_in addr{};
socklen_t addrlen = sizeof(addr);
r = co_await condy::async_cmd_getsockname(
condy::fixed(0), (struct sockaddr *)&addr, &addrlen, 0);
Expand Down Expand Up @@ -794,7 +792,7 @@ TEST_CASE("test async_operations - test ftruncate - basic") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == 0);
REQUIRE(st.st_size == 4096);
Expand All @@ -819,7 +817,7 @@ TEST_CASE("test async_operations - test ftruncate - fixed fd") {
};
condy::sync_wait(func());

struct stat st {};
struct stat st{};
int r = stat(name, &st);
REQUIRE(r == 0);
REQUIRE(st.st_size == 4096);
Expand Down
2 changes: 1 addition & 1 deletion tests/test_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ TEST_CASE("test buffers - provided buffer pool external memory") {

void *ext_mem = mmap(nullptr, total, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
REQUIRE(ext_mem != MAP_FAILED);
// REQUIRE(ext_mem != MAP_FAILED);

{
condy::ProvidedBufferPool pool(ext_mem, num_bufs, buf_size);
Expand Down
2 changes: 1 addition & 1 deletion third_party/doctest
Submodule doctest updated 286 files
Loading