mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 23:21:11 +00:00
[libc++] Make sure we forward stdin through executors (#67064)
This allows running tests like the ones for std::cin even on SSH executors. This was originally reported as https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639.
This commit is contained in:
parent
5f2da9c80d
commit
21f8bc25ad
22
libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
Normal file
22
libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
Normal file
@ -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 that the executor pipes standard input to the test-executable being run.
|
||||
|
||||
// RUN: %{build}
|
||||
// RUN: echo "abc" | %{exec} %t.exe
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
int main(int, char**) {
|
||||
int input[] = {std::getchar(), std::getchar(), std::getchar()};
|
||||
|
||||
if (input[0] == 'a' && input[1] == 'b' && input[2] == 'c')
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
@ -9,10 +9,6 @@
|
||||
// TODO: Investigate
|
||||
// UNSUPPORTED: LIBCXX-AIX-FIXME
|
||||
|
||||
// TODO: Make it possible to run this test when cross-compiling and running via a SSH executor
|
||||
// This is a workaround to silence issues reported in https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639
|
||||
// XFAIL: buildhost=windows && target={{.+}}-linux-{{.+}}
|
||||
|
||||
// <iostream>
|
||||
|
||||
// istream cin;
|
||||
|
@ -9,10 +9,6 @@
|
||||
// TODO: Investigate
|
||||
// UNSUPPORTED: LIBCXX-AIX-FIXME
|
||||
|
||||
// TODO: Make it possible to run this test when cross-compiling and running via a SSH executor
|
||||
// This is a workaround to silence issues reported in https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639
|
||||
// XFAIL: buildhost=windows && target={{.+}}-linux-{{.+}}
|
||||
|
||||
// <iostream>
|
||||
|
||||
// wistream wcin;
|
||||
|
@ -9,10 +9,6 @@
|
||||
// TODO: Investigate
|
||||
// UNSUPPORTED: LIBCXX-AIX-FIXME
|
||||
|
||||
// TODO: Make it possible to run this test when cross-compiling and running via a SSH executor
|
||||
// This is a workaround to silence issues reported in https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639
|
||||
// XFAIL: buildhost=windows && target={{.+}}-linux-{{.+}}
|
||||
|
||||
// <iostream>
|
||||
|
||||
// wistream wcin;
|
||||
|
@ -62,7 +62,8 @@ def main():
|
||||
ssh("mktemp -d {}/libcxx.XXXXXXXXXX".format(args.tempdir)),
|
||||
universal_newlines=True,
|
||||
check=True,
|
||||
capture_output=True
|
||||
capture_output=True,
|
||||
stdin=subprocess.DEVNULL
|
||||
).stdout.strip()
|
||||
|
||||
# HACK:
|
||||
@ -80,7 +81,7 @@ def main():
|
||||
if args.codesign_identity:
|
||||
for exe in filter(isTestExe, commandLine):
|
||||
codesign = ["codesign", "-f", "-s", args.codesign_identity, exe]
|
||||
runCommand(codesign, env={}, check=True)
|
||||
runCommand(codesign, env={}, check=True, stdin=subprocess.DEVNULL)
|
||||
|
||||
# tar up the execution directory (which contains everything that's needed
|
||||
# to run the test), and copy the tarball over to the remote host.
|
||||
@ -93,7 +94,7 @@ def main():
|
||||
# the temporary file while still open doesn't work on Windows.
|
||||
tmpTar.close()
|
||||
remoteTarball = pathOnRemote(tmpTar.name)
|
||||
runCommand(scp(tmpTar.name, remoteTarball), check=True)
|
||||
runCommand(scp(tmpTar.name, remoteTarball), check=True, stdin=subprocess.DEVNULL)
|
||||
finally:
|
||||
# Make sure we close the file in case an exception happens before
|
||||
# we've closed it above -- otherwise close() is idempotent.
|
||||
@ -130,6 +131,8 @@ def main():
|
||||
remoteCommands.append(subprocess.list2cmdline(commandLine))
|
||||
|
||||
# Finally, SSH to the remote host and execute all the commands.
|
||||
# Make sure to forward stdin to the process so that the test suite
|
||||
# can pipe stuff into the executor.
|
||||
rc = runCommand(ssh(" && ".join(remoteCommands))).returncode
|
||||
return rc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user