raft.h: Add raft->now field tracking what the current time is (#51) #255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
- push | |
- pull_request | |
jobs: | |
test: | |
name: Unit and integration tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup dependencies | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -qq lcov linux-libc-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux | |
- name: Amalgamation | |
run: | | |
git clone --depth 1 https://github.com/edlund/amalgamate.git | |
export PATH=$PATH:$PWD/amalgamate | |
amalgamate.py --config=amalgamation.json --source=$(pwd) | |
gcc raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic | |
- name: Configure | |
run: | | |
autoreconf -i | |
./configure --enable-example \ | |
--enable-debug \ | |
--enable-code-coverage \ | |
--enable-sanitize \ | |
--enable-benchmark | |
- name: Build | |
run: | | |
make -j$(nproc --all) | |
- name: Test | |
run: | | |
export LIBRAFT_TRACE=1 | |
./test/lib/fs.sh setup | |
make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false) | |
./test/lib/fs.sh teardown | |
- name: Coverage | |
run: | | |
make code-coverage-capture | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
linting: | |
name: Linting | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DoozyX/clang-format-lint-action@v0.14 | |
with: | |
source: 'src test example' | |
exclude: 'test/lib/munit.*' | |
extensions: 'c,h' | |
clangFormatVersion: 14 | |
style: file | |
configure: | |
name: Configuration flags | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check that no optional dependency is installed | |
run: | | |
# Remove liblz4-dev which is installed by default on the runner | |
sudo apt-get remove liblz4-dev | |
# Check that there are no dependencies installed | |
! pkg-config --exists libuv | |
! pkg-config --exists liblz4 | |
- name: Run autoreconf | |
run: | | |
autoreconf -i | |
- name: With no deps ./configure | |
run: | | |
# Succeed, since we are not explicitly requiring libuv. | |
./configure | |
- name: With no deps ./configure --enable-uv | |
run: | | |
# Fail, since libuv is not installed. | |
! ./configure --enable-uv 2>errors | |
tail -1 errors | grep -q "libuv required but not found" || (cat errors && false) | |
- name: With no deps ./configure --with-lz4 | |
run: | | |
# Fail, since using lz4 makes sense only if libuv is used too. | |
! ./configure --with-lz4 2>errors | |
tail -1 errors | grep -q "liblz4 can be used only if libuv is used too" || (cat errors && false) | |
- name: Install libuv | |
run: | | |
sudo apt-get install -qq linux-libc-dev libuv1-dev | |
- name: With libuv only ./configure | |
run: | | |
# Succeed, since libuv is installed and automatically used. | |
./configure | |
- name: With libuv only ./configure --disable-uv | |
run: | | |
# Succeed, since libuv support can be disabled | |
./configure --disable-uv | |
- name: With libuv only ./configure --with-lz4 | |
run: | | |
# Fail, since liblz4 is not installed. | |
! ./configure --with-lz4 2>errors | |
tail -1 errors | grep -q "liblz4 required but not found" || (cat errors && false) | |
- name: With libuv only ./configure --disable-uv --with-lz4 | |
run: | | |
# Fail, since using lz4 makes sense only if libuv is used too. | |
! ./configure --disable-uv --with-lz4 2>errors | |
tail -1 errors | grep -q "liblz4 can be used only if libuv is used too" || (cat errors && false) | |
- name: Install liblz4 | |
run: | | |
sudo apt-get install -qq liblz4-dev | |
- name: With libuv and liblz4 ./configure | |
run: | | |
# Succeed, since all optional dependencies are found and used. | |
./configure | |
- name: With libuv and liblz4 ./configure --without-lz4 | |
run: | | |
# Succeed, since we support building without lz4 even if both libuv and | |
# liblz4 are found. | |
./configure --without-lz4 |