Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable gmock and upgrade gtest to 1.13 #4480

Merged
merged 7 commits into from
Feb 7, 2024
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: 0 additions & 2 deletions .github/workflows/protocol-circuits-gate-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- name: Install bleeding edge cmake
run: |
Expand Down
11 changes: 4 additions & 7 deletions barretenberg/cpp/cmake/gtest.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
include(GoogleTest)
include(FetchContent)

set(BUILD_GMOCK ON CACHE INTERNAL BOOL "Build with gMock enabled")
set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled")

FetchContent_Declare(
GTest
GIT_REPOSITORY https://github.com/google/googletest.git
# Version 1.12.1 is not compatible with WASI-SDK 12
GIT_TAG release-1.10.0
GIT_TAG v1.13.0 #v1.14.0 does not compile with gcc (compiler bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329)
FIND_PACKAGE_ARGS
)

set(BUILD_GMOCK OFF CACHE BOOL "Build with gMock disabled")
set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled")

FetchContent_MakeAvailable(GTest)

if (NOT GTest_FOUND)
Expand Down Expand Up @@ -42,8 +41,6 @@ if (NOT GTest_FOUND)
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols
)

add_library(GTest::gtest ALIAS gtest)
add_library(GTest::gtest_main ALIAS gtest_main)
endif()

enable_testing()
3 changes: 3 additions & 0 deletions barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ function(barretenberg_module MODULE_NAME)
${MODULE_NAME}_test_objects
PRIVATE
GTest::gtest
GTest::gtest_main
GTest::gmock_main
${TBB_IMPORTED_TARGETS}
)

Expand Down Expand Up @@ -118,6 +120,7 @@ function(barretenberg_module MODULE_NAME)
${ARGN}
GTest::gtest
GTest::gtest_main
GTest::gmock_main
${TBB_IMPORTED_TARGETS}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "barretenberg/vm/avm_trace/AvmMini_opcode.hpp"
#include "barretenberg/vm/tests/helpers.test.hpp"
#include <cstdint>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <string>
#include <utility>
Expand Down Expand Up @@ -64,7 +65,7 @@ TEST_F(AvmMiniExecutionTests, basicAddReturn)
auto instructions = Deserialization::parse(bytecode);

// 2 instructions
EXPECT_EQ(instructions.size(), 2);
EXPECT_THAT(instructions, testing::SizeIs(2));

// ADD
EXPECT_EQ(instructions.at(0).op_code, OpCode::ADD);
Expand Down
Loading