1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// Make sure that the executor pipes standard input to the test-executable being run.
10
11// RUN: %{build}
12// RUN: echo "abc" | %{exec} %t.exe
13
14#include <cstdio>
15
16int main(int, char**) {
17 int input[] = {std::getchar(), std::getchar(), std::getchar()};
18
19 if (input[0] == 'a' && input[1] == 'b' && input[2] == 'c')
20 return 0;
21 return 1;
22}
23

source code of libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp