A brief look at KLEE
Automated high coverage tests
Software testing - if you do it manually - requires you to reach many implemented functions. The more functions you're able to reach, the better. Manual testing most often is considered to be more effective than general automated black-boxing. In between, if you've got the source, KLEE can help you to generate tests; and generate the code via symbolic execution.
An 2008's OSDI paper sums that up quite nicely.
Installation with LLVM backend
KLEE requires the LLVM suite. The installation is easy enough: check out the LLVM svn rpository, compile and install LLVM and KLEE, and have fun.
If you want to use KLEE on MacOS, you should add "-fexceptions" to the CXXFLAGS, because the libstdc++ 4.0 seems to require it. Maybe soon KLEE will use LLVM map data structures... Let's see.
- llvm[0]: Running unittests test suite
- Debug/ExprTests
- [==========] Running 3 tests from 1 test case.
- [----------] Global test environment set-up.
- [----------] 3 tests from ExprTest
- [ RUN ] ExprTest.BasicConstruction
- [ OK ] ExprTest.BasicConstruction
- [ RUN ] ExprTest.ConcatExtract
- [ OK ] ExprTest.ConcatExtract
- [ RUN ] ExprTest.ExtractConcat
- [ OK ] ExprTest.ExtractConcat
- [----------] Global test environment tear-down
- [==========] 3 tests from 1 test case ran.
- [ PASSED ] 3 tests.
- Debug/SolverTests
- [==========] Running 1 test from 1 test case.
- [----------] Global test environment set-up.
- [----------] 1 test from SolverTest
- [ RUN ] SolverTest.Evaluation
- [ OK ] SolverTest.Evaluation
- [----------] Global test environment tear-down
- [==========] 1 test from 1 test case ran.
- [ PASSED ] 1 test.
If you passed the checks, it's time for testing.
Tests in replay mode
The directory examples/islower - is pretty interesting. In short: Include klee, make the input variable symbolic, compile to LLVM bitcode, generate the test-cases and replay them with gcc or another compiler.
Other frontends
My time is currently limited, however I'll soon check .Net/Java programs with the VMKit LLVM frontend, and Objective C code with clang. Seems to be a great way to put programs in play-mode. :)
Have fun,
wishi

Post new comment