1# Copyright (c) 2014-2015, Intel Corporation
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without modification,
5# are permitted provided that the following conditions are met:
6#
7# 1. Redistributions of source code must retain the above copyright notice, this
8# list of conditions and the following disclaimer.
9#
10# 2. Redistributions in binary form must reproduce the above copyright notice,
11# this list of conditions and the following disclaimer in the documentation and/or
12# other materials provided with the distribution.
13#
14# 3. Neither the name of the copyright holder nor the names of its contributors
15# may be used to endorse or promote products derived from this software without
16# specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29# This test suite relies on remote-process - which isn't available when
30# networking is disabled
31if(BUILD_TESTING AND NETWORKING)
32    find_package(PythonInterp 2 REQUIRED)
33
34    set(PFW_ROOT ${PROJECT_BINARY_DIR}/tmp/test-parameters)
35    set(PFW_RESULT ${PFW_ROOT}/result)
36
37    configure_file(
38        ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Structure/Test/TestSubsystem.xml.in
39        ${PFW_ROOT}/xml/configuration/Structure/Test/TestSubsystem.xml @ONLY)
40    configure_file(
41        ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Structure/Test/TestClass.xml
42        ${PFW_ROOT}/xml/configuration/Structure/Test/TestClass.xml
43        COPYONLY)
44    configure_file(
45        ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/ParameterFrameworkConfiguration.xml
46        ${PFW_ROOT}/xml/configuration/ParameterFrameworkConfiguration.xml
47        COPYONLY)
48    configure_file(
49        ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Settings/Test/TestConfigurableDomains.xml
50        ${PFW_ROOT}/xml/configuration/Settings/Test/TestConfigurableDomains.xml
51        COPYONLY)
52    file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ACTCampaignEngine.py DESTINATION ${PFW_ROOT}/)
53    file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/PfwTestCase DESTINATION ${PFW_ROOT}/)
54    file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Util DESTINATION ${PFW_ROOT}/)
55    file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xml/XML_Test DESTINATION ${PFW_ROOT}/xml/)
56
57    add_test(NAME functional-test-legacy
58             WORKING_DIRECTORY ${PFW_ROOT}
59             COMMAND ${PYTHON_EXECUTABLE} ${PFW_ROOT}/ACTCampaignEngine.py)
60
61    # Custom function defined in the top-level CMakeLists
62    set_test_env(functional-test-legacy)
63    set_property(TEST functional-test-legacy APPEND PROPERTY ENVIRONMENT
64                 PFW_ROOT=${PFW_ROOT}
65                 PFW_RESULT=${PFW_RESULT}
66                 PFW_SCHEMAS=${PROJECT_SOURCE_DIR}/schemas)
67endif()
68