Symbolic Execution in Software Engineering By Xusheng Xiao Xi Ge Dayoung Lee Towards Partial fulfillment for Course 707.

Slides:



Advertisements
Similar presentations
1 Automating the Generation of Mutation Tests Mike Papadakis and Nicos Malevris Department of Informatics Athens University of Economics and Business.
Advertisements

Leonardo de Moura Microsoft Research. Z3 is a new solver developed at Microsoft Research. Development/Research driven by internal customers. Free for.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke September 1976.
PLDI’2005Page 1June 2005 Example (C code) int double(int x) { return 2 * x; } void test_me(int x, int y) { int z = double(x); if (z==y) { if (y == x+10)
Automatic test case generation for programs that are coded against interfaces and annotations or use native code Mainul Islam Supervisor: Dr. Christoph.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
1/20 Generalized Symbolic Execution for Model Checking and Testing Charngki PSWLAB Generalized Symbolic Execution for Model Checking and Testing.
Translator Architecture Code Generator ParserTokenizer string of characters (source code) string of tokens abstract program string of integers (object.
Automation of Test Case Generation
Tao Xie University of Illinois at Urbana-Champaign Part of the research work described in this talk was done in collaboration with the Pex team (Nikolai.
Kai Pan, Xintao Wu University of North Carolina at Charlotte Generating Program Inputs for Database Application Testing Tao Xie North Carolina State University.
CSE503: SOFTWARE ENGINEERING SYMBOLIC TESTING, AUTOMATED TEST GENERATION … AND MORE! David Notkin Spring 2011.
Pexxxx White Box Test Generation for
DART Directed Automated Random Testing Patrice Godefroid, Nils Klarlund, and Koushik Sen Syed Nabeel.
Software Testing and Quality Assurance
Data Dependence Based Testability Transformation in Automated Test Generation Presented by: Qi Zhang.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Crossword Puzzle Solver Michael Keefe. Solver structure.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Deep Dive into Pex How Pex works, implications for design of Code Hunt puzzles Nikolai Tillmann Principal Software Engineering Manager Microsoft, Redmond,
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Tao Xie North Carolina State University Supported by CACC/NSA Related projects supported in part by ARO, NSF, SOSI.
Tao Xie (North Carolina State University) Nikolai Tillmann, Jonathan de Halleux, Wolfram Schulte (Microsoft Research, Redmond WA, USA)
CUTE: A Concolic Unit Testing Engine for C Technical Report Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
DySy: Dynamic Symbolic Execution for Invariant Inference.
Paul Ammann & Jeff Offutt
Tao Xie University of Illinois at Urbana-Champaign Part of the research work described in this talk was done in collaboration with the Pex team (Nikolai.
Tao Xie Automated Software Engineering Group Department of Computer Science North Carolina State University
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
Teaching and Learning Programming and Software Engineering via Interactive Gaming Tao Xie University of Illinois at Urbana-Champaign In collaboration with.
HAMPI A Solver for String Constraints Vijay Ganesh MIT (With Adam Kiezun, Philip Guo, Pieter Hooimeijer and Mike Ernst)
Testing Grammars For Top Down Parsers By Asma M Paracha, Frantisek F. Franek Dept. of Computing & Software McMaster University Hamilton, Ont.
Problem Solving using the Java Programming Language May 2010 Mok Heng Ngee Day 5: Arrays.
Jose Sanchez 1 o Tielei Wang†, TaoWei†, Zhiqiang Lin‡, Wei Zou†. o Purdue University & Peking University o Proceedings of NDSS'09: Network and Distributed.
Tao Xie North Carolina State University Nikolai Tillmann, Peli de Halleux, Wolfram Schulte Microsoft Research.
Mining Gigabytes of Dynamic Traces for Test Generation Suresh Thummalapenta North Carolina State University Peli de Halleux and Nikolai Tillmann Microsoft.
Nikolai Tillmann, Jonathan de Halleux Tao Xie Microsoft Research Univ. Illinois at Urbana-Champaign.
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
jFuzz – Java based Whitebox Fuzzing
Cooperative Developer Testing: Tao Xie North Carolina State University In collaboration with Xusheng ASE and Nikolai Tillmann, Peli de
A Test Case + Mock Class Generator for Coding Against Interfaces Mainul Islam, Christoph Csallner Software Engineering Research Center (SERC) Computer.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
CUTE: A Concolic Unit Testing Engine for C Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
( = “unknown yet”) Our novel symbolic execution framework: - extends model checking to programs that have complex inputs with unbounded (very large) data.
Design and Analysis of Algorithms & Computational Complexity CS490 Koji Tajii.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION SYMBOLIC TESTING Autumn 2011.
Symstra: A Framework for Generating Object-Oriented Unit Tests using Symbolic Execution Tao Xie, Darko Marinov, Wolfram Schulte, and David Notkin University.
Clear Lines Consulting · clear-lines.comApril 21, 2010 · 1 The Joy of Pex
White-Box Testing Statement coverage Branch coverage Path coverage
CS223: Software Engineering Lecture 26: Software Testing.
Software Testing.
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Dynamic Symbolic Execution
Software Engineering (CSI 321)
Parsing with Context Free Grammars
Outline of the Chapter Basic Idea Outline of Control Flow Testing
A Test Case + Mock Class Generator for Coding Against Interfaces
White-Box Testing.
Software Testing (Lecture 11-a)
Estimating Timing Profiles for Simulation of Embedded Systems
Decidable Problems of Regular Languages
White-Box Testing.
CUTE: A Concolic Unit Testing Engine for C
Paul Ammann & Jeff Offutt
Whitebox Testing.
Decidability continued….
Software Testing.
Presentation transcript:

Symbolic Execution in Software Engineering By Xusheng Xiao Xi Ge Dayoung Lee Towards Partial fulfillment for Course 707

Overview Introduction to symbolic execution o Test generation using dynamic symbolic execution Path explosion problem o NP-complete problem o Greedy algorithm: fitness guided exploration String constraint solver o Hampi: Context free grammar Symbolic Grammar o Context free grammar

Symbolic Execution Symbolic execution is the analysis of programs by tracking symbolic rather than actual values. Symbolic execution is used to reason about all the inputs that take the same execution path through a program. int main(int y) { y = 2 * y; if (y == 4){ printf(“y == 4”); }else { printf(“y != 4”); } s 2 * s 2 * s == 4 Example:

4 void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } a.Length>0 a[0]==123… T F T F F a==null T Constraints to solve a!=null a!=null && a.Length>0 a!=null && a.Length>0 && a[0]== Input null {} {0} {123…} Execute&Monitor Solve Choose next path Observed constraints a==null a!=null && !(a.Length>0) a==null && a.Length>0 && a[0]!= a==null && a.Length>0 && a[0]== Done: There is no path left. Slide from Pex group, Microsoft Research Dynamic Symbolic Execution (DSE) DSE is used to generate test inputs systematically

Path Explosion CFG (control flow graph) Each program under test could be modeled as CFG. To achieve 100% path coverage is in NPC.

Path Explosion Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; } TestLoop(0,{0})

Path Explosion Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; } TestLoop(90,{0})

Path Explosion Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; } TestLoop(90,{15})

Path Explosion Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; }

Path Explosion Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; }

Fitness Greedy algorithm: Fitness Guided Explosion Fitness Function: Measure the current state and the goal state. Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110)Fitness function: |110-x| return true; } return false; }

Fitness Public bool TestLoop(int x, int[] y){ if(x==90){ for(int i=0; i<y.length;i++) if(y[i]==15) x++; If(x==110) return true; } return false; }

String Constraint Solver Testing tools could be reduced to constraint generation phase and constraint solving phase. String constraint solvers are needed by testing string-manipulating programs o Web application Hampi

HAMPI

Input-Space Explosion Programs such as Parsers that accept string inputs Language of string inputs defined using context free grammars Generation of string inputs to achieve 100% branch coverage causes input-space explosion

Example The Grammar for SimpleCalc inputs is shown below:

SimpleCalc Example Boolean SimpleCalc (string str) { …. … }

Previous Approaches Exhaustive Enumeration Uses grammar and generates inputs exhaustively Number of valid strings for size six: 187,765,078 Dynamic Symbolic Execution Uses program source code and generates inputs Number of inputs generated: 248,523

Symbolic Grammar Uses both grammar and program source code (1) The Grammar for SimpleCalc inputs is shown below: (2) The Symbolic grammar for SimpleCalc inputs

Symbolic Grammar Use Exhaustive Enumeration on Symbolic Grammar and generate inputs Use dynamic symbolic execution for generating concrete values for symbolic values Number of inputs generated: 6,611