Fix report_basic test
[platform/core/system/crash-worker.git] / tests / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2
3 add_subdirectory(system)
4
5 # tests
6 INCLUDE(FindPkgConfig)
7
8 set(CMAKE_C_FLAGS_DEFAULT ${CMAKE_C_FLAGS})
9 set(CMAKE_C_FLAGS "")
10 set(CMAKE_C_FLAGS_CUSTOM "-g -O0 -fno-omit-frame-pointer -funwind-tables")
11 if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
12   set(CMAKE_C_FLAGS_CUSTOM "${CMAKE_C_FLAGS_CUSTOM} -marm")
13 endif ()
14
15 set(test1_suffixes sleep crash ill)
16 foreach(suffix ${test1_suffixes})
17   add_executable(test1-default-${suffix} test1.c)
18   set(DEFAULT_FLAGS_TARGETS test1-default-${suffix})
19
20   add_executable(test1-custom-${suffix} test1.c)
21   set(CUSTOM_FLAGS_TARGETS test1-custom-${suffix})
22 endforeach()
23
24
25 pkg_check_modules (GLIB2 glib-2.0)
26
27 configure_file(test2.c test2-custom.c COPYONLY)
28 add_executable(test2-custom test2-custom.c)
29 target_include_directories(test2-custom SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS})
30 target_link_libraries(test2-custom ${GLIB2_LDFLAGS})
31 list(APPEND CUSTOM_FLAGS_TARGETS test2-custom)
32
33 add_executable(test3-custom test3.c)
34 target_include_directories(test3-custom SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS})
35 target_link_libraries(test3-custom ${GLIB2_LDFLAGS} -lpthread)
36 list(APPEND CUSTOM_FLAGS_TARGETS test3-custom)
37
38 set_target_properties(${CUSTOM_FLAGS_TARGETS} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS_CUSTOM}")
39 set_target_properties(${DEFAULT_FLAGS_TARGETS} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS_DEFAULT}")
40
41 configure_file(run_tests.sh.in run_tests.sh @ONLY)
42 configure_file(tests_common.sh.in tests_common.sh @ONLY)
43 configure_file(crash_common.sh.in crash_common.sh @ONLY)
44
45 # Installing
46 foreach(suffix ${test1_suffixes})
47   install(TARGETS test1-default-${suffix} test1-custom-${suffix} DESTINATION ${CRASH_TESTS_PATH})
48 endforeach()
49
50 install(FILES run_tests.sh tests_common.sh crash_common.sh
51   DESTINATION ${CRASH_TESTS_PATH}
52         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
53         GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)