summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
blob: 92a8543d0344509b1339fac7b43131d1ab71a805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#################################################
#
#  (C) 2019 Michele Calgaro
#  michele (DOT) calgaro (AT) yahoo (DOT) it
#
#  Improvements and feedbacks are welcome
#
#  This file is released under GPL >= 3
#
#################################################

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${TDE_INCLUDE_DIR}
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_SOURCE_DIR}/core
  ${CMAKE_SOURCE_DIR}/gui
  ${CMAKE_SOURCE_DIR}/agent
)

set( link-polkit-tqt-test
  ${TQT_LIBRARIES}
  polkit-tqt-core-shared
  polkit-tqt-gui-shared
  polkit-tqt-agent-shared
)


### executable files

# These tests are executed automatically during build
set( _test_auto_executables
  test_details
  test_identity
  test_subject
)

# These executables are built but no automatic test is performed.
# To run these tests manually, a full polkit environment is needed
# and either the test is run as root or the file
# ${CMAKE_SOURCE_DIR}/examples/org.tqt.policykit.examples.policy
# needs to be copied to the /usr/share/polkit-1/actions folder first.
# If run as root, sudo is also required because the inner part of the
# tests need to be run as a non root user. A "testuser" user is created
# and removed during the test. To run a test, use the following commands:
# cd ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh <path/to/test_executable_file>
set( _test_manual_executables
  test_check_authorization
  test_auth_enum_actions
)

foreach( _test_name ${_test_auto_executables} )
  tde_add_check_executable( ${_test_name}
    SOURCES ${_test_name}.cpp AUTOMOC
    LINK ${link-polkit-tqt-test}
  )

  add_test( ${_test_name} ${_test_name} )
endforeach( )

foreach( _test_name ${_test_manual_executables} )
  tde_add_check_executable( ${_test_name}
    SOURCES ${_test_name}.cpp AUTOMOC
    LINK ${link-polkit-tqt-test}
  )
endforeach( )