Navigation


source: freeDiameter/tests/CMakeLists.txt @ 733:b2bc31410425

1.1.0-rc3
Last change on this file since 733:b2bc31410425 was 733:b2bc31410425, checked in by Sebastien Decugis <sdecugis@nict.go.jp>, 11 years ago

Cosmetics

File size: 2.9 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: 120)?")
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        testostr
16        testdict
17        testmesg
18        testfifo
19        testsess
20        testdisp
21        testcnx
22        testloadext
23)
24
25#############################
26# Some parameters for the tests
27
28ADD_DEFINITIONS(-DTEST_DEBUG)
29ADD_DEFINITIONS(-DTRACE_LEVEL=NONE)
30ADD_DEFINITIONS(-DBUILD_DIR="${CMAKE_BINARY_DIR}")
31
32INCLUDE_DIRECTORIES( "../libfdproto" )
33INCLUDE_DIRECTORIES( "../libfdcore" )
34INCLUDE_DIRECTORIES(${LFDCORE_INCLUDES})
35
36
37SET(testcnx_ADDITIONAL_LIB  ${CLOCK_GETTIME_LIBS})
38SET(testfifo_ADDITIONAL_LIB ${CLOCK_GETTIME_LIBS})
39SET(testsess_ADDITIONAL_LIB ${CLOCK_GETTIME_LIBS})
40SET(testloadext_ADDITIONAL_LIB ${CMAKE_DL_LIBS})
41
42##############################
43# App_acct test
44
45IF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
46        OPTION(TEST_APP_ACCT "Test app_acct extension? (Requires a configured database, see testappacct.c for details)" OFF)
47        IF(TEST_APP_ACCT)
48       
49                OPTION(TEST_APP_ACCT_CONNINFO "The connection string to the database")
50                IF(TEST_APP_ACCT_CONNINFO)
51                        ADD_DEFINITIONS(-DTEST_CONNINFO="${TEST_APP_ACCT_CONNINFO}")
52                ENDIF(TEST_APP_ACCT_CONNINFO)
53       
54                SET(TEST_LIST ${TEST_LIST} testappacct)
55
56                # Extension dependencies
57                FIND_PACKAGE(PostgreSQL REQUIRED)
58                INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
59                SET(testappacct_ADDITIONAL_LIB ${POSTGRESQL_LIBRARIES})
60
61                # List of source files, copied from the extension CMakeLists.
62                BISON_FILE(../extensions/app_acct/acct_conf.y)
63                FLEX_FILE(../extensions/app_acct/acct_conf.l)
64                #SET_SOURCE_FILES_PROPERTIES(lex.acct_conf.c acct_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
65               
66                SET( APP_ACCT_SRC
67                        app_acct.h
68                        app_acct.c
69                        acct_db.c
70                        acct_records.c
71                )
72                SET( APP_ACCT_SRC_GEN
73                        lex.acct_conf.c
74                        acct_conf.tab.c
75                        acct_conf.tab.h
76                )
77
78                # The extension headers
79                INCLUDE_DIRECTORIES( "../extensions/app_acct" )
80
81                SET(testappacct_ADDITIONAL "")
82
83                FOREACH( SRC_FILE ${APP_ACCT_SRC})
84                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "../extensions/app_acct/${SRC_FILE}")
85                ENDFOREACH(SRC_FILE)
86
87                FOREACH( SRC_FILE ${APP_ACCT_SRC_GEN})
88                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "${CMAKE_CURRENT_BINARY_DIR}/../extensions/app_acct/${SRC_FILE}")
89                ENDFOREACH(SRC_FILE)
90
91        ENDIF(TEST_APP_ACCT)
92ENDIF(BUILD_APP_ACCT OR ALL_EXTENSIONS)
93
94
95#############################
96# Compile each test
97FOREACH( TEST ${TEST_LIST} )
98   ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
99   TARGET_LINK_LIBRARIES(${TEST} libfdproto libfdcore ${GNUTLS_LIBRARIES} ${GCRYPT_LIBRARY} ${${TEST}_ADDITIONAL_LIB})
100   ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
101ENDFOREACH( TEST )
102
103
104####
105## INSTALL section ##
106
107# we do not install the tests
Note: See TracBrowser for help on using the repository browser.