]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/nowide/test/test_iostream_passthrough.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / nowide / test / test_iostream_passthrough.cmake
CommitLineData
1e59de90
TL
1# Copyright 2019 - 2021 Alexander Grund
2# Distributed under the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)
4
5if(NOT DEFINED TEST_BINARY)
6 if(CMAKE_ARGC GREATER 3)
7 # cmake(0) -P(1) <script>(2) <first arg>(3)
8 set(TEST_BINARY ${CMAKE_ARGV3})
9 else()
10 message(FATAL_ERROR "You need to define TEST_BINARY with the path to the binary")
11 endif()
12endif()
13
14set(msg "Hello Boost Nowide")
15
16execute_process(
17 COMMAND ${CMAKE_COMMAND} -E echo "${msg}" # This will be stdin of the below cmd
18 COMMAND "${TEST_BINARY}" passthrough
19 RESULT_VARIABLE result
20 OUTPUT_VARIABLE stdout
21)
22if(NOT result EQUAL 0)
23 message(FATAL_ERROR "Command ${TEST_BINARY} failed (${result}) with ${stdout}")
24endif()
25if(NOT stdout MATCHES ".*${msg}")
26 message(FATAL_ERROR "Command ${TEST_BINARY} did not output '${msg}' but '${stdout}'")
27endif()
28message(STATUS "Test OK")