Syndicate

Syndicate content

Flattr


Flattr this

If you like this, you can use flattr. ;)

Imprint

About
eMail: wishinet at gmail . com
PGP ID: 0xCCCA5E74

Jabber: wishi@jabber.ccc.de

A brief look at KLEE

txttxt

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.

  1. llvm[0]: Running unittests test suite
  2. Debug/ExprTests
  3. [==========] Running 3 tests from 1 test case.
  4. [----------] Global test environment set-up.
  5. [----------] 3 tests from ExprTest
  6. [ RUN      ] ExprTest.BasicConstruction
  7. [       OK ] ExprTest.BasicConstruction
  8. [ RUN      ] ExprTest.ConcatExtract
  9. [       OK ] ExprTest.ConcatExtract
  10. [ RUN      ] ExprTest.ExtractConcat
  11. [       OK ] ExprTest.ExtractConcat
  12. [----------] Global test environment tear-down
  13. [==========] 3 tests from 1 test case ran.
  14. [  PASSED  ] 3 tests.
  15. Debug/SolverTests
  16. [==========] Running 1 test from 1 test case.
  17. [----------] Global test environment set-up.
  18. [----------] 1 test from SolverTest
  19. [ RUN      ] SolverTest.Evaluation
  20. [       OK ] SolverTest.Evaluation
  21. [----------] Global test environment tear-down
  22. [==========] 1 test from 1 test case ran.
  23. [  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

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Save the nature. Don't print this!


I provide textual exports for every blog entry. However let's save the nature together. The nature is everything around us. Every being should be respected. Save the nature - don't print too much.


Die Umgehung dieser Ausdrucksperre ist nach § 95a UrhG verboten!
Inhaltlich Verantwortlicher gemäß § 10 Absatz 3 MDStV: Marius Ciepluch - Anschrift via eMail. Die eMail Adresse entnehmen sie dem Impresseum dieser englischsprachigen Seite.
Aus Datenschutzgründen habe ich weder offiziellen noch behördlichen Schriftverkehr via eMail. Dazu ist die postalische, beim Dienstleister hinterlegte, Anschrift zu verwenden.

Datenerfassung

Es werden keine personenbezogenen Daten erfasst. Logdaten werden anonymisiert.