Skip to content

[libc++][AIX] Use input redirection instead of piping for cin tests #83184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

jakeegan
Copy link
Member

When echo is used for piping, lit uses the system echo rather than the builtin echo. The system echo on AIX doesn't support the -n option, which causes these tests to fail. Use input redirection, so the builtin echo can be used.

@jakeegan jakeegan requested a review from a team as a code owner February 27, 2024 21:02
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Feb 27, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 27, 2024

@llvm/pr-subscribers-libcxx

Author: Jake Egan (jakeegan)

Changes

When echo is used for piping, lit uses the system echo rather than the builtin echo. The system echo on AIX doesn't support the -n option, which causes these tests to fail. Use input redirection, so the builtin echo can be used.


Full diff: https://github.com/llvm/llvm-project/pull/83184.diff

3 Files Affected:

  • (modified) libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp (+2-4)
  • (modified) libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp (+2-4)
  • (modified) libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp (+2-4)
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 ce6a7f37801e10..4f23b6b9a5d877 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
@@ -6,9 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// TODO: Investigate
-// UNSUPPORTED: LIBCXX-AIX-FIXME
-
 // QEMU does not detect EOF, when reading from stdin
 // "echo -n" suppresses any characters after the output and so the test hangs.
 // https://gitlab.com/qemu-project/qemu/-/issues/1963
@@ -23,7 +20,8 @@
 // istream cin;
 
 // RUN: %{build}
-// RUN: echo -n 1234 | %{exec} %t.exe
+// RUN: echo -n 1234 > %t.input
+// RUN: %{exec} %t.exe < %t.input
 
 #include <iostream>
 #include <cassert>
diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp
index 027e4fa936f11d..6ae1972234b2bf 100644
--- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp
@@ -6,9 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// TODO: Investigate
-// UNSUPPORTED: LIBCXX-AIX-FIXME
-
 // This test hangs on Android devices that lack shell_v2, which was added in
 // Android N (API 24).
 // UNSUPPORTED: LIBCXX-ANDROID-FIXME && android-device-api={{2[1-3]}}
@@ -20,7 +17,8 @@
 // UNSUPPORTED: no-wide-characters
 
 // RUN: %{build}
-// RUN: echo -n 1234 | %{exec} %t.exe
+// RUN: echo -n 1234 > %t.input
+// RUN: %{exec} %t.exe < %t.input
 
 #include <iostream>
 #include <cassert>
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 30972da2f09348..08b74b999bbf4f 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
@@ -6,9 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// TODO: Investigate
-// UNSUPPORTED: LIBCXX-AIX-FIXME
-
 // This test hangs on Android devices that lack shell_v2, which was added in
 // Android N (API 24).
 // UNSUPPORTED: LIBCXX-ANDROID-FIXME && android-device-api={{2[1-3]}}
@@ -20,7 +17,8 @@
 // UNSUPPORTED: no-wide-characters
 
 // RUN: %{build}
-// RUN: echo -n 1234 | %{exec} %t.exe
+// RUN: echo -n 1234 > %t.input
+// RUN: %{exec} %t.exe < %t.input
 
 #include <iostream>
 #include <cassert>

Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakeegan Can you please uncheck the "hide my email" feature in Github?

Apart from that, the patch itself LGTM. It would be even better to fix Lit itself, of course, but this is good enough.

@jakeegan jakeegan merged commit 98418c2 into llvm:main Mar 4, 2024
@jakeegan jakeegan deleted the bad_echo branch March 4, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants