1 / 10

Static Analysis Methods

Static Analysis Methods. CSSE 376 Software Quality Assurance Rose-Hulman Institute of Technology March 20, 2007. Outline. Cyclomatic complexity Formal verification Symbolic execution. Cyclomatic Complexity. Measure of the complexity of a function Defines a minimum number of tests to run

july
Download Presentation

Static Analysis Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Static Analysis Methods CSSE 376 Software Quality Assurance Rose-Hulman Institute of Technology March 20, 2007

  2. Outline • Cyclomatic complexity • Formal verification • Symbolic execution

  3. Cyclomatic Complexity • Measure of the complexity of a function • Defines a minimum number of tests to run • Vg = # regions of planar flow graph • Vg = E - N + 2 (edges - nodes + 2) • Vg = P + 1 (predicates + 1)

  4. Example of Cyclomatic Complexity (Corrected 3/29/07)

  5. Using Cyclomatic Complexity • Vg is the number of independent paths through the function • Each path should be tested at least once • Vg is also a measure of complexity: a large value is a warning that the code may need extra testing or should be rewritten

  6. Cartoon of the Day

  7. Formal Verification • Compare implementation to a formal specification • Use rules like Assignment Axiom: /* P(E) */ V = E; /* P(V) */

  8. Automated Support for Formal Verification • Simple rules like Assignment Axiom can be automated. • Some formulas will need to be simplified for tools to recognize similarity. • Some theorems may need to be proved to complete the verification

  9. Symbolic Execution • Execution of code using symbolic values instead of real data • Compare symbolic values with expected values (results) • Path Condition: Condition on input variables under which this path is executed

  10. Example Program Path Condition 1: read c; True 2: r = 0; True 3: while (c > 0) { True 4: r = r + a; c0 > 0 5: c = c - 1; } c0 > 0 6: print r; c <= 0

More Related