Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
8.7 and design for testatbility
#1
It seems that the 8.7 rule contradict design for testability.
Infact when you have a static variabile defined at block level, right now you have no way to perform any white box testing withot changing/adding code to copy the value to a global variable.

Let me know

Giacomo
<t></t>
Reply
#2
Apologies for the long delay in replying to this question - it managed to go unnoticed.

Yes, Rule 8.7 does make it impossible to conduct white box testing without either adding code such as you suggest or using other devious means such as finding the address of the block-scope static, e.g. from a linker map file, and modifying is by means of a pointer. Neither approach is very satisfactory.

If you need to conduct white box testing then you would have good grounds for deviating from this rule.

Note: the equivalent rule in the recently-released MISRA C:2012 is advisory rather than required; it recognises the need to perform unit testing as being good grounds for not following the rule.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)