1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Revert "[lit] Generalized /dev/null support on Windows."

This reverts commit ca7fdbb974384ce5a05528b22a41d46b1cc13e92.

llvm-svn: 328596
This commit is contained in:
Mircea Trofin 2018-03-26 23:59:39 +00:00
parent 4cf99ef51b
commit 8c42530a18
4 changed files with 4 additions and 33 deletions

View File

@ -20,7 +20,7 @@ RUN: echo "f2:0" >> %t.input
RUN: echo "1" >> %t.input RUN: echo "1" >> %t.input
RUN: echo ":10" >> %t.input RUN: echo ":10" >> %t.input
RUN: not llvm-profdata merge %t.input -text -output=/dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN RUN: not llvm-profdata merge %t.input -text -o /dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN
BROKEN: Malformed instrumentation profile data BROKEN: Malformed instrumentation profile data
RUN: echo ":ir" > %t.input RUN: echo ":ir" > %t.input

View File

@ -36,7 +36,6 @@ kUseCloseFDs = not kIsWindows
# Use temporary files to replace /dev/null on Windows. # Use temporary files to replace /dev/null on Windows.
kAvoidDevNull = kIsWindows kAvoidDevNull = kIsWindows
kDevNull = "/dev/null"
class ShellEnvironment(object): class ShellEnvironment(object):
@ -627,7 +626,7 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
raise InternalShellError(cmd, "Unsupported: glob in " raise InternalShellError(cmd, "Unsupported: glob in "
"redirect expanded to multiple files") "redirect expanded to multiple files")
name = name[0] name = name[0]
if kAvoidDevNull and name == kDevNull: if kAvoidDevNull and name == '/dev/null':
fd = tempfile.TemporaryFile(mode=mode) fd = tempfile.TemporaryFile(mode=mode)
elif kIsWindows and name == '/dev/tty': elif kIsWindows and name == '/dev/tty':
# Simulate /dev/tty on Windows. # Simulate /dev/tty on Windows.
@ -798,11 +797,11 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
# Replace uses of /dev/null with temporary files. # Replace uses of /dev/null with temporary files.
if kAvoidDevNull: if kAvoidDevNull:
for i,arg in enumerate(args): for i,arg in enumerate(args):
if kDevNull in arg: if arg == "/dev/null":
f = tempfile.NamedTemporaryFile(delete=False) f = tempfile.NamedTemporaryFile(delete=False)
f.close() f.close()
named_temp_files.append(f.name) named_temp_files.append(f.name)
args[i] = arg.replace(kDevNull, f.name) args[i] = f.name
# Expand all glob expressions # Expand all glob expressions
args = expand_glob_expressions(args, cmd_shenv.cwd) args = expand_glob_expressions(args, cmd_shenv.cwd)

View File

@ -1,14 +0,0 @@
#!/usr/bin/env python
import argparse
import platform
parser = argparse.ArgumentParser()
parser.add_argument("--my_arg", "-a")
args = parser.parse_args()
answer = (platform.system() == "Windows" and
args.my_arg == "/dev/null" and "ERROR") or "OK"
print(answer)

View File

@ -1,14 +0,0 @@
# Check handling of /dev/null in command line options
# On windows, it should be redirected to a temp file.
#
# RUN: "%{python}" %S/check_args.py --my_arg /dev/null | FileCheck %s --check-prefix=CHECK1
# CHECK1: OK
# RUN: "%{python}" %S/check_args.py --my_arg=/dev/null | FileCheck %s --check-prefix=CHECK2
# CHECK2: OK
# RUN: "%{python}" %S/check_args.py -a /dev/null | FileCheck %s --check-prefix=CHECK3
# CHECK3: OK
# RUN: "%{python}" %S/check_args.py -a=/dev/null | FileCheck %s --check-prefix=CHECK4
# CHECK4: OK