Skip to content

Commit 52aaa8a

Browse files
authored
[clang][test] Avoid writing to a potentially write-protected dir (#88258)
This test just checks for the stdout/stderr of clang, but it incidentally tries to write to `a.out` in the current directory, which may be write protected. Typically one would write `clang -o %t.o` for a writeable dir, but since we only care about stdout/stderr, throw away the object file and just write to /dev/null instead.
1 parent 7d60232 commit 52aaa8a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/test/Driver/lld-repro.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
// RUN: echo "-nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t" \
55
// RUN: | sed -e 's/\\/\\\\/g' > %t.rsp
66

7-
// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all 2>&1 \
7+
// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 \
88
// RUN: | FileCheck %s
99

1010
// Test that the reproducer can still be created even when the input source cannot be preprocessed
1111
// again, like when reading from stdin.
12-
// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all 2>&1 < %s \
12+
// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 < %s \
1313
// RUN: | FileCheck %s
1414

1515
// check that we still get lld's output
@@ -20,9 +20,9 @@
2020
// CHECK-NEXT: note: diagnostic msg:
2121
// CHECK: ********************
2222

23-
// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler 2>&1 \
23+
// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler -o /dev/null 2>&1 \
2424
// RUN: | FileCheck %s --check-prefix=NO-LINKER
25-
// RUN: not %clang %s @%t.rsp 2>&1 \
25+
// RUN: not %clang %s @%t.rsp -o /dev/null 2>&1 \
2626
// RUN: | FileCheck %s --check-prefix=NO-LINKER
2727

2828
// NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are located at:

0 commit comments

Comments
 (0)