wayland-ivi-extension: Build unit test apps 55/4155/2
authorMikhail Durnev <mikhail_durnev@mentor.com>
Tue, 20 Oct 2015 10:57:57 +0000 (20:57 +1000)
committerMikhail Durnev <mikhail_durnev@mentor.com>
Fri, 23 Oct 2015 03:23:27 +0000 (13:23 +1000)
The wayland-ivi-extension package provides unit test applications.
The recipe was modified to build those apps and install them on the target
in a separate ipk/rpm package.
The test apps are not compatible with ptest. Ctest is required to run them
on the target.

Change-Id: I937fde52eafc20f38ab7c8ff2d2981cc4f836f33
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
recipes-graphics/wayland/wayland-ivi-extension/cmake-find-gtest.patch [new file with mode: 0644]
recipes-graphics/wayland/wayland-ivi-extension/test-path.patch [new file with mode: 0644]
recipes-graphics/wayland/wayland-ivi-extension_1.5.0.bbappend

diff --git a/recipes-graphics/wayland/wayland-ivi-extension/cmake-find-gtest.patch b/recipes-graphics/wayland/wayland-ivi-extension/cmake-find-gtest.patch
new file mode 100644 (file)
index 0000000..5371174
--- /dev/null
@@ -0,0 +1,22 @@
+diff -Naur old/ivi-input-api/test/CMakeLists.txt new/ivi-input-api/test/CMakeLists.txt
+--- old/ivi-input-api/test/CMakeLists.txt      2015-10-19 23:31:13.000000000 +1000
++++ new/ivi-input-api/test/CMakeLists.txt      2015-10-19 23:30:32.000000000 +1000
+@@ -18,6 +18,7 @@
+ ############################################################################
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
++SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules)
+ FIND_PACKAGE(gtest)
+diff -Naur old/ivi-layermanagement-api/test/CMakeLists.txt new/ivi-layermanagement-api/test/CMakeLists.txt
+--- old/ivi-layermanagement-api/test/CMakeLists.txt    2015-10-19 23:31:20.000000000 +1000
++++ new/ivi-layermanagement-api/test/CMakeLists.txt    2015-10-19 23:30:48.000000000 +1000
+@@ -18,6 +18,7 @@
+ ############################################################################
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
++SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules)
+ FIND_PACKAGE(gtest)
diff --git a/recipes-graphics/wayland/wayland-ivi-extension/test-path.patch b/recipes-graphics/wayland/wayland-ivi-extension/test-path.patch
new file mode 100644 (file)
index 0000000..9de5018
--- /dev/null
@@ -0,0 +1,46 @@
+diff -Naur old/ivi-input-api/test/CMakeLists.txt new/ivi-input-api/test/CMakeLists.txt
+--- old/ivi-input-api/test/CMakeLists.txt      2015-10-20 00:25:36.000000000 +1000
++++ new/ivi-input-api/test/CMakeLists.txt      2015-10-20 17:57:45.000000000 +1000
+@@ -66,14 +66,15 @@
+     ADD_DEPENDENCIES(${PROJECT_NAME} ${LIBS})
+     IF(INSTALL_ILM_API_TESTS)
+-        INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
++        INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/test)
++        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/test/ivi-input-api)
+     ENDIF()
+     # use CTest
+     ENABLE_TESTING()
+-    ADD_TEST(ilmCommon  ${PROJECT_NAME})
+-    ADD_TEST(ilmClient  ${PROJECT_NAME})
+-    ADD_TEST(ilmControl ${PROJECT_NAME})
+-    ADD_TEST(ilmInput ${PROJECT_NAME})
++    ADD_TEST(ilmCommon  ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
++    ADD_TEST(ilmClient  ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
++    ADD_TEST(ilmControl ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
++    ADD_TEST(ilmInput ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
+ ENDIF()
+diff -Naur old/ivi-layermanagement-api/test/CMakeLists.txt new/ivi-layermanagement-api/test/CMakeLists.txt
+--- old/ivi-layermanagement-api/test/CMakeLists.txt    2015-10-20 00:25:36.000000000 +1000
++++ new/ivi-layermanagement-api/test/CMakeLists.txt    2015-10-20 17:57:24.000000000 +1000
+@@ -64,13 +64,14 @@
+     ADD_DEPENDENCIES(${PROJECT_NAME} ${LIBS})
+     IF(INSTALL_ILM_API_TESTS)
+-        INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
++        INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/test)
++        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/test/ivi-layermanagement-api)
+     ENDIF()
+     # use CTest
+     ENABLE_TESTING()
+-    ADD_TEST(ilmCommon  ${PROJECT_NAME})
+-    ADD_TEST(ilmClient  ${PROJECT_NAME})
+-    ADD_TEST(ilmControl ${PROJECT_NAME})
++    ADD_TEST(ilmCommon  ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
++    ADD_TEST(ilmClient  ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
++    ADD_TEST(ilmControl ${CMAKE_INSTALL_LIBEXECDIR}/test/${PROJECT_NAME})
+ ENDIF() 
index f30bf7f..da97895 100644 (file)
@@ -1,5 +1,28 @@
 FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
 
+ENABLE_TEST = "-DBUILD_ILM_API_TESTS:BOOL=TRUE \
+    -DINSTALL_ILM_API_TESTS:BOOL=TRUE \
+    "
+
+DISABLE_TEST = "-DBUILD_ILM_API_TESTS:BOOL=FALSE \
+    -DINSTALL_ILM_API_TESTS:BOOL=FALSE \
+    "
+
+PACKAGECONFIG ??= "test"
+PACKAGECONFIG[test] = "${ENABLE_TEST},${DISABLE_TEST},gtest"
+
 SRC_URI_append = "\
     file://0001-wayland-ivi-extension-patch-for-wl-shell-emulator.patch \
+    file://cmake-find-gtest.patch \
+    file://test-path.patch \
     "
+
+PACKAGES =+ "${PN}-test"
+
+FILES_${PN}-test = "${libdir}/${PN}/test/*/CTestTestfile.cmake \
+    ${libdir}/${PN}/test/ivi-layermanagement-api-test \
+    ${libdir}/${PN}/test/ivi-input-api-test \
+    "
+FILES_${PN}-dbg += "${libdir}/${PN}/test/.debug"
+
+RDEPENDS_${PN}-test += "cmake"