summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2020-10-13 23:48:12 +0200
committerBrad King <brad.king@kitware.com>2020-10-14 12:08:07 -0400
commitf7a5f283188c1e51b0fb549f0a78afaf1d570383 (patch)
treec5fade762b9cada9b7fd9cf964528c43ccd45c80 /Tests
parent90b39a52090e6ba52424b441d5827b2b6e11ff56 (diff)
downloadcmake-f7a5f283188c1e51b0fb549f0a78afaf1d570383.tar.gz
cmake: Fix '-E cat' command for binary files on Windows
Reset `std::cout` to write in binary mode with no encoding conversions. Co-Author: Brad King <brad.king@kitware.com> Fixes: #21295
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CommandLine/.gitattributes2
-rw-r--r--Tests/RunCMake/CommandLine/E_cat_binary_files/binary.objbin0 -> 124 bytes
-rw-r--r--Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txtbin0 -> 248 bytes
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake3
4 files changed, 5 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/.gitattributes b/Tests/RunCMake/CommandLine/.gitattributes
new file mode 100644
index 0000000000..b0b0588cb3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/.gitattributes
@@ -0,0 +1,2 @@
+E_cat_binary_files/binary.obj -text
+E_cat_good_binary_cat-stdout.txt -text -whitespace
diff --git a/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj
new file mode 100644
index 0000000000..73f1749a8e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj
Binary files differ
diff --git a/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt
new file mode 100644
index 0000000000..0951d85b3d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt
Binary files differ
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 973391d646..abb90509c4 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -498,6 +498,9 @@ run_cmake_command(E_cat_good_cat
${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/unicode_file.txt")
unset(out)
+run_cmake_command(E_cat_good_binary_cat
+ ${CMAKE_COMMAND} -E cat "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj" "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj")
+
run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)
run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1)