<div dir="ltr">You can use the C preprocessor:<div><br></div><div>// RUN: %clang_cc1 -DTYPE=char %s -fsyntax-only</div><div class="gmail_extra">// RUN: %clang_cc1 -DTYPE=short %s -fsyntax-only<br></div><div class="gmail_extra">// RUN: %clang_cc1 -DTYPE=unsigned %s -fsyntax-only<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">void func(TYPE a) {<br></div><div class="gmail_extra"> a = 3;</div><div class="gmail_extra">}</div><div class="gmail_extra"><br></div><div class="gmail_extra">But, as David suggests, this kind of data-driven testing usually isn't useful.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 10, 2014 at 8:39 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">Nope, lit doesn't have anything like that.</p>
<p dir="ltr">Best to keep the tests simple, sometimes to the point of being repetitious.</p>
<p dir="ltr">Do you actually have different codepaths to test for each type?</p>
<div class="gmail_quote"><div><div class="h5">On Sep 10, 2014 8:05 AM, "lyh.kernel" <<a href="mailto:lyh.kernel@gmail.com" target="_blank">lyh.kernel@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello all,<br><br>I am writing test cases which are dedicated to be executed by llvm-lit. Most of my test cases have the same logic but different types. For example:<br><br>// RUN: %clang_cc1 -fsyntax-only<br>func (int a) {<br> a = 3;<br>}<br><br>// RUN: %clang_cc1 -fsyntax-only<br>func (char a) {<br> a = 3;<br>}<br><br>// RUN: %clang_cc1 -fsyntax-only<br>func (unsigned a) {<br> a = 3;<br>}<br><br>Now I put them in three different test cases but it is hard to maintain. I am wondering whether llvm-lit support writing test cases with macro parameter and a parameter config file:<br><br>// RUN: %clang_cc1 -fsyntax-only<br>func (TYPE a) {<br> a = 3;<br>}<br><br>// TYPE config<br>TYPE = {int, char, unsigned}<br><div><br></div><div>Many thanks</div></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>