Skip to content

Commit

Permalink
Fix tests on ci and move slow tests to bench_tests folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
martun committed Jul 12, 2024
1 parent 837af0c commit 704bb8b
Show file tree
Hide file tree
Showing 21 changed files with 682 additions and 182 deletions.
2 changes: 1 addition & 1 deletion libs/hash/test/hash_to_curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <type_traits>
#include <tuple>

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

Expand Down
2 changes: 1 addition & 1 deletion libs/marshalling/algebra/test/curve_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#define BOOST_TEST_MODULE crypto3_marshalling_curve_element_test

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
Expand Down
2 changes: 1 addition & 1 deletion libs/marshalling/zk/test/kzg_commitment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "nil/crypto3/zk/commitments/batched_commitment.hpp"
#define BOOST_TEST_MODULE crypto3_marshalling_kzg_commitment_test

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <iostream>
#include <iomanip>
Expand Down
2 changes: 1 addition & 1 deletion libs/marshalling/zk/test/lpc_commitment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#define BOOST_TEST_MODULE crypto3_marshalling_lpc_commitment_test

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string/case_conv.hpp>

#include <boost/random/mersenne_twister.hpp>
Expand Down
2 changes: 1 addition & 1 deletion libs/marshalling/zk/test/placeholder_common_data.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE crypto3_marshalling_placeholder_common_data_test

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
Expand Down
2 changes: 1 addition & 1 deletion libs/marshalling/zk/test/placeholder_proof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#define BOOST_TEST_MODULE crypto3_marshalling_placeholder_proof_test

#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
Expand Down
5 changes: 4 additions & 1 deletion libs/zk/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ set(TESTS_NAMES
"commitment/fri"
"commitment/kzg"
"commitment/fold_polynomial"
"commitment/lpc_performance"
"commitment/pedersen"
"commitment/proof_of_knowledge"
# "commitment/powers_of_tau"
Expand Down Expand Up @@ -110,3 +109,7 @@ endforeach()

# string(CONCAT TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR} "/systems/plonk/pickles/data/kimchi")
# target_compile_definitions(crypto3_zk_systems_plonk_pickles_kimchi_test PRIVATE TEST_DATA="${TEST_DATA}")
if(BUILD_BENCH_TESTS)
cm_add_test_subdirectory(bench_test)
endif()

45 changes: 45 additions & 0 deletions libs/zk/test/bench_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#---------------------------------------------------------------------------#
# Copyright (c) 2018-2021 Mikhail Komarov <[email protected]>
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

include(CMTest)

add_custom_target(zk_runtime_bench_tests)

macro(define_runtime_zk_test name)
set(test_name "zk_${name}_bench_test")
add_dependencies(zk_runtime_bench_tests ${test_name})

cm_test(NAME ${test_name} SOURCES ${name}.cpp)

target_include_directories(${test_name} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"

${Boost_INCLUDE_DIRS})

set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${test_name} PRIVATE "-fconstexpr-steps=2147483647")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${test_name} PRIVATE "-fconstexpr-ops-limit=4294967295")
endif()

target_compile_definitions(${test_name} PRIVATE TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/")
endmacro()

set(RUNTIME_TESTS_NAMES
"bench_pedersen"
"bench_lpc"
)

foreach(TEST_NAME ${RUNTIME_TESTS_NAMES})
define_runtime_zk_test(${TEST_NAME})
endforeach()

Loading

0 comments on commit 704bb8b

Please sign in to comment.