1 |
############################################ |
2 |
# |
3 |
# How to build bsdcpio_test |
4 |
# |
5 |
############################################ |
6 |
IF(ENABLE_CPIO AND ENABLE_TEST) |
7 |
SET(bsdcpio_test_SOURCES |
8 |
../cmdline.c |
9 |
../../libarchive_fe/err.c |
10 |
../../test_utils/test_utils.c |
11 |
main.c |
12 |
test.h |
13 |
test_0.c |
14 |
test_basic.c |
15 |
test_cmdline.c |
16 |
test_extract_cpio_Z |
17 |
test_extract_cpio_bz2 |
18 |
test_extract_cpio_grz |
19 |
test_extract_cpio_gz |
20 |
test_extract_cpio_lrz |
21 |
test_extract_cpio_lz |
22 |
test_extract_cpio_lz4 |
23 |
test_extract_cpio_lzma |
24 |
test_extract_cpio_lzo |
25 |
test_extract_cpio_xz |
26 |
test_format_newc.c |
27 |
test_gcpio_compat.c |
28 |
test_missing_file.c |
29 |
test_option_0.c |
30 |
test_option_B_upper.c |
31 |
test_option_C_upper.c |
32 |
test_option_J_upper.c |
33 |
test_option_L_upper.c |
34 |
test_option_Z_upper.c |
35 |
test_option_a.c |
36 |
test_option_b64encode.c |
37 |
test_option_c.c |
38 |
test_option_d.c |
39 |
test_option_f.c |
40 |
test_option_grzip.c |
41 |
test_option_help.c |
42 |
test_option_l.c |
43 |
test_option_lrzip.c |
44 |
test_option_lz4.c |
45 |
test_option_lzma.c |
46 |
test_option_lzop.c |
47 |
test_option_m.c |
48 |
test_option_passphrase.c |
49 |
test_option_t.c |
50 |
test_option_u.c |
51 |
test_option_uuencode.c |
52 |
test_option_version.c |
53 |
test_option_xz.c |
54 |
test_option_y.c |
55 |
test_option_z.c |
56 |
test_owner_parse.c |
57 |
test_passthrough_dotdot.c |
58 |
test_passthrough_reverse.c |
59 |
) |
60 |
|
61 |
# |
62 |
# Register target |
63 |
# |
64 |
ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) |
65 |
SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H) |
66 |
|
67 |
# |
68 |
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources. |
69 |
# |
70 |
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h |
71 |
${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES}) |
72 |
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES |
73 |
${CMAKE_CURRENT_BINARY_DIR}) |
74 |
|
75 |
# list.h has a line DEFINE_TEST(testname) for every |
76 |
# test. We can use that to define the tests for cmake by |
77 |
# defining a DEFINE_TEST macro and reading list.h in. |
78 |
MACRO (DEFINE_TEST _testname) |
79 |
ADD_TEST( |
80 |
NAME bsdcpio_${_testname} |
81 |
COMMAND bsdcpio_test -vv |
82 |
-p $<TARGET_FILE:bsdcpio> |
83 |
-r ${CMAKE_CURRENT_SOURCE_DIR} |
84 |
${_testname}) |
85 |
ENDMACRO (DEFINE_TEST _testname) |
86 |
|
87 |
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) |
88 |
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) |
89 |
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils) |
90 |
|
91 |
# Experimental new test handling |
92 |
ADD_CUSTOM_TARGET(run_bsdcpio_test |
93 |
COMMAND bsdcpio_test -p $<TARGET_FILE:bsdcpio> |
94 |
-r ${CMAKE_CURRENT_SOURCE_DIR}) |
95 |
ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) |
96 |
ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) |
97 |
ENDIF(ENABLE_CPIO AND ENABLE_TEST) |
98 |
|