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
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/cmake-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
branches: [ "main" ]

env:
CXX_COMPILER: clang++-17
C_COMPILER: clang-17
CLANG_VERSION: "20"

jobs:
build:
Expand All @@ -26,17 +25,15 @@ jobs:

- name: Prepare environment
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' && \
sudo apt update && \
sudo apt-get install clang-17 lldb-17 lld-17 libc++-17-dev libc++abi-17-dev
sudo apt-get update
sudo apt-get install -y clang-${{env.CLANG_VERSION}} lld-${{env.CLANG_VERSION}} libc++-${{env.CLANG_VERSION}}-dev libc++abi-${{env.CLANG_VERSION}}-dev

- name: Configure CMake
run: cmake -B ${{env.BUILD_DIR}} -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} -DCMAKE_C_COMPILER=${{env.C_COMPILER}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
run: cmake -B ${{env.BUILD_DIR}} -DCMAKE_CXX_COMPILER=clang++-${{env.CLANG_VERSION}} -DCMAKE_C_COMPILER=clang-${{env.CLANG_VERSION}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}

- name: Build
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}}
run: cmake --build ${{env.BUILD_DIR}}

- name: Test
working-directory: ${{env.BUILD_DIR}}
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest
23 changes: 15 additions & 8 deletions .github/workflows/cmake-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
branches: [ "main" ]

env:
CXX_COMPILER: g++-12
C_COMPILER: gcc-12
GCC_VERSION: "14"
Comment thread
vvish marked this conversation as resolved.

jobs:
build:
Expand All @@ -24,23 +23,30 @@ jobs:
with:
submodules: recursive

- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y gcc-${{env.GCC_VERSION}} g++-${{env.GCC_VERSION}}

- name: Configure CMake
run: cmake -B ${{env.BUILD_DIR}} -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} -DCMAKE_C_COMPILER=${{env.C_COMPILER}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
run: cmake -B ${{env.BUILD_DIR}} -DCMAKE_CXX_COMPILER=g++-${{env.GCC_VERSION}} -DCMAKE_C_COMPILER=gcc-${{env.GCC_VERSION}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}

- name: Build
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}}
run: cmake --build ${{env.BUILD_DIR}}

- name: Test
working-directory: ${{env.BUILD_DIR}}
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest

- name: Generate coverage report
if: ${{matrix.build_type == 'Debug'}}
working-directory: ${{github.workspace}}
run: |
sudo apt-get install lcov
lcov --gcov-tool gcov-12 --base-directory . --directory ${{env.BUILD_DIR}} -c -o coverage.info
lcov --gcov-tool gcov-12 --remove coverage.info "test/*" -o coverage.info
set -eux
python3 -m pip install --upgrade pip
python3 -m pip install gcovr
gcovr --version
gcovr -r . --gcov-executable gcov-${{env.GCC_VERSION}} --object-directory ${{env.BUILD_DIR}} --exclude 'test/.*' --exclude '3p/.*' --lcov -o coverage.info

- name: Upload coverage to Codecov
if: ${{matrix.build_type == 'Debug'}}
Expand All @@ -49,3 +55,4 @@ jobs:
fail_ci_if_error: true
verbose: true
files: coverage.info
token: ${{ secrets.CODECOV_TOKEN }}
16 changes: 5 additions & 11 deletions test/unit/test_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ TEST_F(test_transaction, trivial_types_transaction_get_not_found)

template <typename T>
concept env_has_iterate_by_key_v
= requires(T t) { t.template iterate_by_key(std::declval<int>()); };
= requires(T t) { t.iterate_by_key(std::declval<int>()); };

TEST_F(test_transaction, trivial_types_transaction_iterate)
{
Expand All @@ -231,13 +231,7 @@ TEST_F(test_transaction, trivial_types_transaction_iterate)
EXPECT_CALL(api, mdb_cursor_open(test_txn, test_dbi, _))
.WillOnce(DoAll(SetArgPointee<2>(cursor), Return(MDB_SUCCESS)));

EXPECT_CALL(
api,
mdb_cursor_get(
cursor,
_,
_,
MDB_FIRST))
EXPECT_CALL(api, mdb_cursor_get(cursor, _, _, MDB_FIRST))
.WillOnce(Return(MDB_SUCCESS));

EXPECT_CALL(api, mdb_cursor_close(cursor));
Expand All @@ -247,7 +241,7 @@ TEST_F(test_transaction, trivial_types_transaction_iterate)
const auto result = transaction.iterate();
ASSERT_TRUE(result);

auto const& db_view = *result;
auto const &db_view = *result;
auto const it = db_view.begin();
ASSERT_NE(it, db_view.end());
}
Expand Down Expand Up @@ -292,11 +286,11 @@ TEST_F(test_transaction, trivial_types_dup_iterate_by_key)
const auto result = transaction.iterate_by_key(0x12345678);
ASSERT_TRUE(result);

auto const& db_view = *result;
auto const &db_view = *result;
auto const it = db_view.begin();
ASSERT_NE(it, db_view.end());

auto const& db_item = *it;
auto const &db_item = *it;
EXPECT_EQ(db_item.key(), 0x12345678);
EXPECT_EQ(db_item.value(), 0x20000030);
}
Expand Down
Loading