Navigation


source: freeDiameter/freeDiameter/tests/CMakeLists.txt @ 585:4d7872860080

Last change on this file since 585:4d7872860080 was 585:4d7872860080, checked in by Sebastien Decugis <sdecugis@nict.go.jp>, 3 years ago

Add test_app_acct when ALL_EXTENSIONS is specified

File size: 3.1 KB
Line 
1# Test directory
2PROJECT("libfreeDiameter 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( ".." )
31INCLUDE_DIRECTORIES( "../../libfreeDiameter" )
32
33BISON_FILE(../fdd.y)
34FLEX_FILE(../fdd.l)
35
36SET(TEST_COMMON_SRC "")
37
38FOREACH( SRC_FILE ${FD_COMMON_SRC})
39   SET(TEST_COMMON_SRC ${TEST_COMMON_SRC} "../${SRC_FILE}")
40ENDFOREACH(SRC_FILE)
41
42FOREACH( SRC_FILE ${FD_COMMON_GEN_SRC})
43   SET(TEST_COMMON_SRC ${TEST_COMMON_SRC} "${CMAKE_CURRENT_BINARY_DIR}/../${SRC_FILE}")
44ENDFOREACH(SRC_FILE)
45
46FOREACH( SRC_FILE ${LFD_SRC})
47   SET(TEST_COMMON_SRC ${TEST_COMMON_SRC} "../../libfreeDiameter/${SRC_FILE}")
48ENDFOREACH(SRC_FILE)
49
50# Create an archive with the daemon common files (all but main)
51ADD_LIBRARY(fDcore STATIC ${TEST_COMMON_SRC})
52
53
54##############################
55# App_acct test
56
57IF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
58        OPTION(TEST_APP_ACCT "Test app_acct extension? (Requires a configured database, see testappacct.c for details)" OFF)
59        IF(TEST_APP_ACCT)
60       
61                OPTION(TEST_APP_ACCT_CONNINFO "The connection string to the database")
62                IF(TEST_APP_ACCT_CONNINFO)
63                        ADD_DEFINITIONS(-DTEST_CONNINFO="${TEST_APP_ACCT_CONNINFO}")
64                ENDIF(TEST_APP_ACCT_CONNINFO)
65       
66                SET(TEST_LIST ${TEST_LIST} testappacct)
67
68                # Extension dependencies
69                FIND_PACKAGE(PostgreSQL REQUIRED)
70                INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
71                SET(testappacct_ADDITIONAL_LIB ${POSTGRESQL_LIBRARIES})
72
73                # List of source files, copied from the extension CMakeLists.
74                BISON_FILE(../../extensions/app_acct/acct_conf.y)
75                FLEX_FILE(../../extensions/app_acct/acct_conf.l)
76                #SET_SOURCE_FILES_PROPERTIES(lex.acct_conf.c acct_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
77               
78                SET( APP_ACCT_SRC
79                        app_acct.h
80                        app_acct.c
81                        acct_db.c
82                        acct_records.c
83                )
84                SET( APP_ACCT_SRC_GEN
85                        lex.acct_conf.c
86                        acct_conf.tab.c
87                        acct_conf.tab.h
88                )
89
90                # The extension headers
91                INCLUDE_DIRECTORIES( "../../extensions/app_acct" )
92
93                SET(testappacct_ADDITIONAL "")
94
95                FOREACH( SRC_FILE ${APP_ACCT_SRC})
96                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "../../extensions/app_acct/${SRC_FILE}")
97                ENDFOREACH(SRC_FILE)
98
99                FOREACH( SRC_FILE ${APP_ACCT_SRC_GEN})
100                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "${CMAKE_CURRENT_BINARY_DIR}/../../extensions/app_acct/${SRC_FILE}")
101                ENDFOREACH(SRC_FILE)
102
103        ENDIF(TEST_APP_ACCT)
104ENDIF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
105
106
107#############################
108# Compile each test
109FOREACH( TEST ${TEST_LIST} )
110   ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
111   TARGET_LINK_LIBRARIES(${TEST} fDcore ${FD_LIBS} ${LFD_LIBS} ${${TEST}_ADDITIONAL_LIB})
112   ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
113ENDFOREACH( TEST )
114
115
116####
117## INSTALL section ##
118
119# we do not install the tests
Note: See TracBrowser for help on using the repository browser.