Symbolic Execution for Software Testing in Practice – Preliminary Assessment

Symbolic Execution for Software Testing in Practice – Preliminary Assessment

Symbolic Execution for Software Testing in Practice – Preliminary Assessment Cristian Cadar Patrice Godefroid Sarfraz Khurshid Corina S. Pas˘ areanu˘ ∗ Imperial College London Microsoft Research U. Texas at Austin CMU/NASA Ames [email protected] [email protected] [email protected] [email protected] Koushik Sen Nikolai Tillmann Willem Visser U.C. Berkeley Microsoft Research Stellenbosch University [email protected] [email protected] [email protected] ABSTRACT Symbolic execution is now the underlying technique of We present results for the \Impact Project Focus Area" on several popular testing tools, many of them open-source: NASA's Symbolic (Java) PathFinder1, UIUC's CUTE and the topic of symbolic execution as used in software testing. 2 3 4 Symbolic execution is a program analysis technique intro- jCUTE , Stanford's KLEE , UC Berkeley's CREST and BitBlaze5, etc. Symbolic execution tools are now used in in- duced in the 70s that has received renewed interest in recent 6 7 years, due to algorithmic advances and increased availability dustrial practice at Microsoft (Pex , SAGE [29], YOGI and of computational power and constraint solving technology. PREfix [10]), IBM (Apollo [2]), NASA and Fujitsu (Sym- We review classical symbolic execution and some modern bolic PathFinder), and also form a key part of the com- extensions such as generalized symbolic execution and dy- mercial testing tool suites from Parasoft and other compa- namic test generation. We also give a preliminary assess- nies [60]. ment of the use in academia, research labs, and industry. Although we acknowledge that the impact of symbolic ex- ecution in software practice is still limited, we believe that the explosion of work in this area over the past years makes Categories and Subject Descriptors for an interesting story about the increasing impact of sym- D.2.5 [Testing and Debugging]: Symbolic execution bolic execution since it was first introduced in the 1970s. Note that this paper is not meant to provide a comprehen- sive survey of symbolic execution techniques; such surveys General Terms can be found elsewhere [19, 44, 49]. Instead, we focus here Reliability on a few modern symbolic execution techniques that have shown promise to impact software testing in practice. Keywords Software testing is the most commonly used technique for validating the quality of software, but it is typically a mostly Generalized symbolic execution, dynamic test generation manual process that accounts for a large fraction of software development and maintenance. Symbolic execution is one of the many techniques that can be used to automate software testing by automatically generating test cases that achieve 1. INTRODUCTION high coverage of program executions. The ACM-SIGSOFT Impact Project is documenting the Symbolic execution is a program analysis technique that impact that software engineering research has had on soft- executes programs with symbolic rather than concrete in- ware development practice. In this paper, we present pre- puts and maintains a path condition that is updated when- liminary results for documenting the impact of research in ever a branch instruction is executed, to encode the con- symbolic execution for automated software testing. Sym- straints on the inputs that reach that program point. Test bolic execution is a program analysis technique that was generation is performed by solving the collected constraints introduced in the 70s [8, 15, 31, 35, 46], and that has found using a constraint solver. Symbolic execution can also be renewed interest in recent years [9,12,13,28,29,32,33,40,42, used for bug finding, where it checks for run-time errors or 43, 50{52, 56, 57]. assertion violations and it generates test inputs that trigger those errors. ∗We thank Matt Dwyer for his advice The original approaches to symbolic execution [8,15,31,35, 1http://babelfish.arc.nasa.gov/trac/jpf/wiki/projects/ Permission to make digital or hard copies of all or part of this work for jpf-symbc personal or classroom use is granted without fee provided that copies are 2http://osl.cs.uiuc.edu/~ksen/cute/ not made or distributed for profit or commercial advantage and that copies 3http://klee.llvm.org/ bear this notice and the full citation on the first page. To copy otherwise, to 4http://code.google.com/p/crest/ republish, to post on servers or to redistribute to lists, requires prior specific 5 http://bitblaze.cs.berkeley.edu/ permission and/or a fee. 6http://research.microsoft.com/en-us/projects/pex/ ICSE ’11, May 21–28, 2011, Waikiki, Honolulu, HI, USA 7 Copyright 2011 ACM 978-1-4503-0445-0/11/05 ...$10.00. http://research.microsoft.com/en-us/projects/yogi/ 46] addressed simple sequential programs with a fixed num- of non-determinism). GSE handles input recursive data ber of input data of primitive type. Modern approaches, structures by using lazy initialization. GSE starts execu- such as generalized symbolic execution (GSE) [33] and tion of the method on inputs with uninitialized fields and jCUTE [51], address multi-threaded programs with complex non-deterministically initializes fields when they are first ac- data structures as inputs. Much of the popularity of sym- cessed during the method's symbolic execution. This allows bolic execution applied to large programs is due to recent ad- symbolic execution of program methods without requiring vances in dynamic test generation [12, 28], extending prior an a priori bound on the number of input objects. The ap- work originating in the 80s and 90s [16, 17, 36] where the proach handles input arrays in a similar way. Method pre- symbolic execution is performed at run-time, along concrete conditions can be used to ensure that fields are initialized program executions. We discuss these techniques in more to values permitted by the precondition. Partial correctness detail in the next section. properties are given as assertions in the program. Symbolic execution still suffers from scalability issues due On the first access to an un-initialized reference field, GSE to the large number of paths that need to be analyzed non-deterministically initializes it to null, to a reference to and the complexity of the constraints that are generated. a new object with un-initialized fields, or to a reference to However, algorithmic advances, newly available Satifiability an object created during a prior initialization step; in this Modulo Theories (SMT) solvers8 and more powerful ma- way all the aliasing possibilities in the inputs are treated chines have already made it possible to apply such tech- systematically. Once the field has been initialized, the ex- niques to large programs (with millions lines of code) and to ecution proceeds according to the concrete (non-symbolic) discover subtle bugs in commonly used software { ranging execution semantics. The model-checker systematically han- from library code to network and operating systems code { dles the non-determinism introduced when creating different saving millions of dollars (see Section 3). heap configurations and when updating path conditions. 2.2 Dynamic Test Generation 2. SYMBOLIC EXECUTION Recent work on using symbolic execution for dynamic The key idea behind symbolic execution [35] is to use as test case generation|such as Directed Automated Ran- input values symbolic values instead of actual data, and to dom Testing (DART) [28], EXecution Generated Executions represent values of program variables as symbolic expres- (EGT/EXE) [12, 13] or Concolic Testing (CUTE) [52]| sions. As a result, the outputs computed by a program are improve classical symbolic execution by making a distinction expressed as a function of the symbolic inputs. between the concrete and the symbolic state of a program. Symbolic execution maintains a symbolic state, which The code is essentially run unmodified, and only statements maps variables to symbolic expressions, and a symbolic path that depend on the symbolic input are treated differently, constraint PC, a first order quantifier free formula over sym- adding constraints to the current path condition. This dy- bolic expressions. PC accumulates constraints on the inputs namic test generation approach has been implemented in that trigger the execution to follow the associated path. At various flavors, some of which are discussed in Section 3. every conditional statement if (e) S1 else S2, PC is up- A significant scalability challenge for this technique is how dated with conditions on the inputs to choose between al- 0 to handle the exponential number of paths in the code. Re- ternative paths. A fresh path condition PC is created and cent extensions have tried to address this challenge by us- initialized to PC ^ :σ(e) (\else" branch) and PC is updated ing heuristics to guide path exploration [13,29], interleaving to PC ^ σ(e) (\then" branch), where σ(e) denotes the sym- symbolic execution with random testing [40], caching func- bolic predicate obtained by evaluating e in symbolic state σ. tion summaries for later use by higher-level functions [26] or Note that unlike in concrete execution, both branches can eliminating redundant paths by analyzing the values read be taken, resulting in two execution paths. If any of PC or 0 and written by the program [7]. PC becomes un-satisfiable, symbolic execution terminates Dynamic test generation based on symbolic execution has along the corresponding path. Satisfiability is checked with been implemented in a variety of tools [9, 11{13, 28, 29, 41, a constraint solver. 52, 57]. We present several of them in the following section. Whenever symbolic execution along a path terminates (normally or with an error), the current PC is solved and the solution forms the test inputs|if the program is exe- 3. TOOLS AND IMPACT cuted on these concrete inputs, it will take the same path In this section we present several recent tools that are as the symbolic execution and terminate.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us