<div dir="ltr">Hi Jonathan <div>Going through your steps, I am thinking this is close to what we (UH) had done and committed to the llvm trunk, especially creating those .cfg files and the RUN rules ? </div><div>Sorry if I am mistaken. </div><div><br><div>If what you are doing takes what we did and makes it more compatible to llvm-lit, I understand that. But I would hope that you don't have to start from scratch..</div><div>Our testsuite was also using llvm-lit. </div><div><br></div><div>-Sunita</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 16, 2015 at 4:01 PM, Peyton, Jonathan L <span dir="ltr"><<a href="mailto:jonathan.l.peyton@intel.com" target="_blank">jonathan.l.peyton@intel.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">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Hello everyone,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It has been requested, rightfully so, on more than one occasion that the testsuite be llvm-lit compatible.  This means calling llvm-lit directly inside the testsuite directory where it would pick up the configuration from lit.site.cfg and
 then run each test similar to other LLVM projects.   Perl would neither exist nor be required as it is now for running the tests.  I was beginning to work on converting this and would like input, feedback on this process.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">What I’ve done so far includes:<u></u><u></u></p>
<p class="MsoNormal">1) Creating the tests --- Right now, the tests are stored as template files that must be translated by a perl script.  I’ve manually generated all the tests by running inside the testsuite/ directory<u></u><u></u></p>
<p class="MsoNormal">$ <a href="http://template_parser_c.pl" target="_blank">template_parser_c.pl</a> --test --noorphan c/$filename $filename<u></u><u></u></p>
<p class="MsoNormal">This generates all the tests indentically to how <a href="http://runtest.pl" target="_blank">runtest.pl</a> does so.<u></u><u></u></p>
<p class="MsoNormal">2) I’ve then cleaned up the files, removing any reference to a logFile (llvm-lit will log for you) and cleaned up the typical generated code formatting problems so it looks like acceptable C code.<u></u><u></u></p>
<p class="MsoNormal">3) Then, I’ve created a basic <a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> file and a basic lit.cfg file (both based off of libcxx’s)<u></u><u></u></p>
<p class="MsoNormal">4) Lastly, I’ve been able to successfully run the tests using llvm-lit directly, but not yet from the build system itself as <a href="http://lit.site.cfg.in" target="_blank">lit.site.cfg.in</a> still needs work (I manually configure lit.site.cfg then run llvm-lit).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Each test looks similar to the one below where the RUN: line says to compile the source file (%s) put it in a temp file (%t) , run the temp file, and compare the output of the temp file with the CHECK: line below. if Pass was printed, then
 the test passed, if not then the test failed.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">// RUN: %clang %openmp_flag %cflags %s -o %t && %t | FileCheck %s<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">#include <stdio.h><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">#include "omp_testsuite.h"<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">#include "omp_my_sleep.h"<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">int test_omp_for_nowait()<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">{<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">[code to test it]<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">}<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">int main()<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">{<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    int i;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    int num_failed=0;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    for(i = 0; i < REPETITIONS; i++) {<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">        if(!test_omp_for_nowait()) {<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">            num_failed++;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">        }<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    }<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    if(num_failed==0) {<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">        printf("Pass\n");<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    } else {<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">        printf("Failed %d out of %d times\n", num_failed, REPETITIONS);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    }<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    // CHECK: Pass<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">    return num_failed;<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10pt;font-family:Consolas">}<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Any feedback or comments are welcome.  I was going to continue to work on it and get a first working iteration that could be run from a CMake build tree, then post a patch of the new files.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-- Johnny<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>_______________________________________________<br>
Openmp-dev mailing list<br>
<a href="mailto:Openmp-dev@dcs-maillist2.engr.illinois.edu">Openmp-dev@dcs-maillist2.engr.illinois.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev</a><br>
<br></blockquote></div><br></div></div></div>