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
24
35#include < assert.h>
46#include < fcntl.h>
57#include < stdio.h>
8+ #include < stdlib.h>
9+ #include < string.h>
610#include < sys/stat.h>
711#include < unistd.h>
812
@@ -19,13 +23,21 @@ void test(const char *path, int flags) {
1923}
2024
2125int 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+ }
2634
2735#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+ }
3042#endif
3143}
You can’t perform that action at this time.
0 commit comments