Skip to content

Commit 263b4a7

Browse files
committed
[libc++] Simplify how the global stream tests are written
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 c1b9974 commit 263b4a7

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.

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

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

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

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

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

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

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr-imbue.sh.cpp

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

1313
// UNSUPPORTED: no-wide-characters
1414

15-
// UNSUPPORTED: executor-has-no-bash
16-
// FILE_DEPENDENCIES: ../check-stderr.sh
1715
// RUN: %{build}
18-
// RUN: %{exec} bash check-stderr.sh "%t.exe" "zzzz"
16+
// RUN: %{exec} %t.exe 2> %t.actual
17+
// RUN: echo -n zzzz > %t.expected
18+
// RUN: diff %t.expected %t.actual
1919

2020
#include <iostream>
2121

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr-wide-mode.sh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// UNSUPPORTED: no-wide-characters
1414
// REQUIRES: target={{.+}}-windows-{{.+}}
1515

16-
// UNSUPPORTED: executor-has-no-bash
17-
// FILE_DEPENDENCIES: check-stderr.sh, test.dat
16+
// FILE_DEPENDENCIES: test.dat
1817
// RUN: %{build}
19-
// RUN: %{exec} bash check-stderr.sh "%t.exe" "test.dat"
18+
// RUN: %{exec} %t.exe 2> %t.actual
19+
// RUN: diff test.dat %t.actual
2020

2121
// Check that wcerr works, preserving the unicode characters, after switching
2222
// stderr to wide mode.

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp

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

1313
// XFAIL: no-wide-characters
1414

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

2020
#include <iostream>
2121
#include <cassert>

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-imbue.sh.cpp

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

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

1114
// wistream wcin;
1215

1316
// UNSUPPORTED: no-wide-characters
1417

15-
// UNSUPPORTED: executor-has-no-bash
16-
// FILE_DEPENDENCIES: ../send-stdin.sh
1718
// RUN: %{build}
18-
// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
19+
// RUN: echo -n 1234 | %{exec} %t.exe
1920

2021
#include <iostream>
2122
#include <cassert>

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-wide-mode.sh.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
// UNSUPPORTED: no-wide-characters
1414
// REQUIRES: target={{.+}}-windows-{{.+}}
1515

16-
// UNSUPPORTED: executor-has-no-bash
17-
// FILE_DEPENDENCIES: send-stdin.sh, test.dat
16+
// FILE_DEPENDENCIES: test.dat
1817
// RUN: %{build}
19-
// RUN: %{exec} bash send-stdin.sh "%t.exe" "test.dat"
18+
// RUN: cat test.dat | %{exec} %t.exe
2019

2120
// Check that wcin works, preserving the unicode characters, after switching
2221
// stdin to wide mode.

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp

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

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

1114
// wistream wcin;
1215

1316
// XFAIL: no-wide-characters
1417

15-
// UNSUPPORTED: executor-has-no-bash
16-
// FILE_DEPENDENCIES: ../send-stdin.sh
1718
// RUN: %{build}
18-
// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
19+
// RUN: echo -n 1234 | %{exec} %t.exe
1920

2021
#include <iostream>
2122
#include <cassert>

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp

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

1313
// XFAIL: no-wide-characters
1414

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

2020
#include <iostream>
2121

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout-imbue.sh.cpp

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

1313
// UNSUPPORTED: no-wide-characters
1414

15-
// UNSUPPORTED: executor-has-no-bash
16-
// FILE_DEPENDENCIES: ../check-stdout.sh
1715
// RUN: %{build}
18-
// RUN: %{exec} bash check-stdout.sh "%t.exe" "zzzz"
16+
// RUN: %{exec} %t.exe > %t.actual
17+
// RUN: echo -n zzzz > %t.expected
18+
// RUN: diff %t.expected %t.actual
1919

2020
#include <iostream>
2121

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout-wide-mode.sh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// UNSUPPORTED: no-wide-characters
1414
// REQUIRES: target={{.+}}-windows-{{.+}}
1515

16-
// UNSUPPORTED: executor-has-no-bash
17-
// FILE_DEPENDENCIES: check-stdout.sh, test.dat
16+
// FILE_DEPENDENCIES: test.dat
1817
// RUN: %{build}
19-
// RUN: %{exec} bash check-stdout.sh "%t.exe" "test.dat"
18+
// RUN: %{exec} %t.exe > %t.actual
19+
// RUN: diff test.dat %t.actual
2020

2121
// Check that wcout works, preserving the unicode characters, after switching
2222
// stdout to wide mode.

libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp

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

1313
// XFAIL: no-wide-characters
1414

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

2020
#include <iostream>
2121

0 commit comments

Comments
 (0)