enhancing symbolic execution for coverage oriented testing
play

Enhancing Symbolic Execution for Coverage-Oriented Testing S - PowerPoint PPT Presentation

Enhancing Symbolic Execution for Coverage-Oriented Testing S ebastien Bardin, Nikolai Kosmatov, Micka el Delahaye CEA LIST, Software Safety Lab (Paris-Saclay, France) Bardin et al. CFV 2015 1/ 40 Context : white-box software testing


  1. Enhancing Symbolic Execution for Coverage-Oriented Testing S´ ebastien Bardin, Nikolai Kosmatov, Micka¨ el Delahaye CEA LIST, Software Safety Lab (Paris-Saclay, France) Bardin et al. CFV 2015 1/ 40

  2. Context : white-box software testing Testing process Generate a test input Run it and check for errors Estimate coverage : if enough stop, else loop Coverage criteria [decision, mcdc, mutants, etc.] play a major role definition = systematic way of deriving test requirements generate tests, decide when to stop, assess quality of testing beware : infeasible test requirements [waste generation effort, imprecise coverage ratios] beware : lots of different coverage criteria Bardin et al. CFV 2015 2/ 40

  3. Context : Dynamic Symbolic Execution Dynamic Symbolic Execution [dart, cute, exe, sage, pex, klee, . . . ] � very powerful approach to (white box) test generation � many tools and many successful case-studies since mid 2000’s Bardin et al. CFV 2015 3/ 40

  4. Context : Dynamic Symbolic Execution Dynamic Symbolic Execution [dart, cute, exe, sage, pex, klee, . . . ] � very powerful approach to (white box) test generation � many tools and many successful case-studies since mid 2000’s Symbolic Execution [King 70’s] consider a program P on input v , and a given path σ a path predicate ϕ σ for σ is a formula s.t. v | = ϕ σ ⇒ P(v) follows σ can be used for bounded-path testing ! old idea, recent renew interest [requires powerful solvers] Bardin et al. CFV 2015 3/ 40

  5. Context : Dynamic Symbolic Execution Dynamic Symbolic Execution [dart, cute, exe, sage, pex, klee, . . . ] � very powerful approach to (white box) test generation � many tools and many successful case-studies since mid 2000’s Symbolic Execution [King 70’s] consider a program P on input v , and a given path σ a path predicate ϕ σ for σ is a formula s.t. v | = ϕ σ ⇒ P(v) follows σ can be used for bounded-path testing ! old idea, recent renew interest [requires powerful solvers] Dynamic Symbolic Execution [Korel+, Williams+, Godefroid+] interleave dynamic and symbolic executions drive the search towards feasible paths for free give hints for relevant under-approximations [robustness] Bardin et al. CFV 2015 3/ 40

  6. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  7. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  8. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  9. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  10. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  11. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  12. Context : Dynamic Symbolic Execution (2) input : a program P output : a test suite TS covering all feasible paths of Paths ≤ k ( P ) pick a path σ ∈ Paths ≤ k ( P ) compute a path predicate ϕ σ of σ [wpre, spost] solve ϕ σ for satisfiability [smt solver] SAT(s) ? get a new pair < s, σ > loop until no more path to cover Bardin et al. CFV 2015 4/ 40

  13. The problem DSE is GREAT for automating structural testing � very powerful approach to (white box) test generation � many tools and many successful case-studies since mid 2000’s Bardin et al. CFV 2015 5/ 40

  14. The problem DSE is GREAT for automating structural testing � very powerful approach to (white box) test generation � many tools and many successful case-studies since mid 2000’s Yet, no real support for structural coverage criteria [except path coverage and branch coverage] Would be useful : when required to produce tests achieving some criterion for producing “good” tests for an external oracle [functional correctness, security, performance, etc.] Recent efforts [Active Testing, Augmented DSE, Mutation DSE] limited or unclear expressiveness explosion of the search space [ APex : 272x avg, up to 2,000x] Bardin et al. CFV 2015 5/ 40

  15. Our goals and results Goals : extend DSE to a large set of structural coverage criteria support these criteria in a unified way support these criteria in an efficient way detect (some) infeasible test requirements Bardin et al. CFV 2015 6/ 40

  16. Our goals and results Goals : extend DSE to a large set of structural coverage criteria support these criteria in a unified way support these criteria in an efficient way detect (some) infeasible test requirements Results � generic low-level encoding of coverage criteria [ICST 14] � efficient variant of DSE for coverage criteria [ICST 14] � sound and quasi-complete detection of infeasibility [ICST 15] Bardin et al. CFV 2015 6/ 40

  17. Outline Introduction Labels Efficient DSE for Labels Infeasible label detection The GACC criterion Conclusion Bardin et al. CFV 2015 7/ 40

  18. Focus : Labels Annotate programs with labels ◮ predicate attached to a specific program instruction Label ( loc , ϕ ) is covered if a test execution ◮ reaches the instruction at loc ◮ satisfies the predicate ϕ Good for us ◮ can easily encode a large class of coverage criteria [see after] ◮ in the scope of standard program analysis techniques Bardin et al. CFV 2015 8/ 40

  19. Simulation of standard coverage criteria statement_1 ; statement_1 ; // l1: x==y && a<b if (x==y && a<b) // l2: !(x==y && a<b) − − − − − → {...}; if (x==y && a<b) statement_3 ; {...}; statement_3 ; Decision Coverage ( DC ) Bardin et al. CFV 2015 9/ 40

  20. Simulation of standard coverage criteria statement_1 ; // l1: x==y statement_1 ; // l2: !(x==y) if (x==y && a<b) // l3: a<b − − − − − → {...}; // l4: !(a<b) statement_3 ; if (x==y && a<b) {...}; statement_3 ; Condition Coverage ( CC ) Bardin et al. CFV 2015 9/ 40

  21. Simulation of standard coverage criteria statement_1 ; // l1: x==y && a<b statement_1 ; // l2: x==y && a>=b if (x==y && a<b) // l3: x!=y && a<b − − − − − → {...}; // l4: x!=y && a>=b statement_3 ; if (x==y && a<b) {...}; statement_3 ; Multiple-Condition Coverage ( MCC ) Bardin et al. CFV 2015 9/ 40

  22. Simulation of standard coverage criteria OBJ : generic specification mechanism for coverage criteria � IC , DC , FC , CC , MCC , GACC large part of Weak Mutations Input Domain Partition Run-Time Error Bardin et al. CFV 2015 9/ 40

  23. Simulation of standard coverage criteria OBJ : generic specification mechanism for coverage criteria � IC , DC , FC , CC , MCC , GACC large part of Weak Mutations Input Domain Partition Run-Time Error Out of scope : . strong mutations, MCDC . (side-effect weak mutations) Bardin et al. CFV 2015 9/ 40

  24. Focus : Simulation of Weak Mutations mutant M = syntactic modification of program P weakly covering M = finding t such that P( t ) � = M( t ) just after the mutation Bardin et al. CFV 2015 10/ 40

  25. From weak mutants to labels (1) Bardin et al. CFV 2015 11/ 40

  26. From weak mutants to labels (2) One label per mutant Mutation inside a statement �→ lhs := e lhs := e’ ◮ add label : e � = e ′ �→ lhs := e lhs’ := e ◮ add label : & lhs � = & lhs ′ ∧ ( lhs � = e ∨ lhs ′ � = e ) Mutation inside a decision �→ if (cond) if (cond’) ◮ add label : cond ⊕ cond ′ Beware : no side-effect inside labels Bardin et al. CFV 2015 12/ 40

Recommend


More recommend