File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
compiler-rt/test/sanitizer_common/TestCases/Posix Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
- // RUN: %clangxx -O1 %s -o %t && %run %t %t.tmp %T
1
+ // RUN: %clangxx -O1 %s -o %t
2
+ // RUN: %run %t 1
3
+ // RUN: %run %t 2
2
4
3
5
#include < assert.h>
4
6
#include < fcntl.h>
5
7
#include < stdio.h>
8
+ #include < stdlib.h>
9
+ #include < string.h>
6
10
#include < sys/stat.h>
7
11
#include < unistd.h>
8
12
@@ -19,13 +23,21 @@ void test(const char *path, int flags) {
19
23
}
20
24
21
25
int main (int argc, char *argv[]) {
22
- assert (argc == 3 );
23
- assert (argv[1 ]);
24
- unlink (argv[1 ]);
25
- test (argv[1 ], O_RDWR | O_CREAT);
26
+ assert (argc == 2 );
27
+ char buff[10000 ];
28
+ sprintf (buff, " %s.tmp" , argv[0 ]);
29
+
30
+ if (atoi (argv[1 ]) == 1 ) {
31
+ unlink (buff);
32
+ test (buff, O_RDWR | O_CREAT);
33
+ }
26
34
27
35
#ifdef O_TMPFILE
28
- assert (argv[2 ]);
29
- test (argv[2 ], O_RDWR | O_TMPFILE);
36
+ if (atoi (argv[1 ]) == 2 ) {
37
+ char *last = strrchr (buff, ' /' );
38
+ assert (last);
39
+ *last = 0 ;
40
+ test (buff, O_RDWR | O_TMPFILE);
41
+ }
30
42
#endif
31
43
}
You can’t perform that action at this time.
0 commit comments