mirror of https://github.com/status-im/evmc.git
cmake: Move vmtester from test/ to tools/
This commit is contained in:
parent
36d9f14307
commit
c2f77c9da2
|
@ -53,18 +53,19 @@ target_include_directories(evmc INTERFACE $<BUILD_INTERFACE:${include_dir}>$<INS
|
||||||
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|
||||||
|
if(EVMC_TOOLS)
|
||||||
|
add_subdirectory(tools)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EVMC_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(EVMC_TESTING)
|
if(EVMC_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EVMC_TESTING OR EVMC_TOOLS)
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EVMC_TESTING OR EVMC_EXAMPLES)
|
|
||||||
add_subdirectory(examples)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
write_basic_package_version_file(evmcConfigVersion.cmake COMPATIBILITY ExactVersion)
|
write_basic_package_version_file(evmcConfigVersion.cmake COMPATIBILITY ExactVersion)
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
|
|
|
@ -50,7 +50,7 @@ commands:
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: ~/build
|
root: ~/build
|
||||||
paths:
|
paths:
|
||||||
- test/evmc-vmtester
|
- bin/evmc-vmtester
|
||||||
- examples/evmc-example
|
- examples/evmc-example
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -204,7 +204,7 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Test with evmc-vmtester
|
name: Test with evmc-vmtester
|
||||||
command: |
|
command: |
|
||||||
~/build/test/evmc-vmtester target/debug/libexamplerustvm.so
|
~/build/bin/evmc-vmtester target/debug/libexamplerustvm.so
|
||||||
- run:
|
- run:
|
||||||
name: Test with evmc-example
|
name: Test with evmc-example
|
||||||
command: |
|
command: |
|
||||||
|
@ -235,7 +235,7 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Test with evmc-vmtester
|
name: Test with evmc-vmtester
|
||||||
command: |
|
command: |
|
||||||
~/build/test/evmc-vmtester target/x86_64-unknown-linux-gnu/debug/libexamplerustvm.so
|
~/build/bin/evmc-vmtester target/x86_64-unknown-linux-gnu/debug/libexamplerustvm.so
|
||||||
- run:
|
- run:
|
||||||
name: Test with evmc-example
|
name: Test with evmc-example
|
||||||
command: |
|
command: |
|
||||||
|
|
|
@ -2,21 +2,6 @@
|
||||||
# Copyright 2018-2019 The EVMC Authors.
|
# Copyright 2018-2019 The EVMC Authors.
|
||||||
# Licensed under the Apache License, Version 2.0.
|
# Licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
hunter_add_package(GTest)
|
add_subdirectory(integration)
|
||||||
find_package(GTest CONFIG REQUIRED)
|
add_subdirectory(unittests)
|
||||||
|
|
||||||
# Disable support for std::tr1::tuple in GTest. This causes problems in Visual Studio 2015.
|
|
||||||
set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS GTEST_HAS_TR1_TUPLE=0)
|
|
||||||
|
|
||||||
if(NOT CMAKE_CXX_STANDARD)
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EVMC_TESTING)
|
|
||||||
add_subdirectory(integration)
|
|
||||||
add_subdirectory(unittests)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(vmtester)
|
add_subdirectory(vmtester)
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
|
|
||||||
|
hunter_add_package(GTest)
|
||||||
|
find_package(GTest CONFIG REQUIRED)
|
||||||
|
|
||||||
|
# Disable support for std::tr1::tuple in GTest. This causes problems in Visual Studio 2015.
|
||||||
|
set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS GTEST_HAS_TR1_TUPLE=0)
|
||||||
|
|
||||||
add_library(loader-mocked STATIC ${PROJECT_SOURCE_DIR}/lib/loader/loader.c)
|
add_library(loader-mocked STATIC ${PROJECT_SOURCE_DIR}/lib/loader/loader.c)
|
||||||
target_link_libraries(loader-mocked PRIVATE evmc)
|
target_link_libraries(loader-mocked PRIVATE evmc)
|
||||||
target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1)
|
target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1)
|
||||||
|
@ -24,7 +30,7 @@ target_link_libraries(
|
||||||
evmc::example-vm-static
|
evmc::example-vm-static
|
||||||
evmc::example-precompiles-vm-static
|
evmc::example-precompiles-vm-static
|
||||||
evmc-example-host
|
evmc-example-host
|
||||||
instructions
|
evmc::instructions
|
||||||
GTest::gtest_main
|
GTest::gtest_main
|
||||||
)
|
)
|
||||||
set_target_properties(evmc-unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
|
set_target_properties(evmc-unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
|
||||||
|
|
|
@ -3,41 +3,29 @@
|
||||||
# Licensed under the Apache License, Version 2.0.
|
# Licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
include(EVMC)
|
include(EVMC)
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
add_executable(evmc-vmtester vmtester.hpp vmtester.cpp tests.cpp)
|
|
||||||
set_target_properties(evmc-vmtester PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
|
|
||||||
target_link_libraries(evmc-vmtester PRIVATE evmc::loader evmc::mocked_host GTest::gtest)
|
|
||||||
set_source_files_properties(vmtester.cpp PROPERTIES COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")
|
|
||||||
add_executable(evmc::evmc-vmtester ALIAS evmc-vmtester)
|
|
||||||
|
|
||||||
|
|
||||||
if(EVMC_INSTALL)
|
|
||||||
install(TARGETS evmc-vmtester EXPORT evmcTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(prefix ${PROJECT_NAME}/vmtester)
|
set(prefix ${PROJECT_NAME}/vmtester)
|
||||||
|
|
||||||
evmc_add_vm_test(NAME ${prefix}/examplevm TARGET example-vm)
|
evmc_add_vm_test(NAME ${prefix}/examplevm TARGET example-vm)
|
||||||
evmc_add_vm_test(NAME ${prefix}/example_precompiles_vm TARGET example-precompiles-vm)
|
evmc_add_vm_test(NAME ${prefix}/example_precompiles_vm TARGET example-precompiles-vm)
|
||||||
|
|
||||||
add_test(NAME ${prefix}/help COMMAND evmc-vmtester --version --help)
|
add_test(NAME ${prefix}/help COMMAND evmc::evmc-vmtester --version --help)
|
||||||
set_tests_properties(${prefix}/help PROPERTIES PASS_REGULAR_EXPRESSION "Usage:")
|
set_tests_properties(${prefix}/help PROPERTIES PASS_REGULAR_EXPRESSION "Usage:")
|
||||||
|
|
||||||
add_test(NAME ${prefix}/nonexistingvm COMMAND evmc-vmtester nonexistingvm)
|
add_test(NAME ${prefix}/nonexistingvm COMMAND evmc::evmc-vmtester nonexistingvm)
|
||||||
set_tests_properties(${prefix}/nonexistingvm PROPERTIES PASS_REGULAR_EXPRESSION "[Cc]annot open")
|
set_tests_properties(${prefix}/nonexistingvm PROPERTIES PASS_REGULAR_EXPRESSION "[Cc]annot open")
|
||||||
|
|
||||||
add_test(NAME ${prefix}/noarg COMMAND evmc-vmtester)
|
add_test(NAME ${prefix}/noarg COMMAND evmc::evmc-vmtester)
|
||||||
set_tests_properties(${prefix}/noarg PROPERTIES PASS_REGULAR_EXPRESSION "is required")
|
set_tests_properties(${prefix}/noarg PROPERTIES PASS_REGULAR_EXPRESSION "is required")
|
||||||
|
|
||||||
add_test(NAME ${prefix}/too-many-args COMMAND evmc-vmtester a b)
|
add_test(NAME ${prefix}/too-many-args COMMAND evmc::evmc-vmtester a b)
|
||||||
set_tests_properties(${prefix}/too-many-args PROPERTIES PASS_REGULAR_EXPRESSION "Unexpected")
|
set_tests_properties(${prefix}/too-many-args PROPERTIES PASS_REGULAR_EXPRESSION "Unexpected")
|
||||||
|
|
||||||
add_test(NAME ${prefix}/version COMMAND evmc-vmtester --version)
|
add_test(NAME ${prefix}/version COMMAND evmc::evmc-vmtester --version)
|
||||||
set_tests_properties(${prefix}/version PROPERTIES PASS_REGULAR_EXPRESSION ${PROJECT_VERSION})
|
set_tests_properties(${prefix}/version PROPERTIES PASS_REGULAR_EXPRESSION ${PROJECT_VERSION})
|
||||||
|
|
||||||
add_test(NAME ${prefix}/unknown-option COMMAND evmc-vmtester --verbose)
|
add_test(NAME ${prefix}/unknown-option COMMAND evmc::evmc-vmtester --verbose)
|
||||||
set_tests_properties(${prefix}/unknown-option PROPERTIES PASS_REGULAR_EXPRESSION "Unknown")
|
set_tests_properties(${prefix}/unknown-option PROPERTIES PASS_REGULAR_EXPRESSION "Unknown")
|
||||||
|
|
||||||
add_test(NAME ${prefix}/option-long-prefix COMMAND evmc-vmtester ---)
|
add_test(NAME ${prefix}/option-long-prefix COMMAND evmc::evmc-vmtester ---)
|
||||||
set_tests_properties(${prefix}/option-long-prefix PROPERTIES PASS_REGULAR_EXPRESSION "Unknown")
|
set_tests_properties(${prefix}/option-long-prefix PROPERTIES PASS_REGULAR_EXPRESSION "Unknown")
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# EVMC: Ethereum Client-VM Connector API.
|
||||||
|
# Copyright 2019 The EVMC Authors.
|
||||||
|
# Licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
|
add_subdirectory(vmtester)
|
|
@ -0,0 +1,21 @@
|
||||||
|
# EVMC: Ethereum Client-VM Connector API.
|
||||||
|
# Copyright 2018-2019 The EVMC Authors.
|
||||||
|
# Licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
hunter_add_package(GTest)
|
||||||
|
find_package(GTest CONFIG REQUIRED)
|
||||||
|
|
||||||
|
# Disable support for std::tr1::tuple in GTest. This causes problems in Visual Studio 2015.
|
||||||
|
set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS GTEST_HAS_TR1_TUPLE=0)
|
||||||
|
|
||||||
|
add_executable(evmc-vmtester vmtester.hpp vmtester.cpp tests.cpp)
|
||||||
|
set_target_properties(evmc-vmtester PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
|
||||||
|
target_link_libraries(evmc-vmtester PRIVATE evmc::loader evmc::mocked_host GTest::gtest)
|
||||||
|
set_source_files_properties(vmtester.cpp PROPERTIES COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")
|
||||||
|
add_executable(evmc::evmc-vmtester ALIAS evmc-vmtester)
|
||||||
|
|
||||||
|
if(EVMC_INSTALL)
|
||||||
|
install(TARGETS evmc-vmtester EXPORT evmcTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
endif()
|
Loading…
Reference in New Issue