Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/test/ClangScanDeps/pr61006.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir` && \
// RUN: %clang -print-resource-dir | tr -d '\n' > %t/resource-dir
// RUN: export EXPECTED_RESOURCE_DIR=%{readfile:%t/resource-dir}
// RUN: ln -s %clang++ %t/clang++ && \
// RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json && \
// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t && \
Expand Down
9 changes: 4 additions & 5 deletions clang/test/ClangScanDeps/resource_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// then verify `%clang-scan-deps` arrives at the same path by calling the
// `Driver::GetResourcesPath` function.
//
// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
// RUN: %clang -print-resource-dir | tr -d '\n' > %t/resource-dir
// RUN: sed -e "s|CLANG|%clang|g" -e "s|DIR|%/t|g" \
// RUN: %S/Inputs/resource_directory/cdb.json.template > %t/cdb_path.json
//
// RUN: clang-scan-deps -compilation-database %t/cdb_path.json --format experimental-full \
// RUN: --resource-dir-recipe modify-compiler-path > %t/result_path.json
// RUN: cat %t/result_path.json | sed 's:\\\\\?:/:g' \
// RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
// RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="%{readfile:%t/resource-dir}"
// CHECK-PATH: "-resource-dir"
// CHECK-PATH-NEXT: "[[EXPECTED_RESOURCE_DIR]]"

Expand All @@ -31,16 +31,15 @@
// Here we hard-code the expected path into `%t/compiler` and then verify
// `%clang-scan-deps` arrives at the path by actually running the executable.
//
// RUN: EXPECTED_RESOURCE_DIR="/custom/compiler/resources"
// RUN: echo "#!/bin/sh" > %t/compiler
// RUN: echo "echo '$EXPECTED_RESOURCE_DIR'" >> %t/compiler
// RUN: echo "echo '/custom/compiler/resources'" >> %t/compiler
// RUN: chmod +x %t/compiler
// RUN: sed -e "s|CLANG|%/t/compiler|g" -e "s|DIR|%/t|g" \
// RUN: %S/Inputs/resource_directory/cdb.json.template > %t/cdb_invocation.json
//
// RUN: clang-scan-deps -compilation-database %t/cdb_invocation.json --format experimental-full \
// RUN: --resource-dir-recipe invoke-compiler > %t/result_invocation.json
// RUN: cat %t/result_invocation.json | sed 's:\\\\\?:/:g' \
// RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
// RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="/custom/compiler/resources"
// CHECK-INVOCATION: "-resource-dir"
// CHECK-INVOCATION-NEXT: "[[EXPECTED_RESOURCE_DIR]]"
5 changes: 3 additions & 2 deletions clang/test/Driver/env.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Some assertions in this test use Linux style (/) file paths.
// UNSUPPORTED: system-windows
// RUN: bash -c env | grep LD_LIBRARY_PATH | tr -d '\n' > /tmp/ld_library_path
// The PATH variable is heavily used when trying to find a linker.
// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="$LD_LIBRARY_PATH" CLANG_NO_DEFAULT_CONFIG=1 \
// RUN: env -i LC_ALL=C LD_LIBRARY_PATH="%{readfile:/tmp/ld_library_path}" CLANG_NO_DEFAULT_CONFIG=1 \
// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: --rtlib=platform --unwindlib=platform -no-pie \
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-LD-32 %s
//
// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" CLANG_NO_DEFAULT_CONFIG=1 \
// RUN: env -i LC_ALL=C PATH="" LD_LIBRARY_PATH="%{readfile:/tmp/ld_library_path}" CLANG_NO_DEFAULT_CONFIG=1 \
// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: --rtlib=platform --unwindlib=platform -no-pie \
Expand Down
16 changes: 8 additions & 8 deletions clang/test/Driver/program-path-priority.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@

/// <default-triple>-gcc has lowest priority so <triple>-gcc
/// on PATH beats default triple in program path
// RUN: DEFAULT_TRIPLE=`%t/clang --version | grep "Target:" | cut -d ' ' -f2`
// RUN: touch %t/$DEFAULT_TRIPLE-gcc && chmod +x %t/$DEFAULT_TRIPLE-gcc
// RUN: %t/clang --version | grep "Target:" | cut -d ' ' -f2 > %t.default_triple
// RUN: touch %t/%{readfile:%t.default_triple}-gcc && chmod +x %t/%{readfile:%t.default_triple}-gcc
// RUN: touch %t/%target_triple-gcc && chmod +x %t/%target_triple-gcc
// RUN: env "PATH=%t/env/" %t/clang -### -target notreal-none-elf %s 2>&1 | \
// RUN: FileCheck --check-prefix=DEFAULT_TRIPLE_GCC %s
Expand All @@ -101,7 +101,7 @@
// DEFAULT_TRIPLE_NO_NOTREAL: env/gcc"
// DEFAULT_TRIPLE_NO_NOTREAL-NOT: -gcc"

/// Pick "gcc" as a fallback. Don't pick $DEFAULT_TRIPLE-gcc.
/// Pick "gcc" as a fallback. Don't pick DEFAULT_TRIPLE-gcc.
// RUN: rm %t/env/gcc
// RUN: env "PATH=%t/env/" %t/clang -### -target notreal-none-elf %s 2>&1 | \
// RUN: FileCheck --check-prefix=DEFAULT_TRIPLE_NO_OTHERS %s
Expand All @@ -110,9 +110,9 @@
/// -B paths are searched separately so default triple will win
/// if put in one of those even if other paths have higher priority names
// RUN: mkdir -p %t/prefix
/// One of these will fail when $DEFAULT_TRIPLE == %target_triple
// RUN: test -f %t/$DEFAULT_TRIPLE-gcc && \
// RUN: mv %t/$DEFAULT_TRIPLE-gcc %t/prefix || true
/// One of these will fail when %{readfile:%t.default_triple} == %target_triple
// RUN: test -f %t/%{readfile:%t.default_triple}-gcc && \
// RUN: mv %t/%{readfile:%t.default_triple}-gcc %t/prefix || true
// RUN: test -f %t/%target_triple-gcc && \
// RUN: mv %t/%target_triple-gcc %t/prefix || true
// RUN: touch %t/notreal-none-elf-gcc && chmod +x %t/notreal-none-elf-gcc
Expand All @@ -123,8 +123,8 @@
// DEFAULT_TRIPLE_IN_PREFIX-NOT: notreal-none-elf-gcc"

/// Only if there is nothing in the prefix will we search other paths
/// -f in case $DEFAULT_TRIPLE == %target_triple
// RUN: rm -f %t/prefix/$DEFAULT_TRIPLE-gcc %t/prefix/%target_triple-gcc %t/prefix/gcc
/// -f in case %{readfile:%t.default_triple} == %target_triple
// RUN: rm -f %t/prefix/%{readfile:%t.default_triple}-gcc %t/prefix/%target_triple-gcc %t/prefix/gcc
// RUN: env "PATH=" %t/clang -### -canonical-prefixes --target=notreal-none-elf %s -B %t/prefix 2>&1 | \
// RUN: FileCheck --check-prefix=EMPTY_PREFIX_DIR1 %s
// EMPTY_PREFIX_DIR1: gcc"
Expand Down
1 change: 0 additions & 1 deletion clang/test/Misc/dev-fd-fs.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Check that we can operate on files from /dev/fd.
// REQUIRES: dev-fd-fs
// REQUIRES: shell

// Check reading from named pipes. We cat the input here instead of redirecting
// it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Modules/relative-resource-dir.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
// REQUIRES: shell

// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir` && \
// RUN: %clang -print-resource-dir | tr -d '\n' > %t.resource_dir
// RUN: env EXPECTED_RESOURCE_DIR="%{readfile:%t.resource_dir}" && \
// RUN: mkdir -p %t && rm -rf %t/resource-dir && \
// RUN: cp -R $EXPECTED_RESOURCE_DIR %t/resource-dir
// RUN: cp -R %{readfile:%t.resource_dir} %t/resource-dir
// RUN: cd %t && %clang -cc1 -x objective-c -fmodules -fmodule-format=obj \
// RUN: -fimplicit-module-maps -fmodules-cache-path=%t.mcp \
// RUN: -fbuiltin-headers-in-system-modules \
Expand Down
3 changes: 3 additions & 0 deletions llvm/utils/lit/lit/builtin_commands/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def main(argv):
import os, msvcrt

msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
if len(filenames) == 0:
sys.stdout.write(sys.stdin.read())
sys.exit(0)
for filename in filenames:
try:
contents = None
Expand Down
4 changes: 4 additions & 0 deletions llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@
# NP-CAT-OUTPUT-NEXT:M-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[
# NP-CAT-OUTPUT-NEXT:M-\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-o
# NP-CAT-OUTPUT-NEXT:M-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?

## Test that cat will pipe stdin to stdout if no other files are specified.
# RUN: echo test | cat | FileCheck --check-prefix=CAT-STDIN %s
# CAT-STDIN: test
Loading