[libcxx-commits] [libcxx] 89bb9f8 - [libc++] Make sure the cin/wcin tests run on remote hosts

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 6 08:33:33 PDT 2020


Author: Louis Dionne
Date: 2020-05-06T11:33:13-04:00
New Revision: 89bb9f8d78de4b85c2b889d75027783097a15b89

URL: https://github.com/llvm/llvm-project/commit/89bb9f8d78de4b85c2b889d75027783097a15b89
DIFF: https://github.com/llvm/llvm-project/commit/89bb9f8d78de4b85c2b889d75027783097a15b89.diff

LOG: [libc++] Make sure the cin/wcin tests run on remote hosts

When running on remote hosts, we need the whole `echo 123 | %t.exe` command
to run on the remote host. Thus, we need to escape the pipe to make sure
the command is treated as `{ echo 123 | %t.exe } > %t.out` instead of
`{ echo 123 } | %t.exe > %t.out`m where only `echo 123` is run on the
remote host.

Added: 
    libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp

Modified: 
    libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
    libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp b/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
new file mode 100644
index 000000000000..3badc8c39ee5
--- /dev/null
+++ b/libcxx/test/libcxx/selftest/newformat/shell-escape-pipes.sh.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure manually escaped pipes are handled properly by the shell.
+// Specifically, we want to make sure that if we escape a pipe after %{exec},
+// it gets executed by the %{exec} substitution, as opposed to the result of
+// the %{exec} substitution being piped into the following command.
+//
+// This is a bit tricky to test. To test this, we basically want to ensure
+// that both sides of the pipe are executed inside %{exec}. When we're inside
+// %{exec}, the one 
diff erence we can rely on is that we're in a temporary
+// directory with all file dependencies satisfied, so that's what we use.
+
+// FILE_DEPENDENCIES: %t.foobar
+// RUN: touch %t.foobar
+// RUN: %{exec} echo \| ls > %t.out
+// RUN: grep -e ".foobar" %t.out

diff  --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
index 386dbbd4721d..4cadde65543b 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
@@ -14,7 +14,7 @@
 
 // FILE_DEPENDENCIES: %t.exe
 // RUN: %{build}
-// RUN: %{exec} echo "123" | %t.exe > %t.out
+// RUN: %{exec} echo "123" \| %t.exe > %t.out
 // RUN: grep -e 'The number is 123!' %t.out
 
 #include <iostream>

diff  --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
index 9d24a37233a8..0d0ab7e03931 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp
@@ -14,7 +14,7 @@
 
 // FILE_DEPENDENCIES: %t.exe
 // RUN: %{build}
-// RUN: %{exec} echo "123" | %t.exe > %t.out
+// RUN: %{exec} echo "123" \| %t.exe > %t.out
 // RUN: grep -e 'The number is 123!' %t.out
 
 #include <iostream>


        


More information about the libcxx-commits mailing list