Chandrasekhar Boyapati (Google) Sarfraz Khurshid (University of Texas)

Slides:



Advertisements
Similar presentations
Korat Automated Testing Based on Java Predicates Chandrasekhar Boyapati, Sarfraz Khurshid, Darko Marinov MIT ISSTA 2002 Rome, Italy.
Advertisements

Satisfiability Modulo Theories (An introduction)
50.530: Software Engineering Sun Jun SUTD. Week 10: Invariant Generation.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
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.
Getting started with ML ML is a functional programming language. ML is statically typed: The types of literals, values, expressions and functions in a.
Symbolic execution © Marcelo d’Amorim 2010.
Hybrid Concolic Testing Rupak Majumdar Koushik Sen UC Los Angeles UC Berkeley.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
272: Software Engineering Fall 2008 Instructor: Tevfik Bultan Lecture 10: Testing, Automated Testing.
1 Today Another approach to “coverage” Cover “everything” – within a well-defined, feasible limit Bounded Exhaustive Testing.
Specification-Based Error Localization Brian Demsky Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology.
Efficient Software Model Checking of Data Structure Properties Paul T. Darga Chandrasekhar Boyapati The University of Michigan.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Efficient Modular Glass Box Software Model Checking Michael Roberson Chandrasekhar Boyapati The University of Michigan.
Specification-Based Error Localization Brian Demsky Cristian Cadar Daniel Roy Martin Rinard Computer Science and Artificial Intelligence Laboratory Massachusetts.
1/23/2003University of Virginia1 Korat: Automated Testing Based on Java Predicates CS751 Presentation by Radu Stoleru C.Boyapaty, S.Khurshid, D.Marinov.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 8: Semi-automated test generation via UDITA.
Korat: Automated Testing Based on Java Predicates Chandrasekhar Boyapati 1, Sarfraz Khurshid 2, and Darko Marinov 3 1 University of Michigan Ann Arbor.
Formal Techniques for Verification Using SystemC By Nasir Mahmood.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Reverse Engineering State Machines by Interactive Grammar Inference Neil Walkinshaw, Kirill Bogdanov, Mike Holcombe, Sarah Salahuddin.
Feed Back Directed Random Test Generation Carlos Pacheco1, Shuvendu K. Lahiri2, Michael D. Ernst1, and Thomas Ball2 1MIT CSAIL, 2Microsoft Research Presented.
CS527 Topics in Software Engineering (Software Testing and Analysis) Darko Marinov September 15, 2011.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
Systematic Software Testing Using Test Abstractions Darko Marinov RIO Summer School Rio Cuarto, Argentina February 2011.
Korat: Automated Testing Based on Java Predicates
CS265: Program Analysis, Testing, and Debugging
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
Java Pathfinder JPF Tutorial - Test Input Generation With Java Pathfinder.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 6: Exhaustive Bounded Testing and Feedback-Directed Random Testing.
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
1 Generating FSMs from Abstract State Machines Wolfgang Grieskamp Yuri Gurevich Wolfram Schulte Margus Veanes Foundations of Software Engineering Microsoft.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
CS527 Topics in Software Engineering (Software Testing and Analysis) Darko Marinov September 9, 2010.
Mark Marron 1, Deepak Kapur 2, Manuel Hermenegildo 1 1 Imdea-Software (Spain) 2 University of New Mexico 1.
Applications of Dynamic Programming and Heuristics to the Traveling Salesman Problem ERIC SALMON & JOSEPH SEWELL.
Symbolic Execution with Abstract Subsumption Checking Saswat Anand College of Computing, Georgia Institute of Technology Corina Păsăreanu QSS, NASA Ames.
Finding Errors in.NET with Feedback-Directed Random Testing Carlos Pacheco (MIT) Shuvendu Lahiri (Microsoft) Thomas Ball (Microsoft) July 22, 2008.
Directed Random Testing Evaluation. FDRT evaluation: high-level – Evaluate coverage and error-detection ability large, real, and stable libraries tot.
Symbolic and Concolic Execution of Programs Information Security, CS 526 Omar Chowdhury 10/7/2015Information Security, CS 5261.
Reducing Combinatorics in Testing Product Lines Chang Hwan Peter Kim, Don Batory, and Sarfraz Khurshid University of Texas at Austin.
A Test Case + Mock Class Generator for Coding Against Interfaces Mainul Islam, Christoph Csallner Software Engineering Research Center (SERC) Computer.
Using Symbolic PathFinder at NASA Corina Pãsãreanu Carnegie Mellon/NASA Ames.
Automated Test Generation CS Outline Previously: Random testing (Fuzzing) – Security, mobile apps, concurrency Systematic testing: Korat – Linked.
Daniel jackson & sarfraz khurshid lcs retreat ·martha’s vineyard · june 2k unintentional naming.
( = “unknown yet”) Our novel symbolic execution framework: - extends model checking to programs that have complex inputs with unbounded (very large) data.
CS527 Topics in Software Engineering (Software Testing and Analysis) Darko Marinov September 7, 2010.
Random Test Generation of Unit Tests: Randoop Experience
Symbolic Execution in Software Engineering By Xusheng Xiao Xi Ge Dayoung Lee Towards Partial fulfillment for Course 707.
Symstra: A Framework for Generating Object-Oriented Unit Tests using Symbolic Execution Tao Xie, Darko Marinov, Wolfram Schulte, and David Notkin University.
(c) University of Washington20c-1 CSC 143 Binary Search Trees.
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
ALLOY: A Formal Methods Tool Glenn Gordon Indiana University of Pennsylvania COSC 481- Formal Methods Dr. W. Oblitey 26 April 2005.
제 9 주. 응용 -4: Robotics Artificial Life and Real Robots R.A. Brooks, Proc. European Conference on Artificial Life, pp. 3~10, 1992 학습목표 시뮬레이션 로봇과 실제 로봇을.
On the Relation Between Simulation-based and SAT-based Diagnosis CMPE 58Q Giray Kömürcü Boğaziçi University.
Hybrid BDD and All-SAT Method for Model Checking
Chapter 25 Binary Search Trees
Testing and Debugging PPT By :Dr. R. Mall.
A Test Case + Mock Class Generator for Coding Against Interfaces
RDE: Replay DEbugging for Diagnosing Production Site Failures
Dynamic Symbolic Data Structure Repair
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
Lecture 12 CS203 1.
Introduction to Data Structure
50.530: Software Engineering
CSC 143 Binary Search Trees.
Symbolic Execution and Test-input Generation
Presentation transcript:

Chandrasekhar Boyapati (Google) Sarfraz Khurshid (University of Texas) Systematic Software Testing: The Korat Aproach (ACM SIGSOFT Impact Paper Award) Chandrasekhar Boyapati (Google) Sarfraz Khurshid (University of Texas) Darko Marinov (University of Illinois) FSE 2012 Cary, NC November 15, 2012

Outline Korat overview Follow-up research History and lessons learned Example Technique Results Follow-up research History and lessons learned

Examples of Structurally Complex Data root service city washington building whitehouse wing west room oval-office camera data-type picture resolution 640 x 480 accessability public 1 3 2 Event 1 Event 2 Event 0 toplevel Event_0 ; Event_0 pand Event_1 Event_2 ISeq_0 ISeq_1 FDep_0 FDep_1 ; Event_1 be replication = 1 ; Event_2 be replication = 1 ; ISeq_0 seq Event_0 ; ISeq_1 seq Event_1 ; FDep_0 fdep trigger = Event_0 Event_1 ; FDep_1 fdep trigger = Event_1 Event_2 ; Event_1 dist=exponential rate=.0004 cov=0 res=.5 spt=.5 dorm=0 ; Event_2 dist=exponential rate=.0004 cov=0 res=.5 spt=.5 dorm=.5 ; module meta_spec sig Signature sig Test static sig S1 extends Test static sig S0 extends Signature fun Main() {} run Main for 3

Running Example class BST { Node root; int size; static class Node { Node left, right; int value; } B0: 3 root N0: 2 left right N1: 1 N2: 3 …

Example Valid Inputs Trees with exactly 3 nodes left right N0: 2 N1: 1 B0: 3 root right N0: 1 N1: 2 N2: 3 B0: 3 root right left N0: 1 N1: 3 N2: 2 B0: 3 root left right N0: 3 N1: 1 N2: 2 B0: 3 root left N0: 3 N1: 2 N2: 1 B0: 3 root

Running Example class BST { Node root; int size; static class Node { Node left, right; int value; } B0: 3 root N0: 2 left right N1: 1 N2: 3 …

Example Invalid Inputs Object graphs violating some validity property left right N0: 2 N1: 1 N2: 3 B0: 3 root left right N0: 3 N1: 1 N2: 2 B0: 3 root left right N0: 2 N1: 1 N2: 3 B0: 2 root

Running Example class BST { Node root; int size; static class Node { Node left, right; int value; } B0: 3 root N0: 2 left right N1: 1 N2: 3 …

Key Challenges How to formally describe valid inputs? How to make they input space finite? How to generate valid inputs?

Example Predicate boolean repOk(BST t) { return isTree(t) && isOrdered(t) && hasCorrectSize(t); } boolean isTree(BST t) { if (t.root == null) return true; // empty tree Set visited = new HashSet(); visited.add(t.root); List workList = new LinkedList(); workList.add(t.root); while (!workList.isEmpty()) { Node current = (Node)workList.removeFirst(); if (current.left != null) { if (!visited.add(current.left)) return false; // sharing workList.add(current.left); } if (current.right != null) { if (!visited.add(current.right)) return false; // sharing workList.add(current.right); } return true; // no sharing

Example Predicate boolean repOk(BST t) { return isTree(t) && isOrdered(t) && hasCorrectSize(t); } boolean isTree(BST t) { if (t.root == null) return true; // empty tree Set visited = new HashSet(); visited.add(t.root); List workList = new LinkedList(); workList.add(t.root); while (!workList.isEmpty()) { Node current = (Node)workList.removeFirst(); if (current.left != null) { if (!visited.add(current.left)) return false; // sharing workList.add(current.left); } if (current.right != null) { if (!visited.add(current.right)) return false; // sharing workList.add(current.right); } return true; // no sharing

Input Space All possible object graphs with a BST root left right

Key Challenges How to formally describe valid inputs? How to efficiently generate valid inputs?

Example Input Space 1 BST object, 3 Node objects: total 11 fields root size left right value null 3 2 1 B0 N0 N1 N2 root size left right value null N0 N1 N2 3 null N0 N1 N2 1 2 3 4 * 1 * (4 * 4 * 3)3 > 218 inputs, only 5 valid

Bounded-Exhaustive Generation Given Predicate Finitization that bounds input space Generate All nonisomorphic valid inputs up to given bound Simple “solution” Enumerate entire input space Run predicate on each input Generate input if predicate returns true Infeasible for sparse input spaces (#valid<<#total)

Bounded-Exhaustive Generation Given Predicate Finitization that bounds input space Generate All nonisomorphic valid inputs up to given bound Naïve approach Enumerate entire input space Run predicate on each input Generate input if predicate returns true Infeasible for sparse input spaces (#valid<<#total)

Example Input Each input is a valuation of fields B0 N0 N1 N2 root size left right value null 3 2 1 left right N0: 2 N1: 1 N2: 3 B0: 3 root

Example Execution [ B0.root ] [ B0.root, N0.left, N0.right ] boolean repOk(BST t) { return isTree(t) && …; } boolean isTree(BST t) { if (t.root == null) return true; Set visited = new HashSet(); visited.add(t.root); List workList = new LinkedList(); workList.add(t.root); while (!workList.isEmpty()) { Node current = (Node)workList.removeFirst(); if (current.left != null) { if (!visited.add(current.left)) return false; workList.add(current.left); } if (current.right != null) { if (!visited.add(current.right)) return false; workList.add(current.right); } return true; left right N0: 2 N1: 1 N2: 3 B0: 3 root [ B0.root ] [ B0.root, N0.left, N0.right ] [ B0.root, N0.left ] field accesses: [ ]

Failed Execution Failed after few accesses for a concrete input Would fail for all inputs with partial valuation B0 N0 N1 N2 root size left right value null 3 2 1

Failed Execution Failed after few accesses for a concrete input Would fail for all inputs with partial valuation B0 N0 N1 N2 root size left right value null 3 2 1

Failed Execution Failed after few accesses for a concrete input Would fail for all inputs with partial valuation B0 N0 N1 N2 root size left right value null 3 2 1 B0 N0 N1 N2 root size left right value - 1 * 3 * 4 * 4 * 3 * 4 * 4 * 3 > 212

Key Idea Monitor execution of predicate Record field accesses Prune large chunks of input space on each failed execution Use backtracking to efficiently enumerate valid inputs

Results for Structure Generation Results from the original paper [ISSTA’02] benchmark size input space candidate inputs valid inputs time [sec] BST 8 12 253 292 54418 12284830 1430 208012 2 234 HeapArray 6 8 220 229 64533 5231385 13139 1005075 2 43 java.util.LinkedList 291 2150 5455 5034894 4140 4213597 2 690 java.util.TreeMap 7 9 292 2130 256763 50209400 35 122 9 2149 java.util.HashSet 7 11 2119 2215 193200 39075006 2386 277387 4 927 IntentionalName 5 250 1330628 598358 63

Outline Korat overview Follow-up research History and lessons learned Research projects Tool embodiment in academia and industry Ph.D. dissertations History and lessons learned

Since Korat: Research projects Lazy initialization in generalized symbolic execution [TACAS’03] Data structure repair [SPIN’05, ASE’07, OOPSLA’07] Glass-box testing [OOPSLA’06,’08,’10] Parallel Korat [FSE’07 – with Google, ICST’09] Ranged symbolic execution [OOPSLA’12] Dynamic programming [FSE’12] Publicly available Korat tool [ICSE Demo’07] http://korat.sourceforge.net/ Korat part of AsmLT/SpecExplorer from MSR

Generalized symbolic execution [TACAS’03: Khurshid, Pasareanu, Visser] Symbolic execution for primitives Concrete execution for references using lazy initialization on access, e.g., consider “t.next” Originally implemented using Korat code Source to source translation Shadow boolean fields to monitor field accesses Bound on number of objects for exhaustive generation Recently included in UC-KLEE [Ramos+CAV’11] E0 next E1 t E0 next E1 t E0 next E1 t null E0 next E1 t t E0 next E1 ?

Data structure repair Goal: recover from runtime errors [SPIN’05: Khurshid, Garcia, Suen] [ASE’07: Elkarablieh, Garcia, Suen, Khurshid] [OOPSLA’07: Elkarablieh, Khurshid, Vu, McKinley] [ISSTA’08: Elkarablieh, Marinov, Khurshid] Goal: recover from runtime errors Approach: repair corrupt structure w.r.t. the violated repOk – Korat + symbolic execution binary search tree binary search tree 4 2 5 3 6 1 1 2 3 6 5 4

PRUNED Glassbox testing [OOPSLA’06: Boyapati, Darga] [OOPSLA’08: Roberson, Harries, Darga, Boyapati] [OOPSLA’10: Roberson, Boyapati] Check inputs that take same execution path together insert(3,x) insert(3,x) 5 2 1 4 3 insert(3,x) 5 2 6 4 3 7 PRUNED 5 2 6 1 4 5 2 6 1 4 3

Parallel Korat Problem: Korat search is mostly sequential [FSE’07: Misailovic, Milicevic, Petrovic, Khurshid, Marinov] [ICST’09: Siddiqui, Khurshid] Problem: Korat search is mostly sequential Search tree is highly imbalanced Solutions for load balancing Randomized candidate selection Dynamic work stealing

Ranged symbolic execution [OOPSLA’12: Siddiqui, Khurshid] A concrete input encodes the state of a run of symbolic execution analysis Two (in-order) inputs range the analysis run unexplored explored test

Dynamic programming [FSE’12: Zaeem, Khurshid] Writing constraints using recursive repOk’s Solve constraints using dynamic programming Iter. 0: Iter. 1: Iter. 2: Null Null Null Null Null

Korat at Microsoft Research Korat reimplemented as part of AsmL test tool in Foundations of Software Engineering group Predicates in Abstract state machine Language (AsmL), not in Java or C# Some extensions (Controlled) non-exhaustive generation Generation of complete tests from partial tests Library for faster generation of common datatypes Enabled finding numerous errors XML tools, web-service protocols, SSLStream, MSN Authentication, …

Some Comments from Microsoft Users Positive comments on AsmL and Korat “So far our stateless AsmL models are pretty successful.” “AsmL parameter generation tool is quite convenient and powerful.” Negative comments on AsmL not Korat “Most of our testers prefer to write as much C# as possible.” “Very difficult to debug AsmL.” Result: SpecExplorer tool for C# Korat is Korat

Since Korat: Ph.D. dissertations Bassem Elkarablieh [UT Austin Ph.D.’09, Google] “Assertion-based Repair of Complex Data Structures” Michael Roberson [U. Mich. Ph.D.’11, Microsoft] “Glass Box Software Model Checking” Junaid Haroon Siddiqui [UT Austin, Ph.D.’12, LUMS] “Improving Systematic Constraint-driven Analysis using Incremental and Parallel Techniques”

Outline Korat overview Follow-up research History and lessons learned

Before Korat: TestEra TestEra [SOFTMC’01,ASE’01] described input validity properties using Alloy by Jackson et al. Example pred isTree(BST t) { all n : t.root.*(left+right) { n !in n.^(left+right) lone n.~(left+right) no n.left & n.right } } Advantages Much more succinct than repOk in Java Existing tool for generation (Alloy Analyzer/SAT) Challenge: requires learning a new language

Korat: Use Implementation Language Problem origin Darko presented TestEra at a group meeting Chandra asked if Java could be used instead of Alloy for writing predicates The name repOk is from Barbara Liskov’s book/class Advantages Familiar language Existing development tools Predicates often already present Challenge: generate tests from predicates

A Bit of Korat Trivia: Name Origin Considered names for testing with Alloy TestAlloy, AlloyTest, ATest, TestA… TestEra Testing tool (Tester) using Alloy Precursor of CheckEra or VerifyEra Also: “saw” (the tool for cutting wood) in Darko’s native language Natural progression to testing with Java Korat “Saw” in one of Chandra’s native languages Not a breed of cats

Acknowledgements We are extremely grateful for the freedom that our advisors gave us to work on Korat Others: Alexandr Andoni, Dumitru Daniliuc, Michael Ernst, Viktor Kuncak, Alexandru Salcianu, Ilya Shlyakhter, Mandana Vaziri Martin Rinard (Chandra’s and Darko’s advisor) Daniel Jackson (Sarfraz’ advisor)

Korat: Some Lessons Learned Communicate There would be no Korat without an internal talk Collaborate There would be no Korat without three students working together We never worried about getting “credit” Persevere Some early criticism: static analysis (in particular shape analysis) can check the same properties Other “criticism”: Korat paper was first rejected There would be no Korat without a resubmission