diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-01-05 16:01:20 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-01-16 15:41:03 (GMT) |
commit | 5cef3c61fc815393248762c14ba1878aae68394d (patch) | |
tree | f50de502f49e9c7dc43ec2195d3951a955cf4399 /Tests/GhsMulti/GhsMultiCompilerOptions | |
parent | a42e40e78dc3d9c4289a3c9640cae94ecd034373 (diff) | |
download | CMake-5cef3c61fc815393248762c14ba1878aae68394d.zip CMake-5cef3c61fc815393248762c14ba1878aae68394d.tar.gz CMake-5cef3c61fc815393248762c14ba1878aae68394d.tar.bz2 |
GHS: Update test suite
-- Update test suite so that CMake can use multiple toolsets
CMake_TEST_GreenHillsMULTI_config
ghs_config_name
ghs_target_arch
ghs_tools
ghs_toolset_name
ghs_os_root
ghs_os_dir
ghs_target_platform
ghs_bsp_name
-- Change ARM Integrity test to generic Integrity test
Add Monolithic build test
-- Add other GHS generator tests
Diffstat (limited to 'Tests/GhsMulti/GhsMultiCompilerOptions')
-rw-r--r-- | Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt | 94 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in | 28 | ||||
-rw-r--r-- | Tests/GhsMulti/GhsMultiCompilerOptions/test.c | 4 |
3 files changed, 126 insertions, 0 deletions
diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt new file mode 100644 index 0000000..1436cbb --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt @@ -0,0 +1,94 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src +) + +message("Building project") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test + CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} + -DGHS_OS_ROOT=${GHS_OS_ROOT} + -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} + -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + -DRUN_TEST=${RUN_TEST} + -DCMAKE_BUILD_TYPE=${RUN_TEST_BUILD_TYPE} + OUTPUT_VARIABLE OUTPUT) + +message("Output from build:\n${OUTPUT}") +if (RUN_TEST STREQUAL "RELEASE_FLAGS") + find_file (fileName test_none.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/test_none + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-unexpected_release_option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( NOT opt_found EQUAL -1 ) + message(SEND_ERROR "Release option found: ${opt}") + endif() +else() + unset(fileName CACHE) + find_file (fileName K1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K2.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K2 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K3.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K3 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K4.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K4 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in new file mode 100644 index 0000000..d425631 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in @@ -0,0 +1,28 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if(RUN_TEST STREQUAL "RELEASE_FLAGS") +#RELEASE flags used when CMAKE_BUILD_TYPE is undefined +string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") +add_executable(test_none test.c) +endif() + +if(RUN_TEST STREQUAL "KERNEL_FLAGS") +#DEBUG flag missing when -kernel is added as a compile option +string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option") + +add_executable(K1 test.c) + +add_executable(K2 test.c) +target_compile_options(K2 PRIVATE -kernel) + +add_executable(K3 test.c) +target_compile_options(K3 PRIVATE -kernel=fast) + +add_executable(K4 test.c) +target_link_options(K4 PRIVATE -kernel) +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/test.c b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c new file mode 100644 index 0000000..95f2e8e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c @@ -0,0 +1,4 @@ +int main(void) +{ + return -1; +} |