mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-16 04:20:31 +00:00
Added test build target, fixed CMake warning
https://github.com/aquynh/capstone/issues/376
This commit is contained in:
parent
aceb2bb8a1
commit
2c073468d8
@ -26,6 +26,8 @@ option(CAPSTONE_X86_REDUCE "x86 with reduce instruction sets to minimize library
|
|||||||
option(CAPSTONE_X86_ATT_DISABLE "Disable x86 AT&T syntax" OFF)
|
option(CAPSTONE_X86_ATT_DISABLE "Disable x86 AT&T syntax" OFF)
|
||||||
option(CAPSTONE_OSXKERNEL_SUPPORT "Support to embed Capstone into OS X Kernel extensions" OFF)
|
option(CAPSTONE_OSXKERNEL_SUPPORT "Support to embed Capstone into OS X Kernel extensions" OFF)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
if (CAPSTONE_BUILD_DIET)
|
if (CAPSTONE_BUILD_DIET)
|
||||||
add_definitions(-DCAPSTONE_DIET)
|
add_definitions(-DCAPSTONE_DIET)
|
||||||
endif ()
|
endif ()
|
||||||
@ -80,7 +82,7 @@ set(HEADERS_COMMON
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
set(TEST_SOURCES test.c test_detail.c test_skipdata.c test_iter.c test_customized_mnem.c)
|
set(TEST_SOURCES test_basic.c test_detail.c test_skipdata.c test_iter.c test_customized_mnem.c)
|
||||||
|
|
||||||
## architecture support
|
## architecture support
|
||||||
if (CAPSTONE_ARM_SUPPORT)
|
if (CAPSTONE_ARM_SUPPORT)
|
||||||
@ -357,12 +359,14 @@ if (CAPSTONE_BUILD_TESTS)
|
|||||||
STRING(REGEX REPLACE ".c$" "" TBIN ${TSRC})
|
STRING(REGEX REPLACE ".c$" "" TBIN ${TSRC})
|
||||||
add_executable(${TBIN} "tests/${TSRC}")
|
add_executable(${TBIN} "tests/${TSRC}")
|
||||||
target_link_libraries(${TBIN} ${default-target})
|
target_link_libraries(${TBIN} ${default-target})
|
||||||
|
add_test(NAME "capstone_${TBIN}" COMMAND ${TBIN})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
if (CAPSTONE_ARM_SUPPORT)
|
if (CAPSTONE_ARM_SUPPORT)
|
||||||
set(ARM_REGRESS_TEST test_arm_regression.c)
|
set(ARM_REGRESS_TEST test_arm_regression.c)
|
||||||
STRING(REGEX REPLACE ".c$" "" ARM_REGRESS_BIN ${ARM_REGRESS_TEST})
|
STRING(REGEX REPLACE ".c$" "" ARM_REGRESS_BIN ${ARM_REGRESS_TEST})
|
||||||
add_executable(${ARM_REGRESS_BIN} "suite/arm/${ARM_REGRESS_TEST}")
|
add_executable(${ARM_REGRESS_BIN} "suite/arm/${ARM_REGRESS_TEST}")
|
||||||
target_link_libraries(${ARM_REGRESS_BIN} ${default-target})
|
target_link_libraries(${ARM_REGRESS_BIN} ${default-target})
|
||||||
|
add_test(NAME "capstone_${ARM_REGRESS_BIN}" COMMAND ${ARM_REGRESS_BIN})
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ endif
|
|||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
SOURCES = test.c test_detail.c test_skipdata.c test_iter.c test_customized_mnem.c
|
SOURCES = test_basic.c test_detail.c test_skipdata.c test_iter.c test_customized_mnem.c
|
||||||
ifneq (,$(findstring arm,$(CAPSTONE_ARCHS)))
|
ifneq (,$(findstring arm,$(CAPSTONE_ARCHS)))
|
||||||
SOURCES += test_arm.c
|
SOURCES += test_arm.c
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
This directory contains some test code to show how to use Capstone API.
|
This directory contains some test code to show how to use Capstone API.
|
||||||
|
|
||||||
- test.c
|
- test_basic.c
|
||||||
This code shows the most simple form of API where we only want to get basic
|
This code shows the most simple form of API where we only want to get basic
|
||||||
information out of disassembled instruction, such as address, mnemonic and
|
information out of disassembled instruction, such as address, mnemonic and
|
||||||
operand string.
|
operand string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user