Navigation


source: freeDiameter/tests/CMakeLists.txt @ 667:1f7c7ce85db3

Last change on this file since 667:1f7c7ce85db3 was 667:1f7c7ce85db3, checked in by Sebastien Decugis <sdecugis@nict.go.jp>, 2 years ago

More cleanups in the CMakeLists files

File size: 2.6 KB
Line 
1# Test directory
2PROJECT("freeDiameter tests" C)
3
4# give the possibility to configure the timeout duration for the tests
5OPTION(TEST_TIMEOUT "Timeout for the tests, in seconds (default: 5)?")
6IF(TEST_TIMEOUT)
7        ADD_DEFINITIONS(-DTEST_TIMEOUT=${TEST_TIMEOUT})
8ENDIF(TEST_TIMEOUT)
9
10
11#############################
12# List the test cases
13SET(TEST_LIST
14        testsctp
15        testlist
16        testdict
17        testmesg
18        testfifo
19        testsess
20        testdisp
21        testcnx
22)
23
24#############################
25# Some parameters for the tests
26
27ADD_DEFINITIONS(-DTEST_DEBUG)
28ADD_DEFINITIONS(-DTRACE_LEVEL=NONE)
29
30INCLUDE_DIRECTORIES( "../libfdproto" )
31INCLUDE_DIRECTORIES( "../libfdcore" )
32INCLUDE_DIRECTORIES(${LFDCORE_INCLUDES})
33
34
35##############################
36# App_acct test
37
38IF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
39        OPTION(TEST_APP_ACCT "Test app_acct extension? (Requires a configured database, see testappacct.c for details)" OFF)
40        IF(TEST_APP_ACCT)
41       
42                OPTION(TEST_APP_ACCT_CONNINFO "The connection string to the database")
43                IF(TEST_APP_ACCT_CONNINFO)
44                        ADD_DEFINITIONS(-DTEST_CONNINFO="${TEST_APP_ACCT_CONNINFO}")
45                ENDIF(TEST_APP_ACCT_CONNINFO)
46       
47                SET(TEST_LIST ${TEST_LIST} testappacct)
48
49                # Extension dependencies
50                FIND_PACKAGE(PostgreSQL REQUIRED)
51                INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
52                SET(testappacct_ADDITIONAL_LIB ${POSTGRESQL_LIBRARIES})
53
54                # List of source files, copied from the extension CMakeLists.
55                BISON_FILE(../extensions/app_acct/acct_conf.y)
56                FLEX_FILE(../extensions/app_acct/acct_conf.l)
57                #SET_SOURCE_FILES_PROPERTIES(lex.acct_conf.c acct_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
58               
59                SET( APP_ACCT_SRC
60                        app_acct.h
61                        app_acct.c
62                        acct_db.c
63                        acct_records.c
64                )
65                SET( APP_ACCT_SRC_GEN
66                        lex.acct_conf.c
67                        acct_conf.tab.c
68                        acct_conf.tab.h
69                )
70
71                # The extension headers
72                INCLUDE_DIRECTORIES( "../extensions/app_acct" )
73
74                SET(testappacct_ADDITIONAL "")
75
76                FOREACH( SRC_FILE ${APP_ACCT_SRC})
77                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "../extensions/app_acct/${SRC_FILE}")
78                ENDFOREACH(SRC_FILE)
79
80                FOREACH( SRC_FILE ${APP_ACCT_SRC_GEN})
81                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "${CMAKE_CURRENT_BINARY_DIR}/../extensions/app_acct/${SRC_FILE}")
82                ENDFOREACH(SRC_FILE)
83
84        ENDIF(TEST_APP_ACCT)
85ENDIF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
86
87
88#############################
89# Compile each test
90FOREACH( TEST ${TEST_LIST} )
91   ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
92   TARGET_LINK_LIBRARIES(${TEST} libfdproto libfdcore ${${TEST}_ADDITIONAL_LIB})
93   ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
94ENDFOREACH( TEST )
95
96
97####
98## INSTALL section ##
99
100# we do not install the tests
Note: See TracBrowser for help on using the repository browser.