[cfe-dev] About Clang Test

Tim Northover t.p.northover at gmail.com
Tue Jan 20 20:10:43 PST 2015


> if I run a.cc, the result will be 4. if I can have one 'expected_result'
> file, I can know whether it is the correct result or not.
>
> The problem is that I do not whether Clang has this kind test suite, i.e.
> one test file(such as a.cc), one expected result file(such as a.expected).

We've got a set of tests like this at
http://llvm.org/git/test-suite.git (generally referred to as the
test-suite, for obvious reasons, in documentation).

I think it's fair to say that the majority of Clang tests are what you
see in the source directory though:

  + Driver tests, checking that clang can target particular
environments & find the right headers given user-level options
(test/Driver & some others).
  + Various front-end tests that don't care about even LLVM IR but
want to make sure Clang's internal representation is correct
(test/Sema, test/AST, ...).
  + Clang CodeGen tests that check correct LLVM IR is produced.

Tests for the second phase of CodeGen (LLVM IR -> assembly) live in
the LLVM repository, mostly under test/CodeGen.

There are some Clang tests that look at actual assembly, but it's
considered bad form. There are absolutely no clang runtime tests
(there are a few JIT tests in LLVM, but they're IR -> execute and it's
often a little unclear just what they test).

Cheers.

Tim.



More information about the cfe-dev mailing list