From fef5ebb81916da505417c1095469b30dc165d093 Mon Sep 17 00:00:00 2001 From: Marco Edoardo Santimaria Date: Sat, 27 Sep 2025 11:44:55 +0200 Subject: [PATCH 1/6] Dropped support for C++17 This commit updates the version to C++20 and updates the CI/CD to Ubuntu 24.04. It also updates the CI/CD action jidicula/clang-format-action to 4.15.0 --- .github/workflows/ci-tests.yaml | 15 +++++++-------- CMakeLists.txt | 2 +- README.md | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index b06f95e46..abcfd2581 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -12,14 +12,14 @@ concurrency: jobs: codespell-check: name: "Check codespell conformance" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: "Run codespell" uses: codespell-project/actions-codespell@v2 docker-check: name: "Check Docker image" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: cmake-build-type: @@ -84,7 +84,7 @@ jobs: format-check: name: "Check ${{ matrix.path }} clang-format conformance" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: path: @@ -93,20 +93,19 @@ jobs: steps: - uses: actions/checkout@v4 - name: "Run clang-format style check" - uses: jidicula/clang-format-action@v4.11.0 + uses: jidicula/clang-format-action@v4.15.0 with: - clang-format-version: "16" + clang-format-version: "20" check-path: "${{ matrix.path }}" unit-tests: name: "Build ${{ matrix.build_type }} with ${{ matrix.cxx }}" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: build_type: - Debug - Release cxx: - - g++-9 - g++-10 - g++-11 - g++-12 @@ -219,7 +218,7 @@ jobs: upload-to-codecov: name: "Codecov report upload" needs: [ "unit-tests" , "codespell-check" , "format-check" ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: "Download artifacts" diff --git a/CMakeLists.txt b/CMakeLists.txt index 4197b3718..ebcee4891 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ project(capio ) # Set required C++ standard -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) # Generate the compile_commands.json file diff --git a/README.md b/README.md index 95d9dbea1..a396ca6d6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ python and bash. CAPIO depends on the following software that needs to be manually installed: - `cmake >=3.15` -- `c++17` or newer +- `c++20` or newer - `openmpi` - `pthreads` From 54fdea9d95804360538b29fb5f9f5bd7769c66b0 Mon Sep 17 00:00:00 2001 From: Marco Edoardo Santimaria Date: Sat, 27 Sep 2025 11:57:27 +0200 Subject: [PATCH 2/6] Update CI/CD targeted compilers --- .github/workflows/ci-tests.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index abcfd2581..6b3ce4953 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -110,12 +110,13 @@ jobs: - g++-11 - g++-12 - g++-13 - - clang-13 - - clang-14 - - clang-15 - - clang-16 + - g++-14 + - g++-15 - clang-17 - clang-18 + - clang-19 + - clang-20 + - clang-21 steps: - uses: actions/checkout@v4 - name: "Install packages" From b299a7973241d9acb04489f65fd8899f52eb466a Mon Sep 17 00:00:00 2001 From: Marco Edoardo Santimaria Date: Sat, 27 Sep 2025 11:57:38 +0200 Subject: [PATCH 3/6] CLANG formatted code --- src/common/capio/filesystem.hpp | 2 +- src/common/capio/shm.hpp | 4 ++-- src/posix/handlers/stat.hpp | 4 +--- src/server/remote/backend/mpi.hpp | 4 ++-- src/server/utils/filesystem.hpp | 2 +- tests/integration/src/main.cpp | 2 +- tests/unit/syscall/src/main.cpp | 2 +- tests/unit/syscall/src/stat.cpp | 36 +++++++++++++++---------------- tests/unit/syscall/src/statx.cpp | 26 +++++++++++----------- 9 files changed, 40 insertions(+), 42 deletions(-) diff --git a/src/common/capio/filesystem.hpp b/src/common/capio/filesystem.hpp index 8d4f8f502..dfcd543e2 100644 --- a/src/common/capio/filesystem.hpp +++ b/src/common/capio/filesystem.hpp @@ -34,7 +34,7 @@ inline bool in_dir(const std::string &path, const std::string &glob) { inline bool is_directory(int dirfd) { START_LOG(capio_syscall(SYS_gettid), "call(dirfd=%d)", dirfd); - struct stat path_stat {}; + struct stat path_stat{}; int tmp = fstat(dirfd, &path_stat); if (tmp != 0) { LOG("Error at is_directory(dirfd=%d) -> %d: %d (%s)", dirfd, tmp, errno, diff --git a/src/common/capio/shm.hpp b/src/common/capio/shm.hpp index 7b39d5427..8ec627162 100644 --- a/src/common/capio/shm.hpp +++ b/src/common/capio/shm.hpp @@ -104,7 +104,7 @@ void *get_shm(const std::string &shm_name) { // if we are not creating a new object, mode is equals to 0 int fd = shm_open(shm_name.c_str(), O_RDWR, 0); // to be closed - struct stat sb {}; + struct stat sb{}; if (fd == -1) { ERR_EXIT("get_shm shm_open %s", shm_name.c_str()); } @@ -129,7 +129,7 @@ void *get_shm_if_exist(const std::string &shm_name) { // if we are not creating a new object, mode is equals to 0 int fd = shm_open(shm_name.c_str(), O_RDWR, 0); // to be closed - struct stat sb {}; + struct stat sb{}; if (fd == -1) { if (errno == ENOENT) { return nullptr; diff --git a/src/posix/handlers/stat.hpp b/src/posix/handlers/stat.hpp index 4e6f598e8..6225a0ed0 100644 --- a/src/posix/handlers/stat.hpp +++ b/src/posix/handlers/stat.hpp @@ -20,9 +20,7 @@ inline void fill_statbuf(struct stat *statbuf, off_t file_size, bool is_dir, ino "call(statbuf=0x%08x, file_size=%ld, is_dir=%s, inode=%ul)", statbuf, file_size, is_dir ? "true" : "false", inode); - struct timespec time { - 1, 1 - }; + struct timespec time{1, 1}; if (is_dir == 1) { statbuf->st_mode = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; file_size = 4096; diff --git a/src/server/remote/backend/mpi.hpp b/src/server/remote/backend/mpi.hpp index 477d1445b..2f7ad8ad2 100644 --- a/src/server/remote/backend/mpi.hpp +++ b/src/server/remote/backend/mpi.hpp @@ -76,8 +76,8 @@ class MPIBackend : public Backend { // receive from server MPI_Irecv(buff, CAPIO_SERVER_REQUEST_MAX_SIZE, MPI_CHAR, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &request); - struct timespec sleepTime {}; - struct timespec returnTime {}; + struct timespec sleepTime{}; + struct timespec returnTime{}; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 200000; diff --git a/src/server/utils/filesystem.hpp b/src/server/utils/filesystem.hpp index 32465b7e8..2a26c4da8 100644 --- a/src/server/utils/filesystem.hpp +++ b/src/server/utils/filesystem.hpp @@ -25,7 +25,7 @@ void write_entry_dir(int tid, const std::filesystem::path &file_path, START_LOG(gettid(), "call(file_path=%s, dir=%s, type=%d)", file_path.c_str(), dir.c_str(), type); - struct linux_dirent64 ld {}; + struct linux_dirent64 ld{}; ld.d_ino = std::hash{}(file_path); std::filesystem::path file_name; if (type == 0) { diff --git a/tests/integration/src/main.cpp b/tests/integration/src/main.cpp index 377356755..3d0f7e912 100644 --- a/tests/integration/src/main.cpp +++ b/tests/integration/src/main.cpp @@ -43,7 +43,7 @@ class CapioServerEnvironment : public testing::Environment { public: explicit CapioServerEnvironment(char **envp) - : args(build_args()), envp(build_env(envp)), server_pid(-1){}; + : args(build_args()), envp(build_env(envp)), server_pid(-1) {}; ~CapioServerEnvironment() override { for (int i = 0; args[i] != nullptr; i++) { diff --git a/tests/unit/syscall/src/main.cpp b/tests/unit/syscall/src/main.cpp index ab6dfde52..76d3db3f5 100644 --- a/tests/unit/syscall/src/main.cpp +++ b/tests/unit/syscall/src/main.cpp @@ -43,7 +43,7 @@ class CapioServerEnvironment : public testing::Environment { public: explicit CapioServerEnvironment(char **envp) - : args(build_args()), envp(build_env(envp)), server_pid(-1){}; + : args(build_args()), envp(build_env(envp)), server_pid(-1) {}; ~CapioServerEnvironment() override { for (int i = 0; args[i] != nullptr; i++) { diff --git a/tests/unit/syscall/src/stat.cpp b/tests/unit/syscall/src/stat.cpp index de2198f2d..e643ee53d 100644 --- a/tests/unit/syscall/src/stat.cpp +++ b/tests/unit/syscall/src/stat.cpp @@ -23,7 +23,7 @@ TEST(SystemCallTest, TestStatOnFile) { EXPECT_EQ(access(PATHNAME, F_OK), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(stat(PATHNAME, &statbuf), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlink(PATHNAME), -1); @@ -34,7 +34,7 @@ TEST(SystemCallTest, TestStatOnDirectory) { constexpr const char *PATHNAME = "test"; EXPECT_NE(mkdir(PATHNAME, S_IRWXU), -1); EXPECT_EQ(access(PATHNAME, F_OK), 0); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(stat(PATHNAME, &statbuf), 0); check_statbuf(statbuf, 4096); EXPECT_NE(rmdir(PATHNAME), -1); @@ -42,7 +42,7 @@ TEST(SystemCallTest, TestStatOnDirectory) { } TEST(SystemCallTest, TestStatOnNonexistentFile) { - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(stat("test", &statbuf), -1); EXPECT_EQ(errno, ENOENT); } @@ -55,7 +55,7 @@ TEST(SystemCallTest, TestFstatOnFile) { EXPECT_NE(fd, -1); EXPECT_EQ(access(PATHNAME, F_OK), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstat(fd, &statbuf), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(close(fd), -1); @@ -70,7 +70,7 @@ TEST(SystemCallTest, TestFstatOnDirectory) { int flags = O_RDONLY | O_DIRECTORY; int fd = open(PATHNAME, flags, S_IRUSR | S_IWUSR); EXPECT_NE(fd, -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstat(fd, &statbuf), 0); check_statbuf(statbuf, 4096); EXPECT_NE(close(fd), -1); @@ -79,7 +79,7 @@ TEST(SystemCallTest, TestFstatOnDirectory) { } TEST(SystemCallTest, TestFstatOnInvalidFd) { - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstat(-1, &statbuf), -1); EXPECT_EQ(errno, EBADF); } @@ -93,7 +93,7 @@ TEST(SystemCallTest, TestFstatatOnFileWithAtFdcwd) { EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(AT_FDCWD, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(AT_FDCWD, PATHNAME, 0), -1); @@ -104,7 +104,7 @@ TEST(SystemCallTest, TestFstatatOnDirectoryWithAtFdcwd) { constexpr const char *PATHNAME = "test"; EXPECT_NE(mkdirat(AT_FDCWD, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(AT_FDCWD, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, 4096); EXPECT_NE(unlinkat(AT_FDCWD, PATHNAME, AT_REMOVEDIR), -1); @@ -122,7 +122,7 @@ TEST(SystemCallTest, TestFstatatOnFileInDifferentDirectoryWithAbsolutePath) { EXPECT_EQ(faccessat(0, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(0, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(0, PATHNAME, 0), -1); @@ -134,7 +134,7 @@ TEST(SystemCallTest, TestFstatatOnDirectoryInDifferentDirectoryWithAbsolutePath) const char *PATHNAME = path_fs.c_str(); EXPECT_NE(mkdirat(0, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(0, PATHNAME, F_OK, 0), 0); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(0, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, 4096); EXPECT_NE(unlinkat(0, PATHNAME, AT_REMOVEDIR), -1); @@ -152,7 +152,7 @@ TEST(SystemCallTest, TestFstatatOnFileInDifferentDirectoryWithDirfd) { EXPECT_EQ(faccessat(dirfd, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(dirfd, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(dirfd, PATHNAME, 0), -1); @@ -167,7 +167,7 @@ TEST(SystemCallTest, TestFstatatOnDirectoryInDifferentDirectoryWithDirfd) { EXPECT_NE(dirfd, -1); EXPECT_NE(mkdirat(dirfd, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(dirfd, PATHNAME, F_OK, 0), 0); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(dirfd, PATHNAME, &statbuf, 0), 0); check_statbuf(statbuf, 4096); EXPECT_NE(unlinkat(dirfd, PATHNAME, AT_REMOVEDIR), -1); @@ -176,7 +176,7 @@ TEST(SystemCallTest, TestFstatatOnDirectoryInDifferentDirectoryWithDirfd) { } TEST(SystemCallTest, TwstFstatatWithAtEmptyPathAndAtFdcwd) { - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(AT_FDCWD, "", &statbuf, AT_EMPTY_PATH), 0); check_statbuf(statbuf, 4096); } @@ -188,7 +188,7 @@ TEST(SystemCallTest, TestFstatatOnFileWithAtEmptyPathAndDirfd) { int dirfd = openat(AT_FDCWD, PATHNAME, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(dirfd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(dirfd, "", &statbuf, AT_EMPTY_PATH), 0); check_statbuf(statbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(close(dirfd), -1); @@ -202,7 +202,7 @@ TEST(SystemCallTest, TestFstatatOnDirectoryWIthAtEmptyPathAndDirfd) { EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); int dirfd = openat(AT_FDCWD, PATHNAME, O_RDONLY | O_DIRECTORY); EXPECT_NE(dirfd, -1); - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(dirfd, "", &statbuf, AT_EMPTY_PATH), 0); check_statbuf(statbuf, 4096); EXPECT_NE(close(dirfd), -1); @@ -211,20 +211,20 @@ TEST(SystemCallTest, TestFstatatOnDirectoryWIthAtEmptyPathAndDirfd) { } TEST(SystemCallTest, TestFstatatOnNonexistentFile) { - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(AT_FDCWD, "test", &statbuf, 0), -1); EXPECT_EQ(errno, ENOENT); } TEST(SystemCallTest, TestFstatatOnRelativePathWithInvalidDirfd) { constexpr const char *PATHNAME = "test"; - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(-1, PATHNAME, &statbuf, 0), -1); EXPECT_EQ(errno, EBADF); } TEST(SystemCallTest, TestFstatatWithEmptyPathAndNoAtEmptyPath) { - struct stat statbuf {}; + struct stat statbuf{}; EXPECT_EQ(fstatat(AT_FDCWD, "", &statbuf, 0), -1); EXPECT_EQ(errno, ENOENT); } diff --git a/tests/unit/syscall/src/statx.cpp b/tests/unit/syscall/src/statx.cpp index 9191c73d5..adff1ef38 100644 --- a/tests/unit/syscall/src/statx.cpp +++ b/tests/unit/syscall/src/statx.cpp @@ -22,7 +22,7 @@ TEST(SystemCallTest, TestStatxOnFileWithAtFdcwd) { EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(AT_FDCWD, PATHNAME, 0), -1); @@ -33,7 +33,7 @@ TEST(SystemCallTest, TestStatxOnDirectoryWithAtFdcwd) { constexpr const char *PATHNAME = "test"; EXPECT_NE(mkdirat(AT_FDCWD, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, 4096); EXPECT_NE(unlinkat(AT_FDCWD, PATHNAME, AT_REMOVEDIR), -1); @@ -51,7 +51,7 @@ TEST(SystemCallTest, TestStatxOnFileInDifferentDirectoryWithAbsolutePath) { EXPECT_EQ(faccessat(0, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(0, PATHNAME, 0), -1); @@ -63,7 +63,7 @@ TEST(SystemCallTest, TestStatxOnDirectoryInDifferentDirectoryWithAbsoluePath) { const char *PATHNAME = path_fs.c_str(); EXPECT_NE(mkdirat(0, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(0, PATHNAME, F_OK, 0), 0); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, 4096); EXPECT_NE(unlinkat(0, PATHNAME, AT_REMOVEDIR), -1); @@ -81,7 +81,7 @@ TEST(SystemCallTest, TestStatxOnFileInDifferentDirectoryWithDirfd) { EXPECT_EQ(faccessat(dirfd, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(fd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); EXPECT_NE(close(fd), -1); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(dirfd, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(unlinkat(dirfd, PATHNAME, 0), -1); @@ -96,7 +96,7 @@ TEST(SystemCallTest, TestStatxOnDirectoryInDifferentDirectoryWithDirfd) { EXPECT_NE(dirfd, -1); EXPECT_NE(mkdirat(dirfd, PATHNAME, S_IRWXU), -1); EXPECT_EQ(faccessat(dirfd, PATHNAME, F_OK, 0), 0); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(dirfd, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, 4096); EXPECT_NE(unlinkat(dirfd, PATHNAME, AT_REMOVEDIR), -1); @@ -105,7 +105,7 @@ TEST(SystemCallTest, TestStatxOnDirectoryInDifferentDirectoryWithDirfd) { } TEST(SystemCallTest, TestStatxWithAtEmptyPathAndAtFdcwd) { - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, "", AT_EMPTY_PATH, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, 4096); } @@ -117,7 +117,7 @@ TEST(SystemCallTest, TestStatxOnFileWithAtEmptyPathAndDirfd) { int dirfd = openat(AT_FDCWD, PATHNAME, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); EXPECT_EQ(write(dirfd, BUFFER, strlen(BUFFER)), strlen(BUFFER)); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(dirfd, "", AT_EMPTY_PATH, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, strlen(BUFFER) * sizeof(char)); EXPECT_NE(close(dirfd), -1); @@ -131,7 +131,7 @@ TEST(SystemCallTest, TestStatxOnDirectoryWithAtEmptyPathAndDirfd) { EXPECT_EQ(faccessat(AT_FDCWD, PATHNAME, F_OK, 0), 0); int dirfd = openat(AT_FDCWD, PATHNAME, O_RDONLY | O_DIRECTORY); EXPECT_NE(dirfd, -1); - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(dirfd, "", AT_EMPTY_PATH, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), 0); check_statxbuf(statxbuf, 4096); EXPECT_NE(close(dirfd), -1); @@ -140,27 +140,27 @@ TEST(SystemCallTest, TestStatxOnDirectoryWithAtEmptyPathAndDirfd) { } TEST(SystemCallTest, TestStatxOnNonexistentFile) { - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, "test", 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), -1); EXPECT_EQ(errno, ENOENT); } TEST(SystemCallTest, TestStatxOnRelativePathWithInvalidDirfd) { constexpr const char *PATHNAME = "test"; - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(-1, PATHNAME, 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), -1); EXPECT_EQ(errno, EBADF); } TEST(SystemCallTest, TestStatxWithStatxReservedSet) { constexpr const char *PATHNAME = "test"; - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(-1, PATHNAME, 0, STATX__RESERVED, &statxbuf), -1); EXPECT_EQ(errno, EINVAL); } TEST(SystemCallTest, TestStatxWithEmptyPathAndNoEmptyPath) { - struct statx statxbuf {}; + struct statx statxbuf{}; EXPECT_EQ(statx(AT_FDCWD, "", 0, STATX_BASIC_STATS | STATX_BTIME, &statxbuf), -1); EXPECT_EQ(errno, ENOENT); } \ No newline at end of file From 88661abe4176055671393e6c5e484d4b01c4e65d Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sat, 27 Sep 2025 12:13:24 +0200 Subject: [PATCH 4/6] Remove g++-15 from CI/CD --- .github/workflows/ci-tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index 6b3ce4953..70e910234 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -111,7 +111,6 @@ jobs: - g++-12 - g++-13 - g++-14 - - g++-15 - clang-17 - clang-18 - clang-19 From d650daeb5069fbe08b4fc15958c4d1e68204d9eb Mon Sep 17 00:00:00 2001 From: Marco Edoardo Santimaria Date: Sat, 27 Sep 2025 13:57:22 +0200 Subject: [PATCH 5/6] Update Taywee/args and simdjson/simdjson --- .github/workflows/ci-tests.yaml | 3 +++ Dockerfile | 1 - src/server/CMakeLists.txt | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index 70e910234..59f91cf5b 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -175,17 +175,20 @@ jobs: --gtest_break_on_failure \ --gtest_print_time=1 + echo "Run CAPIO server Unit tests" capio_server_unit_tests \ --gtest_break_on_failure \ --gtest_print_time=1 + echo "Run CAPIO syscall Unit tests" LD_PRELOAD=libcapio_posix.so \ capio_syscall_unit_tests \ --gtest_break_on_failure \ --gtest_print_time=1 + echo "Run CAPIO integration tests" rm -rf /dev/shm/CAPIO* LD_PRELOAD=libcapio_posix.so \ diff --git a/Dockerfile b/Dockerfile index 514b36803..8af2bd043 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,7 +68,6 @@ COPY --from=builder \ "/usr/local/include/gmoc[k]" \ "/usr/local/include/gtes[t]" \ "/usr/local/include/libsyscall_intercept_hook_point.h" \ - "/usr/local/include/simdjson.h" \ /usr/local/include/ # Libraries diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 4c51715e0..7c0bbe6f8 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -13,12 +13,15 @@ set(TARGET_SOURCES FetchContent_Declare( args GIT_REPOSITORY https://github.com/Taywee/args.git - GIT_TAG 6.4.6 + GIT_TAG 6.4.7 ) +set(ARGS_BUILD_EXAMPLE OFF CACHE INTERNAL "") +set(ARGS_BUILD_UNITTESTS OFF CACHE INTERNAL "") + FetchContent_Declare( simdjson GIT_REPOSITORY https://github.com/simdjson/simdjson.git - GIT_TAG v3.3.0 + GIT_TAG v4.0.6 ) FetchContent_MakeAvailable(args simdjson) From 7f8213ce6ede8a8384168c326b08aebb855c7a42 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sat, 27 Sep 2025 18:20:49 +0200 Subject: [PATCH 6/6] Better clean and server handling --- .github/workflows/ci-tests.yaml | 4 ++-- tests/unit/syscall/src/main.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index 59f91cf5b..aba8b2a01 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -190,7 +190,7 @@ jobs: echo "Run CAPIO integration tests" - rm -rf /dev/shm/CAPIO* + rm -rf /dev/shm/*CAPIO* LD_PRELOAD=libcapio_posix.so \ capio_integration_tests \ --gtest_break_on_failure \ @@ -230,4 +230,4 @@ jobs: uses: codecov/codecov-action@v4 with: fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/tests/unit/syscall/src/main.cpp b/tests/unit/syscall/src/main.cpp index 76d3db3f5..21f827db1 100644 --- a/tests/unit/syscall/src/main.cpp +++ b/tests/unit/syscall/src/main.cpp @@ -1,5 +1,7 @@ #include +#include "capio/syscall.hpp" + char **build_args() { char **args = (char **) malloc(3 * sizeof(uintptr_t)); @@ -59,7 +61,7 @@ class CapioServerEnvironment : public testing::Environment { void SetUp() override { if (server_pid < 0) { ASSERT_NE(std::getenv("CAPIO_DIR"), nullptr); - ASSERT_GE(server_pid = fork(), 0); + ASSERT_GE(server_pid = capio_syscall(SYS_fork), 0); if (server_pid == 0) { execvpe(args[0], args, envp); _exit(127);