Skip to content
Open
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
30 changes: 16 additions & 14 deletions .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -93,30 +93,29 @@ 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
- g++-13
- clang-13
- clang-14
- clang-15
- clang-16
- g++-14
- clang-17
- clang-18
- clang-19
- clang-20
- clang-21
steps:
- uses: actions/checkout@v4
- name: "Install packages"
Expand Down Expand Up @@ -176,19 +175,22 @@ 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*
rm -rf /dev/shm/*CAPIO*
LD_PRELOAD=libcapio_posix.so \
capio_integration_tests \
--gtest_break_on_failure \
Expand Down Expand Up @@ -219,7 +221,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"
Expand All @@ -228,4 +230,4 @@ jobs:
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion src/common/capio/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/common/capio/shm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/posix/handlers/stat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/server/remote/backend/mpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/server/utils/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>{}(file_path);
std::filesystem::path file_name;
if (type == 0) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/syscall/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <gtest/gtest.h>

#include "capio/syscall.hpp"

char **build_args() {
char **args = (char **) malloc(3 * sizeof(uintptr_t));

Expand Down Expand Up @@ -43,7 +45,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++) {
Expand All @@ -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);
Expand Down
36 changes: 18 additions & 18 deletions tests/unit/syscall/src/stat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -34,15 +34,15 @@ 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);
EXPECT_NE(access(PATHNAME, F_OK), 0);
}

TEST(SystemCallTest, TestStatOnNonexistentFile) {
struct stat statbuf {};
struct stat statbuf{};
EXPECT_EQ(stat("test", &statbuf), -1);
EXPECT_EQ(errno, ENOENT);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
Expand Down
Loading
Loading