[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht closed 
https://github.com/llvm/llvm-project/pull/88258
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread Dmitri Gribenko via cfe-commits

https://github.com/gribozavr approved this pull request.


https://github.com/llvm/llvm-project/pull/88258
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Jordan Rupprecht (rupprecht)


Changes

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/88258.diff


1 Files Affected:

- (modified) clang/test/Driver/lld-repro.c (+4-4) 


``diff
diff --git a/clang/test/Driver/lld-repro.c b/clang/test/Driver/lld-repro.c
index 9457dd334b5b96..61904c0e6df306 100644
--- a/clang/test/Driver/lld-repro.c
+++ b/clang/test/Driver/lld-repro.c
@@ -4,12 +4,12 @@
 // RUN: echo "-nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error 
-fcrash-diagnostics-dir=%t" \
 // RUN:   | sed -e 's/\\//g' > %t.rsp
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s
 
 // Test that the reproducer can still be created even when the input source 
cannot be preprocessed
 // again, like when reading from stdin.
-// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all 2>&1 < %s \
+// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 < 
%s \
 // RUN:   | FileCheck %s
 
 // check that we still get lld's output
@@ -20,9 +20,9 @@
 // CHECK-NEXT: note: diagnostic msg:
 // CHECK: 
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
-// RUN: not %clang %s @%t.rsp 2>&1 \
+// RUN: not %clang %s @%t.rsp -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
 
 // NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are 
located at:

``




https://github.com/llvm/llvm-project/pull/88258
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/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.

>From b23bfe788d2fba00f8303c54e53507a8fd0bc53b Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Wed, 10 Apr 2024 11:50:04 +
Subject: [PATCH] [clang][test] Avoid writing to a potentially write-protected
 dir

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.
---
 clang/test/Driver/lld-repro.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/test/Driver/lld-repro.c b/clang/test/Driver/lld-repro.c
index 9457dd334b5b96..61904c0e6df306 100644
--- a/clang/test/Driver/lld-repro.c
+++ b/clang/test/Driver/lld-repro.c
@@ -4,12 +4,12 @@
 // RUN: echo "-nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error 
-fcrash-diagnostics-dir=%t" \
 // RUN:   | sed -e 's/\\//g' > %t.rsp
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s
 
 // Test that the reproducer can still be created even when the input source 
cannot be preprocessed
 // again, like when reading from stdin.
-// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all 2>&1 < %s \
+// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 < 
%s \
 // RUN:   | FileCheck %s
 
 // check that we still get lld's output
@@ -20,9 +20,9 @@
 // CHECK-NEXT: note: diagnostic msg:
 // CHECK: 
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
-// RUN: not %clang %s @%t.rsp 2>&1 \
+// RUN: not %clang %s @%t.rsp -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
 
 // NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are 
located at:

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits