[PATCH] D15705: Adding a scripted test for PR25717

Yunzhong Gao via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 21 17:07:37 PST 2015

ygao created this revision.
ygao added subscribers: cfe-commits, rsandifo, majnemer, aaron.ballman.

I am trying to add a test for PR25717. The test itself is fairly straight-forward: it generates a
large .c temporary file on the fly and then runs the preprocessor over the generated file to
make sure we do not see any unexpected fatal errors.
I have never added a scripted test before, so it would be really nice if someone with this
experience could take a look that I did make all the necessary changes.
Many thanks in advance,
- Gao



Index: test/Preprocessor/lit.local.cfg
--- test/Preprocessor/lit.local.cfg
+++ test/Preprocessor/lit.local.cfg
@@ -0,0 +1,2 @@
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.cl', '.s', '.S', '.py']
Index: test/Preprocessor/bigoutput.py
--- test/Preprocessor/bigoutput.py
+++ test/Preprocessor/bigoutput.py
@@ -0,0 +1,11 @@
+# RUN: python %s
+# RUN: %clang_cc1 -E -x c bigoutput.c | FileCheck %s
+# Make sure clang does not crash during preprocessing
+# CHECK-NOT: fatal error
+f = open("bigoutput.c", "wb")
+for i in range(0, 15000):
+  # this test requires UNIX line endings
+  f.write("int v%d;\n" % i)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15705.43420.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151222/eda55ec1/attachment.bin>

More information about the cfe-commits mailing list