How do I create a testcase that targets a specified branch?

38 views Asked by At

I try to "dynamic symbolic execution" with klee.

How do I create a testcase that targets a specified branch?

int a = 0;
klee_make_symbolic(&a, sizeof(a), "a");
if (a == 0) 
    ... // I want to touch only this branch
else if (a > 0)
    ...
else
    ...

Is there any option to make specified branch?

I don't want to make all testcases.

1

There are 1 answers

0
hibert On

instrument an assert(0); statement into the branch you interested and then run klee with the parameter -exit-on-error-type=Assert.

KLEE will exit and genrate a test case for the path you instrumented. This is the easiest way I come up with.