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

DeepState Test Integration #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
71 changes: 69 additions & 2 deletions setup-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,58 @@ project(aztec-trusted-setup)
cable_configure_compiler(NO_PEDANTIC NO_CONVERSION_WARNINGS)

set(include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(setup_test_dir ${CMAKE_CURRENT_SOURCE_DIR}/test/setup)
set(deepstate_test_dir ${CMAKE_CURRENT_SOURCE_DIR}/test/deepstate-tests)

set(private_include_dir ${PROJECT_SOURCE_DIR}/src)
set(DEPENDS_DIR ${PROJECT_SOURCE_DIR}/depends)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE ON)

option(
GENCOV
"Enable gcov instrumentation"
OFF
)
if("${GENCOV}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fprofile-arcs -ftest-coverage")
endif()

message(STATUS "GENCOV: ${GENCOV}")

### SETUP
# Create a directory to store the trusted setup output
add_custom_target(create-setup-db-directory ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/setup_db)

# regular gcov reporting with setup_tests
add_custom_target(cov
COMMAND ${CMAKE_COMMAND} -E make_directory cov_out
COMMAND ${CMAKE_CTEST_COMMAND} -R setup
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET cov
COMMAND echo "=================== GCOV ===================="
COMMAND echo "${setup_test_dir}"
COMMAND gcov -b ${setup_test_dir}/*.cpp -o ${CMAKE_BINARY_DIR}/test/setup/CMakeFiles/setup_tests.dir/
COMMAND echo "-- Coverage files have been output to ${CMAKE_BINARY_DIR}/cov_out"
COMMAND echo "=================== GCOV ===================="
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/cov_out)

# gcov reporting for deepstate_tests
add_custom_target(dcov
COMMAND ${CMAKE_COMMAND} -E make_directory dcov_out
COMMAND ${CMAKE_CTEST_COMMAND} -R deepstate_test
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET dcov
COMMAND echo "=================== GCOV ===================="
COMMAND echo "${deepstate_test_dir}"
COMMAND gcov -b ${deepstate_test_dir}/*.cpp -o ${CMAKE_BINARY_DIR}/test/deepstate-tests/CMakeFiles/deepstate_tests.dir/
COMMAND echo "-- Coverage files have been output to ${CMAKE_BINARY_DIR}/dcov_out"
COMMAND echo "=================== GCOV ===================="
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dcov_out)


### DEPENDENCIES

# GMP
Expand Down Expand Up @@ -78,13 +119,39 @@ add_definitions(
-DNO_PROCPS
)

# DEFAULT SIMULATE_PARTICIPANT OFF
option(
SIMULATE_PARTICIPANT
"Setup toxic waste is hash of previous transcript"
OFF
)
if("${SIMULATE_PARTICIPANT}")
add_definitions(-DSIMULATE_PARTICIPANT)
endif()

message(STATUS "SIMULATE_PARTICIPANT: ${SIMULATE_PARTICIPANT}")


# DEFAULT USE_CXX11_ABI OFF
option(
USE_CXX11_ABI
"Set to link to libraries that use legacy ABI (GCC 5.x)"
OFF
)
if("${USE_CXX11_ABI}")
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()

message(STATUS "USE_CXX11_ABI: ${USE_CXX11_ABI}")

add_subdirectory(depends)

add_subdirectory(src)

option(SETUP_TESTING "Build tests" ON)

if(SETUP_TESTING)
enable_testing()
add_subdirectory(test)
enable_testing()
add_subdirectory(test)
add_test(deepstate_test ${CMAKE_CURRENT_BINARY_DIR}/test/deepstate_tests)
endif()
3 changes: 2 additions & 1 deletion setup-tools/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ include(GoogleTest)

set(setup_private_include_dir ${PROJECT_SOURCE_DIR}/src)

add_subdirectory(setup)
add_subdirectory(deepstate-tests)
add_subdirectory(setup)
30 changes: 30 additions & 0 deletions setup-tools/test/deepstate-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
add_executable(
deepstate_tests
test_entry_points.cpp
test_aztec_common.cpp
test_setup.cpp
test_compute_range_polynomial.cpp
../../src/verify/verifier.cpp
)

target_link_libraries(
deepstate_tests
PRIVATE
ff
aztec_common
-ldeepstate_AFL
-pthread
)

target_include_directories(
deepstate_tests
PRIVATE
${PROJECT_SOURCE_DIR}/depends/libfqfft
${private_include_dir}
${include_dir}
)

set_target_properties(
deepstate_tests
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..
)
Loading