chapter 2.11 program validation. reliable system = reliable hardware and reliable software and...
TRANSCRIPT
![Page 1: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/1.jpg)
Chapter 2.11
Program
Validation
![Page 2: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/2.jpg)
Reliable System
=Reliable Hardware
AND
Reliable Software
AND
Compatible Hardware and Software
![Page 3: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/3.jpg)
Reliable Hardware
Good Design
Diagnostic Circuits
Build-in
Redundancy
Diagnostic Programs
![Page 4: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/4.jpg)
Reliable Software
should be
ADEQUATE(accomplishes the tasks it is used
for)
and
ROBUST(survives all abnormal inputs)
![Page 5: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/5.jpg)
Software Validation
Before being used
a program should be
VALIDATED
for
ADEQUACY and ROBUSTNESS
![Page 6: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/6.jpg)
Software Validation
WARNING !
Validation can never improve
the quality of software,
it can only prevent the use of
erroneous programs
![Page 7: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/7.jpg)
Program Errors
• Syntax errors– Detected by the compiler
• Run-time errors– The program stops with an error message– Special recovery software is activated
• Erroneous results– Consequences can be catastrophic !!!
Software engineering tries to push errors upwards in the list
![Page 8: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/8.jpg)
Mandatory Declarations
VAR LOAD, Force : REAL;BEGIN... L0AD := 1000.Undeclared:L0AD... Force := LOAD * ...
BEGIN... L0AD := 1000.... Force:= LOAD * ......
Cross reference: .. . L0AD : 15 LOAD : 20,27,39,44
Normal executionErroneous value of Force
No executionCompilation error
![Page 9: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/9.jpg)
Static vs. Dynamic Validation
• Static validation:– based on the analysis of the program – source code required– could guarantee correctness
• Dynamic validation (testing):– based on the execution of the program– only the object code is required– can only prove the presence of errors,
never their absence
![Page 10: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/10.jpg)
Bottom-up Validation
• Start with small building blocks
• Finish with the entire system
• Natural and intuitively attractive
• Major incompatibilities between building blocks discovered last
• For dynamic validation:– Test programs required for each building block
![Page 11: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/11.jpg)
Top-down Validation
• Start with the entire system, ignoring details.
• Finish with the small building blocks
• Somewhat counter-intuitive
• Major incompatibilities between building blocks discovered first
• For dynamic validation:– Dummy substitutes for all building blocks have to
be made for high-level tests.
![Page 12: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/12.jpg)
Static Validation Techniques
• Syntax checking by the compiler
• Manual code checking– Desk checking– Walk through– Inspection
• Data flow analysis
• Correctness proofs
![Page 13: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/13.jpg)
Static Validation Techniques
• Syntax checking by the compiler
• Manual code checking– Desk checking– Walk through– Inspection
• Data flow analysis
• Correctness proofs
![Page 14: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/14.jpg)
Static Validation Techniques
• Syntax checking by the compiler
• Manual code checking– Desk checking– Walk through– Inspection
• Data flow analysis
• Correctness proofs
![Page 15: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/15.jpg)
Manual code checking
• Desk checking– Informal code reading– preferably by somebody else
• Walk through– Formal meeting– Simulated execution of code on blackboard
• Inspection– Formal meeting– Contradictory discussion of code and
programming style
![Page 16: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/16.jpg)
Static Validation Techniques
• Syntax checking by the compiler
• Manual code checking– Desk checking– Walk through– Inspection
• Data flow analysis
• Correctness proofs
![Page 17: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/17.jpg)
Example : Second
order equation
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
![Page 18: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/18.jpg)
Dataflow of a :
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
![Page 19: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/19.jpg)
Dataflow of x1 :
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
![Page 20: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/20.jpg)
Uninitialized variable
?
x := ...
:= X
![Page 21: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/21.jpg)
Useless statement
Write x
x := exp1
x := exp2
Why this statement ???
![Page 22: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/22.jpg)
Static Validation Techniques
• Syntax checking by the compiler
• Manual code checking– Desk checking– Walk through– Inspection
• Data flow analysis
• Correctness proofs
![Page 23: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/23.jpg)
Correctness Proof
Inputs Outputs
Specifications
Program
EQ
UIV
AL
EN
CE
![Page 24: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/24.jpg)
Correctness Proof
• Formal proofs can be long and complex– Impossible for large systems– Very error prone– Could be automated
• Doesn't help with specification errors…
• Useful for well specified, short, but complex, algorithms.
![Page 25: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/25.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 26: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/26.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 27: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/27.jpg)
TESTING
"Testing can proof the presence of errors but not
their absence"
E.W.Dijkstra
![Page 28: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/28.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 29: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/29.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 30: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/30.jpg)
Test data
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
Tests should exercise all paths through a program
a b c d1 3 2 11 2 1 01 1 1 -3
![Page 31: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/31.jpg)
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
Test dataTests should exercise exceptional values
a b c d0 1 1 11 0 1 -41 1 0 1
![Page 32: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/32.jpg)
d > 0 ?
Read a,b,c
Write x1, x2
No
d:=b 2 - 4ac
d = 0 ?x1 := …
x2 := … x := …
Write x Write "no roots"
No
Test dataTests should exercise very large and very small values
a b c1 10000000001 10000000000
![Page 33: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/33.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 34: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/34.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations
![Page 35: Chapter 2.11 Program Validation. Reliable System = Reliable Hardware AND Reliable Software AND Compatible Hardware and Software](https://reader035.vdocuments.mx/reader035/viewer/2022062423/5697bfe91a28abf838cb6d1d/html5/thumbnails/35.jpg)
Dynamic Validation Techniques
• Testing– No guarantee !!! – Black box vs. white box testing.– Test data
• Debugging– The program state– Control flow breakpoints– Data flow breakpoints– Real time considerations