Skip to content

Commit 257eb74

Browse files
authored
[libc++] Simplify how the global stream tests are written (#66842)
Instead of relying on Bash, use the builtin Lit commands whenever possible. The motivation is to stop running %t.exe behind Bash, which breaks on macOS 13.5 with SIP enabled because DYLD_LIBRARY_PATH isn't forwarded to the underlying process when running through a protected process. For more details, see [1]. [1]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
1 parent f7bfa58 commit 257eb74

23 files changed

+50
-85
lines changed

libcxx/test/std/input.output/iostream.format/print.fun/print.sh.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10-
// UNSUPPORTED: executor-has-no-bash
1110
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1211

1312
// XFAIL: availability-fp_to_chars-missing
@@ -29,12 +28,9 @@
2928
//
3029
// The testing is based on the testing for std::cout.
3130

32-
// TODO PRINT Use lit builtin echo
33-
34-
// FILE_DEPENDENCIES: echo.sh
3531
// RUN: %{build}
36-
// RUN: %{exec} bash echo.sh -n "1234 一二三四 true 0x0" > %t.expected
37-
// RUN: %{exec} "%t.exe" > %t.actual
32+
// RUN: echo -n "1234 一二三四 true 0x0" > %t.expected
33+
// RUN: %{exec} %t.exe > %t.actual
3834
// RUN: diff -u %t.actual %t.expected
3935

4036
#include <print>

libcxx/test/std/input.output/iostream.format/print.fun/vprint_nonunicode.sh.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10-
// UNSUPPORTED: executor-has-no-bash
1110
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1211

1312
// XFAIL: availability-fp_to_chars-missing
@@ -27,12 +26,9 @@
2726
//
2827
// The testing is based on the testing for std::cout.
2928

30-
// TODO PRINT Use lit builtin echo
31-
32-
// FILE_DEPENDENCIES: echo.sh
3329
// RUN: %{build}
34-
// RUN: %{exec} bash echo.sh -n "1234 一二三四 true 0x0" > %t.expected
35-
// RUN: %{exec} "%t.exe" > %t.actual
30+
// RUN: echo -n "1234 一二三四 true 0x0" > %t.expected
31+
// RUN: %{exec} %t.exe > %t.actual
3632
// RUN: diff -u %t.actual %t.expected
3733

3834
#include <print>

libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10-
// UNSUPPORTED: executor-has-no-bash
1110
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1211

1312
// XFAIL: availability-fp_to_chars-missing
@@ -27,12 +26,9 @@
2726
//
2827
// The testing is based on the testing for std::cout.
2928

30-
// TODO PRINT Use lit builtin echo
31-
32-
// FILE_DEPENDENCIES: echo.sh
3329
// RUN: %{build}
34-
// RUN: %{exec} bash echo.sh -n "1234 一二三四 true 0x0" > %t.expected
35-
// RUN: %{exec} "%t.exe" > %t.actual
30+
// RUN: echo -n "1234 一二三四 true 0x0" > %t.expected
31+
// RUN: %{exec} %t.exe > %t.actual
3632
// RUN: diff -u %t.actual %t.expected
3733

3834
#include <print>

libcxx/test/std/input.output/iostream.objects/check-stderr.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

libcxx/test/std/input.output/iostream.objects/check-stdout.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
// ostream cerr;
1212

13-
// UNSUPPORTED: executor-has-no-bash
14-
// FILE_DEPENDENCIES: ../check-stderr.sh
1513
// RUN: %{build}
16-
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
14+
// RUN: %{exec} %t.exe 2> %t.actual
15+
// RUN: echo -n 1234 > %t.expected
16+
// RUN: diff %t.expected %t.actual
1717

1818
#include <iostream>
1919
#include <cassert>

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// TODO: Investigate
10+
// UNSUPPORTED: LIBCXX-AIX-FIXME
11+
912
// <iostream>
1013

1114
// istream cin;
1215

13-
// UNSUPPORTED: executor-has-no-bash
14-
// FILE_DEPENDENCIES: ../send-stdin.sh
1516
// RUN: %{build}
16-
// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
17+
// RUN: echo -n 1234 | %{exec} %t.exe
1718

1819
#include <iostream>
1920
#include <cassert>

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
// ostream clog;
1212

13-
// UNSUPPORTED: executor-has-no-bash
14-
// FILE_DEPENDENCIES: ../check-stderr.sh
1513
// RUN: %{build}
16-
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
14+
// RUN: %{exec} %t.exe 2> %t.actual
15+
// RUN: echo -n 1234 > %t.expected
16+
// RUN: diff %t.expected %t.actual
1717

1818
#include <iostream>
1919

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
// ostream cout;
1212

13-
// UNSUPPORTED: executor-has-no-bash
14-
// FILE_DEPENDENCIES: ../check-stdout.sh
1513
// RUN: %{build}
16-
// RUN: %{exec} bash check-stdout.sh "%t.exe" "1234"
14+
// RUN: %{exec} %t.exe > %t.actual
15+
// RUN: echo -n 1234 > %t.expected
16+
// RUN: diff %t.expected %t.actual
1717

1818
#include <iostream>
1919

libcxx/test/std/input.output/iostream.objects/send-stdin.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)