Skip to content

Commit

Permalink
Add consistent testing, fix pack test
Browse files Browse the repository at this point in the history
  • Loading branch information
x-mass committed Mar 19, 2024
1 parent 47540c7 commit 0286eb7
Show file tree
Hide file tree
Showing 5 changed files with 768 additions and 711 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: PR Testing

on:
pull_request:
push:
branches:
- master

concurrency:
# In master we want to run for every commit, in other branches — only for the last one
group: ${{
( github.ref == 'refs/heads/master' && format('{0}/{1}/{2}', github.workflow, github.ref, github.sha) )
||
format('{0}/{1}', github.workflow, github.ref) }}
cancel-in-progress: true

jobs:
handle-syncwith:
name: Call Reusable SyncWith Handler
uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1.2.0
with:
ci-cd-ref: 'v1.2.0'
secrets: inherit

test-linux:
name: Linux Reusable Crypto3 Testing
needs:
- handle-syncwith
uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-testing-linux.yml@crypto-nix

secrets: inherit
with:
submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
check-names: |
block-clang 2
# Temporarily disable mac tests, they fail.
# test-mac:
# name: Mac Reusable Crypto3 Testing
# needs:
# - handle-syncwith
# uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-testing-mac.yml@crypto-nix

# secrets: inherit
# with:
# submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
# check-names: |
# block-clang

publish-results:
name: Publish JUnit results
needs:
- test-linux
# - test-mac
uses: NilFoundation/ci-cd/.github/workflows/reusable-crypto3-publish-result.yml@crypto-nix
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,5 @@ cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

if(BUILD_TESTS)
add_subdirectory(test)
endif()
include(CMTest)
cm_add_test_subdirectory(test)
6 changes: 5 additions & 1 deletion include/nil/crypto3/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#ifndef CRYPTO3_TYPE_TRAITS_HPP
#define CRYPTO3_TYPE_TRAITS_HPP

#include <iterator>
#include <type_traits>


#define GENERATE_HAS_MEMBER_TYPE(Type) \
template<class T, typename Enable = void> \
class HasMemberType_##Type { \
Expand Down Expand Up @@ -325,4 +329,4 @@ namespace nil {
} // namespace crypto3
} // namespace nil

#endif // CRYPTO3_TYPE_TRAITS_HPP
#endif // CRYPTO3_TYPE_TRAITS_HPP
14 changes: 7 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

include(CMTest)

if(NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
cm_find_package(Boost REQUIRED COMPONENTS unit_test_framework)
endif()
Expand All @@ -16,27 +14,29 @@ cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
${Boost_LIBRARIES})

macro(define_block_cipher_test name)
cm_test(NAME block_${name}_test SOURCES ${name}.cpp)
set(test_name "block_${name}_test")

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

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

${Boost_INCLUDE_DIRS})

if(NOT CMAKE_CXX_STANDARD)
set_target_properties(block_${name}_test PROPERTIES CXX_STANDARD 14)
set_target_properties(${test_name} PROPERTIES CXX_STANDARD 14)
endif()

get_target_property(target_type Boost::unit_test_framework TYPE)
if(target_type STREQUAL "SHARED_LIB")
target_compile_definitions(block_${name}_test PRIVATE BOOST_TEST_DYN_LINK)
target_compile_definitions(${test_name} PRIVATE BOOST_TEST_DYN_LINK)
elseif(target_type STREQUAL "STATIC_LIB")

endif()

string(CONCAT TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR} "/data/" "${name}" ".json")
target_compile_definitions(block_${name}_test PRIVATE TEST_DATA="${TEST_DATA}")
target_compile_definitions(${test_name} PRIVATE TEST_DATA_DIR="${TEST_DATA}")
endmacro()

set(TESTS_NAMES
Expand Down
Loading

0 comments on commit 0286eb7

Please sign in to comment.