]> git.proxmox.com Git - ceph.git/blobdiff - 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
diff --git a/ceph/src/boost/libs/nowide/test/test_iostream_passthrough.cmake b/ceph/src/boost/libs/nowide/test/test_iostream_passthrough.cmake
new file mode 100644 (file)
index 0000000..8dfc2ad
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright 2019 - 2021 Alexander Grund
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)
+
+if(NOT DEFINED TEST_BINARY)
+  if(CMAKE_ARGC GREATER 3)
+    # cmake(0) -P(1) <script>(2) <first arg>(3)
+    set(TEST_BINARY ${CMAKE_ARGV3})
+  else()
+    message(FATAL_ERROR "You need to define TEST_BINARY with the path to the binary")
+  endif()
+endif()
+
+set(msg "Hello Boost Nowide")
+
+execute_process(
+  COMMAND ${CMAKE_COMMAND} -E echo "${msg}" # This will be stdin of the below cmd
+  COMMAND "${TEST_BINARY}" passthrough
+  RESULT_VARIABLE result
+  OUTPUT_VARIABLE stdout
+)
+if(NOT result EQUAL 0)
+  message(FATAL_ERROR "Command ${TEST_BINARY} failed (${result}) with ${stdout}")
+endif()
+if(NOT stdout MATCHES ".*${msg}")
+  message(FATAL_ERROR "Command ${TEST_BINARY} did not output '${msg}' but '${stdout}'")
+endif()
+message(STATUS "Test OK")