740 likes | 869 Views
Master 2 Recherche S&L « Méthodes de test ». Test des Automates Temporisés. Stavros Tripakis Laboratoire Verimag. Modèles, modèles, …. Les machines de Mealy Entr é es/sorties synchrones Bonnes pour circuits/programmes synchrones Les systèmes de transitions étiquetés
E N D
Master 2 Recherche S&L« Méthodes de test » Test des Automates Temporisés Stavros Tripakis Laboratoire Verimag
Modèles, modèles, … • Les machines de Mealy • Entrées/sorties synchrones • Bonnes pour circuits/programmes synchrones • Les systèmes de transitions étiquetés • Bons pour systèmes asynchrones (ex. protocoles de communication) • Aspects temps-réel pas bien modélisés • Les automates temporisés
conforme ? Exemple s1 s1 A? A? B! s2 s2 Spécification: pour chaque entrée A, retourner un B Implémentation (candidate)
Exemple s1 s1 Comment capter la non-conformité ? A? A? B! s2 s2 Spécification: pour chaque entrée A, retourner un B Implémentation (candidate)
SUT inputs outputs Tester Verdicts (pass/fail) Real-time testing
Exemple s1 s1 Comment trouver la valeur « timeout » lors du test ? A? A? B! s2 s2 Spécification: pour chaque entrée A, retourner un B Implémentation (candidate)
Plan of talk • Specification model • Conformance relation • Analog & digital tests • Test generation • Tool and case studies
Plan of talk • Specification model: timed automata with inputs, outputs and unobservable actions. • Conformance relation • Analog & digital tests • Test generation • Tool and case studies
a? b! x 4 x:=0 Simple example 1 “Output b at most 4 time units after receiving input a.”
a? b! x 4 x:=0 Simple example 2 “Output b at most 4 time units after receiving input a, except if you fail, in which case output a failure notice at most after 8 time units.” fail! x 8 Unobservable action
Compositional specifications A B C Compositional specifications with internal (unobservable) actions.
internal (unobservable) actions. Compositional specifications
Modeling assumptions on the environment env spec Export (make observable) interactions between the specification and its environment.
a? b! x 4 x:=0 Simple example 3 “Output b at most 4 time units after receiving input a, provided a is received no later than 10 time units.” a? b! a! y 10 y:=0 A compositional modeling of the same example.
Simple example 3 “Output b at most 4 time units after receiving input a, provided a is received no later than 10 time units.” a? b! x 10 x 4 x:=0 x:=0 Constraints on the inputs model assumptions. Constraints on the outputs model requirements. Specification is not always input-complete.
Conclusion: a rich TA model • Time non-determinism: • Cannot impose exact input or output times. • Action non-determinism: • Model failures, abstract details. • Partial observability: • Internal actions of compositional specifications. • Not input-complete: • Model assumptions on the environment.
Plan of talk • Specification model • Conformance relation: an extension of the “untimed” relation “ioco”. • Analog & digital tests • Test generation • Tool and case studies
Conformance relation • A timed extension of Tretmans’ “ioco”: timed input-output conformance relation (tioco). • Informally, A tioco B if • For any observable behavior p of B, any possible observable output of A after p (including a delay) is also a possible observable output of B after p. • To put it otherwise: • Implementation accepts more inputs and produces fewer outputs than specification.
Conformance relation • Formally: A tioco B (A: implementation, B:specification) iff Traces(B). out(A after ) out(B after )
A after = {s | Seq. s0 s proj(,Obs)=} Conformance relation • where: out(S)= delays(S) outputs(S)
delays(S) = {tR | sS. UnobsSeq. time() = t s } a outputs(S) = {aOutputs | sS . s } Conformance relation • where:
a? b! x 4 x:=0 Spec: Examples “Output b at most 4 time units after receiving input a.”
a? a? b! b! x 4 x:=0 x:=0 x = 4 Spec: Impl 1: Examples “Output b at most 4 time units after receiving input a.”
a? a? b! b! x 4 x:=0 x:=0 x = 4 Spec: Impl 1: Examples “Output b at most 4 time units after receiving input a.” OK!
a? a? a? b! b! b! x 4 x 2 x:=0 x:=0 x:=0 x = 4 Spec: Impl 1: Impl 2: Examples “Output b at most 4 time units after receiving input a.” OK!
a? a? a? b! b! b! x 4 x 2 x:=0 x:=0 x:=0 x = 4 Spec: Impl 1: Impl 2: Examples “Output b at most 4 time units after receiving input a.” OK! OK!
a? a? b! b! x 4 x:=0 x:=0 x = 5 Spec: Impl 3: Examples “Output b at most 4 time units after receiving input a.”
a? a? b! b! x 4 x:=0 x:=0 x = 5 Spec: Impl 3: Examples “Output b at most 4 time units after receiving input a.” NOT OK!
a? a? b! b! x 4 x:=0 x:=0 x = 5 Spec: Impl 3: a? Impl 4: Examples “Output b at most 4 time units after receiving input a.” NOT OK!
a? a? b! b! x 4 x:=0 x:=0 x = 5 Spec: Impl 3: a? Impl 4: Examples “Output b at most 4 time units after receiving input a.” NOT OK! NOT OK!
Plan of talk • Specification model • Conformance relation • Analog & digital-clock tests • Test generation • Tool and case studies
SUT inputs outputs Tester Verdicts (pass/fail) Real-time testing How accurate is this clock ?
a? a? b! b! x:=0 x:=0 x = 4 x = 4 Spec: Impl 1: Example “Output bexactly 4 time units after receiving input a.” OK! a? b! NOT OK! Impl 2: x:=0 x = 3.99
Timed tests • Two types of tests: • Analog-clock tests: • Can measure real-time precisely • Difficult (impossible) to implement for real-time SUTs • Good (flexible) for discrete-time SUTs with unknown time step • Digital-clock tests: • Can count “ticks” of a periodic clock/counter • Implementable for any SUT • Conservative (may say PASS when it’s FAIL)
a a b b c c 1.3 2.4 2.7 time time Timed tests • Analog-clock tests: • They can observe real-time precisely, e.g.: • Digital-clock (or periodic-sampling) tests: • They only have access to a periodic clock, e.g.: 1 2 3
Note • Digital-clock tests does not mean we discretize time: • The specification is still dense-time • The capabilities of the observer are discrete-time ) • Many dense-time traces will look the same to the digital observer
Untimed tests • Can be represented as finite trees (“strategies”): i o1 o2 o3 o4 fail i1 i2 i3 … … fail pass
Digital-clock tests • Can also be represented as finite trees: i Models the tick of the tester’s clock o1 o2 o3 o4 tick fail … i1 i2 i3 … … fail pass
Analog-clock tests • Cannot be represented as finite trees: i … o1 o2 o3 o4 0.1 0.11 0.2 fail i1 i2 i3 Infinite number of possible delays … … fail pass
1.3 0.8 a b a b 1.3 2.1 Analog-clock tests • Solution: build the test on-the-fly i i time 0
Test generation • Analog-clock tests: • Cannot be represented statically as finite trees: infinite number of possible inputs delays • Solution: on-the-fly testing: compute the test while you are testing ! • Digital-clock tests: • Can be generated both statically and on-the-fly. • In both cases: symbolic test generation
Test generation principle • The tester is a state-estimator: it keeps a set of possible states of the SUT, according to the specification. • Updates this set with each new observation. • Gives inputs to SUT from time to time. • Announces FAIL if ever set becomes empty. • Announces PASS when tired of testing …
observation (event or delay) runs matching observation next estimate Test generation principle current estimate
Test generation principle • Sets of states are represented symbolically (standard timed automata technology, DBMs, etc.) • Updates amount to performing some type of symbolic reachability. • Can be used for on-the-fly testing (both for analog and digital) or static test generation (for digital only).
Update operators for analog tests • Given current state estimation S … • Given observed event a (input or output): dsucc(S, a) : all states that can be reached from a state in S after performing a transition a. a dsucc(S, a) = {s’ | sS. s s’}
Update operators for analog tests • Given current state estimation S … • Given time delay t: tsucc(S, t) : all states that can be reached from a state in S after performing a run of unobservable actions of total duration t. tsucc(S, t) = {s’ | sS. UnobsSeq. s s’ time()=t}
1.3 a 1 0.3 a Putting it all together i S S’ = dsucc(tsucc(S,1.3), a)
Update operator for digital tests • First, a trick: • tick is an observable event: • Models the ticks of the observer’s clock. • Can also model skew, etc, using different “Tick” automata. “Tick” original specification automaton tick! z = 1 z:= 0
Update operator for digital tests • Given S and observed event a (could be tick): succ(S, a)= all states that can be reached from a state in S after performing a run of unobservable actions that ends with a. succ(S, a)= {s’ | sS. UnobsSeq. s s’} a
tick Updates for digital tests i S S’ = succ(S, tick) a S’’ = succ(S’, a)