czwartek, 30 sierpnia 2012

First task


I'm here again. I would like to give a short note about my first task. I hope it could be interesting to someone :P

My first task in coverage improvement was concerned about small uncovered range in coremsg.c file from cpukit/score in rtems tree. In this file there is function which initialize message queue. Uncovered range was pointed to me by dr Joel Sherrill, my ESA SOCIS mentor. You can see this range at: uncovered range in annotated report from Joel's analysis

When I analyzed this annotated report it seems obvious for me that condition in if-statement
if(allocated_message_size < maximum_message_size)
is never true. I analyzed also math above it and it confused me a bit. It seemed to always increase value of allocated_message_size or at least ensure that it would be equal to maximum_message_size.

I shared with my observations with dr Joel and we agreed that if-statement can be removed. I prepared patch and posted it to rtems-devel mailing list. When I got first reply I decided to look this once again. I read comment and I understood that in one case allocated_message_size can be less than maximum_message_size even though math above appear to increase it value. When can it be? When overflow occur. 
According to this new look I revert my changes in coremsg.c and write new test - my first test :) - sp77. I attempt in it to cause overflow during creating message queue. It was very simple, I had to pass UINPTR_T-2 as maximum_message_size parameter in rtems_message_queue_create method.

Luckily, this was enough to cover completely coremsg.c :D First task passed!

P.S. My first test can be easily found at rtems github. It is direct link to it:
patch introducing sp77 test


  • a lot! 1. how to add new test?
  • how to run only one test for coverage purposes
  • what is message queue :)
  • be careful with overflow! 
  • creating patches

Brak komentarzy:

Prześlij komentarz