[LLVMdev] How to write a regression test case?

Triple Yang triple.yang at gmail.com
Mon Aug 20 19:46:16 PDT 2012


Hi, changcheng,

There are following steps to be taken to write a test case:
1. create a directory in test, say "test/XXX"
2. create a file named lit.local.cfg, which is a configuration file.
The straightforward way is to copy an existed one,
    like "test/CodeGen/SPARC/lit.local.cfg". You might need make some
modification on it.
3. create a file, say "example.ll"
    (The name of file does not matter, but the suffix of the file name
DOES matter. See config.suffixes = [ ... ] in lit.local.cfg)
    for more details.
    example.ll includes normal content of LLVM IR, and the ";RUN ..."
directives at the beginning of the file.
4. run all regression test cases with "make check", which includes
above test case newly added.
    Or you might want to run just that case with "llvm-lit test/XXX"
or "llvm-lit test/XXX/example.ll"
    llvm-lit resides in BUILD tree, distinguished from source tree and
install tree. You can find it under
    your-build-tree/Release+Asserts/bin/ or
your-build-tree/Debug+Asserts/bin/ or likewise, which depends on your
build
    configuration.

By the way, in the following ";RUN ..." directive
; RUN: llc < %s  -march=x86 | FileCheck %s
%s indicates current file under test. I guess the first %s stands for
the input for llc, while the second and last %s specifies
what to check using "; CHECK ..." directives since you write them down
on exactly CURRENT file.

Hope it work for you.
Regards.

2012/8/20 Changcheng Wang <changcheng at multicorewareinc.com>:
> hi,all:
> i really want to how to write a regression test case,but i do not find
> out a entire document about it.
> By reading LLVM Testing Infrastructure Guide and FileCheck - Flexible
> pattern matching file verifier, i only have a idea,but it is not
> enough for me to write a test case.i need more detail about how to
> write a RUN:lines.
>
> thanks for you scan,wish your letter.
>
> best wishes,
>
> changcheng
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



-- 
æšć‹‡ć‹‡ (Yang Yongyong)




More information about the llvm-dev mailing list