1 # cmake <http://www.cmake.org> test file for SMSD
2 # Copyright (c) 2007 - 2010 Michal Cihar
3 # vim: expandtab sw=4 ts=4 sts=4 ft=cmake:
6 set(PSQL_HOST 127.0.0.1 CACHE STRING "Host to use for PostgreSQL tests")
7 set(PSQL_DATABASE smsd CACHE STRING "Database to use for PostgreSQL tests")
8 set(PSQL_USER smsd CACHE STRING "User to use for PostgreSQL tests")
9 set(PSQL_PASSWORD smsd CACHE STRING "Password to use for PostgreSQL tests")
11 set(MYSQL_HOST 127.0.0.1 CACHE STRING "Host to use for MySQL tests")
12 set(MYSQL_DATABASE smsd CACHE STRING "Database to use for MySQL tests")
13 set(MYSQL_USER smsd CACHE STRING "User to use for MySQL tests")
14 set(MYSQL_PASSWORD smsd CACHE STRING "Password to use for MySQL tests")
16 set(ODBC_DSN smsd CACHE STRING "ODBC data source name to use for MySQL tests")
18 configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/test-smsd.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/test-smsd.sh" ESCAPE_QUOTES)
19 configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/test-smsd-files-include.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/test-smsd-files-include.sh" ESCAPE_QUOTES)
21 macro(smsd_testsuite _driver)
22 # This test tests some functionality and setups environment
23 add_test("smsd-${_driver}" "${SH_BIN}" "${CMAKE_CURRENT_BINARY_DIR}/test-smsd.sh" "${_driver}")
24 set_tests_properties("smsd-${_driver}" PROPERTIES
25 FAIL_REGULAR_EXPRESSION "ERROR: ;ODBC diagnostics;DBI error ([^5]:|[0-9][^:]);Wrong;Process finished successfully;Process failed with exit status [^4]"
28 add_test("smsd-inject-${_driver}" "${CMAKE_CURRENT_BINARY_DIR}/gammu-smsd-inject${GAMMU_TEST_SUFFIX}" -c "${CMAKE_CURRENT_BINARY_DIR}/smsd-test-${_driver}/.smsdrc" TEXT 123465 -text "Lorem ipsum.")
29 set_tests_properties("smsd-inject-${_driver}" PROPERTIES
30 FAIL_REGULAR_EXPRESSION "DBI error;SQL failed;ODBC diagnostics"
32 add_test("smsd-inject-long-${_driver}" "${CMAKE_CURRENT_BINARY_DIR}/gammu-smsd-inject${GAMMU_TEST_SUFFIX}" -c "${CMAKE_CURRENT_BINARY_DIR}/smsd-test-${_driver}/.smsdrc" EMS 123465 -text "Mqukqirip ya konej eqniu rejropocejor hugiygydewl tfej nrupxujob xuemymiyliralj. Te tvyjuh qaxumur ibewfoiws zuucoz tdygu gelum L ejqigqesykl kya jdytbezy ucixh mqudemiywty nzihriduwlo yxylyujvghpv. Tiekoohunl dloijoda qelejocewu bfe bxuahadempivog. Ev mfegijox vleinley ewig qihopqu fafozmuvipc ernogtipeq acuoclzyv m poujhyerbjpipc vyq. Xty ljietenea ypep ti dik ela jozmyihipup xopujoqyjaw jojyuhietry mexykpih ysec yum zyhniet dezjiyup nuyryfsohnir Zeyoekemdoj tayqgh. Xvujuxy gysun dahyfecpetk uziyecz jogovxi fbypexsotn exymnomeatd ayiostiyvoxfy iqilo redvejf gfeypavlvaqu vfyjonytbug rgyxn siuybmulijub bxu xewz qisubevumxyzk ufuylehyzc. Nse xobq dfolizygqysj t bvowsyhyhyemim ovutpapeaempye giuuwbib.")
33 set_tests_properties("smsd-inject-long-${_driver}" PROPERTIES
34 FAIL_REGULAR_EXPRESSION "DBI error;SQL failed;ODBC diagnostics"
37 add_test("smsd-daemon-${_driver}" "${CMAKE_CURRENT_BINARY_DIR}/gammu-smsd${GAMMU_TEST_SUFFIX}" -c "${CMAKE_CURRENT_BINARY_DIR}/smsd-test-${_driver}/.smsdrc" -X 10 -p ${CMAKE_CURRENT_BINARY_DIR}/smsd-test-${_driver}/smsd.pid)
38 set_tests_properties("smsd-daemon-${_driver}" PROPERTIES
39 FAIL_REGULAR_EXPRESSION "DBI error;SQL failed;ODBC diagnostics"
42 endmacro(smsd_testsuite _driver)
44 if (LIBDBI_FOUND AND SH_BIN AND SQLITE_BIN AND SED_BIN)
45 smsd_testsuite("dbi-sqlite3")
46 endif (LIBDBI_FOUND AND SH_BIN AND SQLITE_BIN AND SED_BIN)
48 smsd_testsuite("files-unicode")
49 smsd_testsuite("files-standard")
50 smsd_testsuite("files-detail")
51 smsd_testsuite("null")
55 smsd_testsuite("mysql")
58 smsd_testsuite("dbi-mysql")
62 smsd_testsuite("odbc")
68 smsd_testsuite("pgsql")
70 smsd_testsuite("dbi-pgsql")
74 add_test("smsd-files-include-unicode" "${SH_BIN}" "${CMAKE_CURRENT_BINARY_DIR}/test-smsd-files-include.sh" unicode)
75 set_tests_properties("smsd-files-include-unicode" PROPERTIES
76 PASS_REGULAR_EXPRESSION ".999999999999999.4.3.0.100.42"
77 FAIL_REGULAR_EXPRESSION "ERROR: ;Wrong;Process failed with exit status"
80 foreach (PROGRAM gammu-smsd gammu-smsd-monitor gammu-smsd-inject)
81 add_test(${PROGRAM}-help "${CMAKE_CURRENT_BINARY_DIR}/${PROGRAM}${GAMMU_TEST_SUFFIX}" --help)
82 add_test(${PROGRAM}-version "${CMAKE_CURRENT_BINARY_DIR}/${PROGRAM}${GAMMU_TEST_SUFFIX}" --version)
83 set_tests_properties(${PROGRAM}-version PROPERTIES
84 PASS_REGULAR_EXPRESSION "${GAMMU_VERSION}"
86 add_test(${PROGRAM}-fail "${CMAKE_CURRENT_BINARY_DIR}/${PROGRAM}${GAMMU_TEST_SUFFIX}" --nonsense)
89 PROPERTIES WILL_FAIL TRUE)
90 endforeach (PROGRAM gammu-smsd gammu-smsd-monitor gammu-smsd-inject)