1
############################################
3
# How to build bsdcpio_test
5
############################################
6
IF(ENABLE_CPIO AND ENABLE_TEST)
7
SET(bsdcpio_test_SOURCES
9
../../libarchive_fe/err.c
10
../../libarchive_fe/pathmatch.c
37
test_passthrough_dotdot.c
38
test_passthrough_reverse.c
41
IF(WIN32 AND NOT CYGWIN)
42
LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h)
43
ENDIF(WIN32 AND NOT CYGWIN)
48
ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES})
49
SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H)
52
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
54
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
55
${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES})
56
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
57
${CMAKE_CURRENT_BINARY_DIR})
59
# list.h has a line DEFINE_TEST(testname) for every
60
# test. We can use that to define the tests for cmake by
61
# defining a DEFINE_TEST macro and reading list.h in.
62
MACRO (DEFINE_TEST _testname)
64
NAME bsdcpio_${_testname}
65
COMMAND bsdcpio_test -vv
66
-p $<TARGET_FILE:bsdcpio>
67
-r ${CMAKE_CURRENT_SOURCE_DIR}
69
ENDMACRO (DEFINE_TEST _testname)
71
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
73
# Experimental new test handling
74
ADD_CUSTOM_TARGET(run_bsdcpio_test
75
COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR})
76
ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio)
77
ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test)
78
ENDIF(ENABLE_CPIO AND ENABLE_TEST)