From c61a0cb98bf72e6da715dcd75556b381d69c59f7 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Wed, 7 Feb 2024 13:18:16 +0000 Subject: [PATCH 1/6] Experiment to enable gmock --- barretenberg/cpp/cmake/gtest.cmake | 6 ++---- barretenberg/cpp/cmake/module.cmake | 3 +++ .../src/barretenberg/vm/tests/AvmMini_execution.test.cpp | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/barretenberg/cpp/cmake/gtest.cmake b/barretenberg/cpp/cmake/gtest.cmake index c3551ea481a..7fe4c2f67c3 100644 --- a/barretenberg/cpp/cmake/gtest.cmake +++ b/barretenberg/cpp/cmake/gtest.cmake @@ -5,11 +5,11 @@ 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.14.0 FIND_PACKAGE_ARGS ) -set(BUILD_GMOCK OFF CACHE BOOL "Build with gMock disabled") +set(BUILD_GMOCK ON CACHE BOOL "Build with gMock enabled") set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled") FetchContent_MakeAvailable(GTest) @@ -42,8 +42,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() diff --git a/barretenberg/cpp/cmake/module.cmake b/barretenberg/cpp/cmake/module.cmake index d394c024b9f..71fa5cd7dbe 100644 --- a/barretenberg/cpp/cmake/module.cmake +++ b/barretenberg/cpp/cmake/module.cmake @@ -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} ) @@ -118,6 +120,7 @@ function(barretenberg_module MODULE_NAME) ${ARGN} GTest::gtest GTest::gtest_main + GTest::gmock_main ${TBB_IMPORTED_TARGETS} ) diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp index 89cc0b78e58..0dc7a4186f4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp @@ -7,6 +7,7 @@ #include "barretenberg/vm/avm_trace/AvmMini_opcode.hpp" #include "barretenberg/vm/tests/helpers.test.hpp" #include +#include #include #include #include @@ -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); From d93855cb1fba3966b914d8585175b75864cb73d9 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Wed, 7 Feb 2024 16:40:19 +0000 Subject: [PATCH 2/6] Using gtest version 1.13 instead of 1.14 --- barretenberg/cpp/cmake/gtest.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/barretenberg/cpp/cmake/gtest.cmake b/barretenberg/cpp/cmake/gtest.cmake index 7fe4c2f67c3..8f451b6f135 100644 --- a/barretenberg/cpp/cmake/gtest.cmake +++ b/barretenberg/cpp/cmake/gtest.cmake @@ -4,8 +4,7 @@ include(FetchContent) FetchContent_Declare( GTest GIT_REPOSITORY https://github.com/google/googletest.git - # Version 1.12.1 is not compatible with WASI-SDK 12 - GIT_TAG v1.14.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 ) From 659c2c1633b474caf025839d0d1957f0f090e31d Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 7 Feb 2024 12:58:19 -0500 Subject: [PATCH 3/6] Update protocol-circuits-gate-diff.yml --- .github/workflows/protocol-circuits-gate-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-circuits-gate-diff.yml b/.github/workflows/protocol-circuits-gate-diff.yml index e1e8b96b472..56d6abda145 100644 --- a/.github/workflows/protocol-circuits-gate-diff.yml +++ b/.github/workflows/protocol-circuits-gate-diff.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 with: - ref: ${{ inputs.tag || env.GITHUB_REF }} + ref: ${{ github.head_ref }} - name: Install bleeding edge cmake run: | From 97162458f9d9689a756c438c7003a6395a3bc4cd Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 7 Feb 2024 13:10:32 -0500 Subject: [PATCH 4/6] Update gtest.cmake --- barretenberg/cpp/cmake/gtest.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/barretenberg/cpp/cmake/gtest.cmake b/barretenberg/cpp/cmake/gtest.cmake index 8f451b6f135..01850a167c8 100644 --- a/barretenberg/cpp/cmake/gtest.cmake +++ b/barretenberg/cpp/cmake/gtest.cmake @@ -1,6 +1,9 @@ include(GoogleTest) include(FetchContent) +set(BUILD_GMOCK ON CACHE 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 @@ -8,9 +11,6 @@ FetchContent_Declare( FIND_PACKAGE_ARGS ) -set(BUILD_GMOCK ON CACHE BOOL "Build with gMock enabled") -set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled") - FetchContent_MakeAvailable(GTest) if (NOT GTest_FOUND) From 3ee6956ecd7ed99453e9da7e83dedf0c62a04ac5 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 7 Feb 2024 13:17:08 -0500 Subject: [PATCH 5/6] Update gtest.cmake --- barretenberg/cpp/cmake/gtest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/cmake/gtest.cmake b/barretenberg/cpp/cmake/gtest.cmake index 01850a167c8..79b81c75abe 100644 --- a/barretenberg/cpp/cmake/gtest.cmake +++ b/barretenberg/cpp/cmake/gtest.cmake @@ -1,7 +1,7 @@ include(GoogleTest) include(FetchContent) -set(BUILD_GMOCK ON CACHE BOOL "Build with gMock enabled") +set(BUILD_GMOCK ON CACHE INTERNAL BOOL "Build with gMock enabled") set(INSTALL_GTEST OFF CACHE BOOL "gTest installation disabled") FetchContent_Declare( From 487ece2281b2e65c3c24e620188513f37a0b0f08 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 7 Feb 2024 13:19:57 -0500 Subject: [PATCH 6/6] Update protocol-circuits-gate-diff.yml --- .github/workflows/protocol-circuits-gate-diff.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/protocol-circuits-gate-diff.yml b/.github/workflows/protocol-circuits-gate-diff.yml index 56d6abda145..38f0fbb3437 100644 --- a/.github/workflows/protocol-circuits-gate-diff.yml +++ b/.github/workflows/protocol-circuits-gate-diff.yml @@ -13,8 +13,6 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - name: Install bleeding edge cmake run: |