xref: /aosp_15_r20/external/clang/test/Driver/output-file-cleanup.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: rm -f "%t.d" "%t1.s" "%t2.s" "%t3.s" "%t4.s" "%t5.s"
2*67e74705SXin Li //
3*67e74705SXin Li // RUN: touch %t.s
4*67e74705SXin Li // RUN: not %clang -S -DCRASH -o %t.s -MMD -MF %t.d %s
5*67e74705SXin Li // RUN: test ! -f %t.s
6*67e74705SXin Li // RUN: test ! -f %t.d
7*67e74705SXin Li 
8*67e74705SXin Li // RUN: touch %t.s
9*67e74705SXin Li // RUN: not %clang -S -DMISSING -o %t.s -MMD -MF %t.d %s
10*67e74705SXin Li // RUN: test ! -f %t.s
11*67e74705SXin Li // RUN: test ! -f %t.d
12*67e74705SXin Li 
13*67e74705SXin Li // RUN: touch %t.s
14*67e74705SXin Li // RUN: not %clang -S -o %t.s -MMD -MF %t.d %s
15*67e74705SXin Li // RUN: test ! -f %t.s
16*67e74705SXin Li // RUN: test -f %t.d
17*67e74705SXin Li 
18*67e74705SXin Li // REQUIRES: crash-recovery
19*67e74705SXin Li 
20*67e74705SXin Li #ifdef CRASH
21*67e74705SXin Li #pragma clang __debug crash
22*67e74705SXin Li #elif defined(MISSING)
23*67e74705SXin Li #include "nonexistent.h"
24*67e74705SXin Li #else
25*67e74705SXin Li invalid C code
26*67e74705SXin Li #endif
27*67e74705SXin Li 
28*67e74705SXin Li // RUN: touch %t1.c
29*67e74705SXin Li // RUN: echo "invalid C code" > %t2.c
30*67e74705SXin Li // RUN: cd %T && not %clang -S %t1.c %t2.c
31*67e74705SXin Li // RUN: test -f %t1.s
32*67e74705SXin Li // RUN: test ! -f %t2.s
33*67e74705SXin Li 
34*67e74705SXin Li // RUN: touch %t1.c
35*67e74705SXin Li // RUN: touch %t2.c
36*67e74705SXin Li // RUN: chmod -r %t2.c
37*67e74705SXin Li // RUN: cd %T && not %clang -S %t1.c %t2.c
38*67e74705SXin Li // RUN: test -f %t1.s
39*67e74705SXin Li // RUN: test ! -f %t2.s
40*67e74705SXin Li 
41*67e74705SXin Li // When given multiple .c files to compile, clang compiles them in order until
42*67e74705SXin Li // it hits an error, at which point it stops.
43*67e74705SXin Li //
44*67e74705SXin Li // RUN: touch %t1.c
45*67e74705SXin Li // RUN: echo "invalid C code" > %t2.c
46*67e74705SXin Li // RUN: touch %t3.c
47*67e74705SXin Li // RUN: echo "invalid C code" > %t4.c
48*67e74705SXin Li // RUN: touch %t5.c
49*67e74705SXin Li // RUN: cd %T && not %clang -S %t1.c %t2.c %t3.c %t4.c %t5.c
50*67e74705SXin Li // RUN: test -f %t1.s
51*67e74705SXin Li // RUN: test ! -f %t2.s
52*67e74705SXin Li // RUN: test ! -f %t3.s
53*67e74705SXin Li // RUN: test ! -f %t4.s
54*67e74705SXin Li // RUN: test ! -f %t5.s
55