[kdoctools] /: Convert manual install test to an autotest

Ralf Habacker null at kde.org
Tue Aug 14 15:06:52 BST 2018


Git commit f0cc8b2ccb4ac0207a683f6db11ff653b446eb00 by Ralf Habacker.
Committed on 14/08/2018 at 14:06.
Pushed by habacker into branch 'master'.

Convert manual install test to an autotest

The test is intended to find hidden issues on installation
e.g. in related macro file similar to what was added
to ki18n (see D13743)

Reviewed By: ltoscano
Differential Revision: https://phabricator.kde.org/D14817

M  +8    -5    CMakeLists.txt
M  +4    -2    KF5DocToolsConfig.cmake.in
M  +14   -0    autotests/CMakeLists.txt
A  +11   -0    autotests/kdoctools-install/CMakeLists.txt
R  +0    -0    autotests/kdoctools-install/po/es/docs/foobar/index.docbook [from: tests/kdoctools_install-test/po/es/docs/foobar/index.docbook - 100% similarity]
R  +0    -0    autotests/kdoctools-install/po/es/docs/kioslave5/fooslave/index.docbook [from: tests/kdoctools_install-test/po/es/docs/kioslave5/fooslave/index.docbook - 100% similarity]
R  +0    -0    autotests/kdoctools-install/po/es/docs/man-kjscmd.1.docbook [from: tests/kdoctools_install-test/po/es/docs/man-kjscmd.1.docbook - 100% similarity]
R  +0    -0    autotests/kdoctools-install/po/fr/docs/foobar/index.docbook [from: tests/kdoctools_install-test/po/fr/docs/foobar/index.docbook - 100% similarity]
R  +0    -0    autotests/kdoctools-install/po/fr/docs/man-kjscmd.1.docbook [from: tests/kdoctools_install-test/po/fr/docs/man-kjscmd.1.docbook - 100% similarity]
A  +24   -0    autotests/kdoctools-install/test.cmake

https://commits.kde.org/kdoctools/f0cc8b2ccb4ac0207a683f6db11ff653b446eb00

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1386593..47c21d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(GenerateExportHeader)
 
 ecm_setup_version(PROJECT VARIABLE_PREFIX KDOCTOOLS
                         VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdoctools_version.h"
-                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5DocToolsConfigVersion.cmake"
+                        PACKAGE_VERSION_FILE "${CMAKE_BINARY_DIR}/cmake/KF5DocToolsConfigVersion.cmake"
                         SOVERSION 5)
 
 option(MEINPROC_NO_KARCHIVE "Compile meinproc without KArchive dependency. Only for internal usage on KDE infrastructure." OFF)
@@ -102,18 +102,21 @@ if (BUILD_TESTING)
     add_subdirectory(autotests)
 endif()
 
-install(EXPORT KF5DocToolsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5DocToolsTargets.cmake NAMESPACE KF5:: )
+export(EXPORT KF5DocToolsTargets FILE ${CMAKE_BINARY_DIR}/cmake/KF5DocToolsTargets.cmake NAMESPACE KF5::)
+install(FILES ${CMAKE_BINARY_DIR}/cmake/KF5DocToolsTargets.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}")
+
 configure_package_config_file(
   "${CMAKE_CURRENT_SOURCE_DIR}/KF5DocToolsConfig.cmake.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/KF5DocToolsConfig.cmake"
+  "${CMAKE_BINARY_DIR}/cmake/KF5DocToolsConfig.cmake"
   PATH_VARS
     KDE_INSTALL_DATADIR_KF5
   INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
 )
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/KF5DocToolsMacros.cmake ${CMAKE_BINARY_DIR}/cmake/KF5DocToolsMacros.cmake COPYONLY)
 
 install(FILES
-  "${CMAKE_CURRENT_BINARY_DIR}/KF5DocToolsConfig.cmake"
-  "${CMAKE_CURRENT_BINARY_DIR}/KF5DocToolsConfigVersion.cmake"
+  "${CMAKE_BINARY_DIR}/cmake/KF5DocToolsConfig.cmake"
+  "${CMAKE_BINARY_DIR}/cmake/KF5DocToolsConfigVersion.cmake"
   DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
   COMPONENT Devel
 )
diff --git a/KF5DocToolsConfig.cmake.in b/KF5DocToolsConfig.cmake.in
index e93a3a9..85061bf 100644
--- a/KF5DocToolsConfig.cmake.in
+++ b/KF5DocToolsConfig.cmake.in
@@ -1,7 +1,9 @@
 @PACKAGE_INIT@
 
-set(KDOCTOOLS_DATA_INSTALL_DIR "@PACKAGE_KDE_INSTALL_DATADIR_KF5@")
-set(KDOCTOOLS_CUSTOMIZATION_DIR "${KDOCTOOLS_DATA_INSTALL_DIR}/kdoctools/customization")
+if (NOT KDOCTOOLS_CUSTOMIZATION_DIR)
+    set(KDOCTOOLS_DATA_INSTALL_DIR "@PACKAGE_KDE_INSTALL_DATADIR_KF5@")
+    set(KDOCTOOLS_CUSTOMIZATION_DIR "${KDOCTOOLS_DATA_INSTALL_DIR}/kdoctools/customization")
+endif()
 
 include("${CMAKE_CURRENT_LIST_DIR}/KF5DocToolsTargets.cmake")
 
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 22a7c32..edc8fbd 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -4,3 +4,17 @@ add_test(
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 )
 
+add_test(kdoctools_install ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMAKE_CURRENT_SOURCE_DIR}/kdoctools-install"
+    "${CMAKE_CURRENT_BINARY_DIR}/kdoctools-install"
+    --build-generator ${CMAKE_GENERATOR}
+    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
+    --build-target install
+    --build-options
+        "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}"
+        "-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/kdoctools-install/destdir"
+        "-DKF5DocTools_DIR=${CMAKE_BINARY_DIR}/cmake"
+        "-DKDOCTOOLS_CUSTOMIZATION_DIR=${KDOCTOOLS_CUSTOMIZATION_DIR}"
+        "-DKDOCTOOLS_ENABLE_HTMLHANDBOOK=1"
+    --test-command ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_SOURCE_DIR}/kdoctools-install/test.cmake")
diff --git a/autotests/kdoctools-install/CMakeLists.txt b/autotests/kdoctools-install/CMakeLists.txt
new file mode 100644
index 0000000..9b1f794
--- /dev/null
+++ b/autotests/kdoctools-install/CMakeLists.txt
@@ -0,0 +1,11 @@
+project(kdoctools_install)
+cmake_minimum_required(VERSION 2.8)
+
+find_package(ECM NO_MODULE)
+# required by KF5DocToolsMacros
+include(KDEInstallDirs)
+
+find_package(KF5DocTools REQUIRED)
+
+add_subdirectory(../../docs docs)
+kdoctools_install(po)
diff --git a/tests/kdoctools_install-test/po/es/docs/foobar/index.docbook b/autotests/kdoctools-install/po/es/docs/foobar/index.docbook
similarity index 100%
rename from tests/kdoctools_install-test/po/es/docs/foobar/index.docbook
rename to autotests/kdoctools-install/po/es/docs/foobar/index.docbook
diff --git a/tests/kdoctools_install-test/po/es/docs/kioslave5/fooslave/index.docbook b/autotests/kdoctools-install/po/es/docs/kioslave5/fooslave/index.docbook
similarity index 100%
rename from tests/kdoctools_install-test/po/es/docs/kioslave5/fooslave/index.docbook
rename to autotests/kdoctools-install/po/es/docs/kioslave5/fooslave/index.docbook
diff --git a/tests/kdoctools_install-test/po/es/docs/man-kjscmd.1.docbook b/autotests/kdoctools-install/po/es/docs/man-kjscmd.1.docbook
similarity index 100%
rename from tests/kdoctools_install-test/po/es/docs/man-kjscmd.1.docbook
rename to autotests/kdoctools-install/po/es/docs/man-kjscmd.1.docbook
diff --git a/tests/kdoctools_install-test/po/fr/docs/foobar/index.docbook b/autotests/kdoctools-install/po/fr/docs/foobar/index.docbook
similarity index 100%
rename from tests/kdoctools_install-test/po/fr/docs/foobar/index.docbook
rename to autotests/kdoctools-install/po/fr/docs/foobar/index.docbook
diff --git a/tests/kdoctools_install-test/po/fr/docs/man-kjscmd.1.docbook b/autotests/kdoctools-install/po/fr/docs/man-kjscmd.1.docbook
similarity index 100%
rename from tests/kdoctools_install-test/po/fr/docs/man-kjscmd.1.docbook
rename to autotests/kdoctools-install/po/fr/docs/man-kjscmd.1.docbook
diff --git a/autotests/kdoctools-install/test.cmake b/autotests/kdoctools-install/test.cmake
new file mode 100644
index 0000000..5a3fffe
--- /dev/null
+++ b/autotests/kdoctools-install/test.cmake
@@ -0,0 +1,24 @@
+# check presence of installed files
+set(MANPATH destdir/share/man)
+set(HTMLPATH destdir/share/doc/HTML)
+set(FILES
+# from kdoctools_install
+    ${MANPATH}/man1/checkXML5.1
+    ${MANPATH}/man1/meinproc5.1
+    ${MANPATH}/man7/kf5options.7
+    ${MANPATH}/man7/qt5options.7
+# from add_subdirectory
+    ${MANPATH}/es/man1/kjscmd.1
+    ${MANPATH}/fr/man1/kjscmd.1
+    ${HTMLPATH}/fr/foobar/index.cache.bz2
+    ${HTMLPATH}/es/foobar/index.cache.bz2
+    ${HTMLPATH}/es/kioslave5/fooslave/index.cache.bz2
+)
+
+foreach(f ${FILES})
+    if(NOT EXISTS ${f})
+        message(SEND_ERROR "${f} was not found")
+    else()
+        message(STATUS "found installed file ${f}")
+    endif()
+endforeach()


More information about the kde-doc-english mailing list