summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 000000000..cc2083861
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,70 @@
+#################################################
+#
+# (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
+)
+
+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( )
+