[clang] fc7b8e7 - [test] Fix dr324.c again for non-writeable source directories

Jordan Rupprecht via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 10:11:27 PST 2022


Author: Jordan Rupprecht
Date: 2022-12-12T10:11:19-08:00
New Revision: fc7b8e71312f89986be1a7cc67377a2decfcf337

URL: https://github.com/llvm/llvm-project/commit/fc7b8e71312f89986be1a7cc67377a2decfcf337
DIFF: https://github.com/llvm/llvm-project/commit/fc7b8e71312f89986be1a7cc67377a2decfcf337.diff

LOG: [test] Fix dr324.c again for non-writeable source directories

In general, the source tree is not assumed to be writeable, so modifying `%s` does not work for all CI systems. Instead of touching `%s`, copy it to a writeable dir using `%t`, and touch it there.
Actually, `dr0xx.c` isn't really needed at all, so just create a new `dep.c` file in the build tree.

This was recently added in cb088e8c3abf30456e2891f90b5194d0070c387a, fixed in 1481fcf780bde7b115aa395064d71749b1a40889, and fixed again in d16c59013056f1bf8844ded8faeb0cf01b1c3613.

Added: 
    

Modified: 
    clang/test/C/drs/dr324.c

Removed: 
    


################################################################################
diff  --git a/clang/test/C/drs/dr324.c b/clang/test/C/drs/dr324.c
index 2d75853e5af7c..585041b0365f3 100644
--- a/clang/test/C/drs/dr324.c
+++ b/clang/test/C/drs/dr324.c
@@ -1,9 +1,18 @@
-/* RUN: touch %s
-   RUN: %clang_cc1 -std=c89 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c99 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c11 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c17 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c2x -fsyntax-only -fms-extensions -pedantic -verify %s
+/* RUN: rm -rf %t && mkdir %t
+   RUN: cp %s %t/dr324.c
+
+   Note: this file (dr324.c) must be newer than the file used for the
+     dependency pragma (dep.c), otherwise we get an unrelated "current file is
+     older than dependency" warning. Touch dep.c first to make sure it's
+     always older.
+   RUN: touch %t/dep.c
+   RUN: touch %t/dr324.c
+
+   RUN: %clang_cc1 -std=c89 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
+   RUN: %clang_cc1 -std=c99 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
+   RUN: %clang_cc1 -std=c11 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
+   RUN: %clang_cc1 -std=c17 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
+   RUN: %clang_cc1 -std=c2x -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
  */
 
 /* WG14 DR324: yes
@@ -25,7 +34,7 @@ char lit_char = '\y';       /* expected-warning {{unknown escape sequence '\y'}}
 /* This test only makes sense on Windows targets, where the backslash is a valid
  * path separator.
  */
-#pragma GCC dependency "oops\..\dr0xx.c"
+#pragma GCC dependency "oops\..\dep.c"
 #endif
 #pragma message("this has a \t tab escape and an invalid \d escape") /* expected-warning {{this has a 	 tab escape and an invalid d escape}}
                                                                         expected-warning {{unknown escape sequence '\d'}}


        


More information about the cfe-commits mailing list