[Openmp-dev] Switching testsuite to llvm-lit

Peyton, Jonathan L jonathan.l.peyton at intel.com
Thu Jul 16 14:01:21 PDT 2015


Hello everyone,

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.

What I've done so far includes:
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
$ template_parser_c.pl --test --noorphan c/$filename $filename
This generates all the tests indentically to how runtest.pl does so.
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.
3) Then, I've created a basic lit.site.cfg.in file and a basic lit.cfg file (both based off of libcxx's)
4) Lastly, I've been able to successfully run the tests using llvm-lit directly, but not yet from the build system itself as lit.site.cfg.in still needs work (I manually configure lit.site.cfg then run llvm-lit).

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.

// RUN: %clang %openmp_flag %cflags %s -o %t && %t | FileCheck %s
#include <stdio.h>
#include "omp_testsuite.h"
#include "omp_my_sleep.h"

int test_omp_for_nowait()
{
[code to test it]
}

int main()
{
    int i;
    int num_failed=0;

    for(i = 0; i < REPETITIONS; i++) {
        if(!test_omp_for_nowait()) {
            num_failed++;
        }
    }

    if(num_failed==0) {
        printf("Pass\n");
    } else {
        printf("Failed %d out of %d times\n", num_failed, REPETITIONS);
    }
    // CHECK: Pass
    return num_failed;
}

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.

-- Johnny

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150716/b3edc285/attachment.html>


More information about the Openmp-dev mailing list