I analyzed my coverage report and discovered that there is a lot of uncovered ranges in timespec math functions. I decided to go into it. I consulted it with dr Joel Sherrill and he advised me to write wrapper in RTEMS Classic API for these timespec functions as they are useful to users who do math on timespecs.
Maybe I start from begin :)
Timespec is struct defined in time.h header file. It is one of widely used elapsed time storage format. It is provided in GNU C Library as described here .
Timespec consist of two members:
I look at other wrapper for score functionality available in Classic API - Chains. Looking at it I wrote my wrapper for all timespec related functions. I made them all inline, all names are now lower case and all starts from rtems_timespec.
long int tv_sec
This represents the number of whole seconds of elapsed time.
long int tv_nsec
This is the rest of the elapsed time (a fraction of a second), represented as the number of nanoseconds. It is always less than one billion.
After wrapper had been prepared I started writing new test hitting these functions. I named it sptimespec01 and it is now in rtems testsuite in sptests directory. I simply analyzed these routines code and do some math on timespecs to cause all branches were hitted and all instructions executed. It is working! This new test covered about 56 instructions. Quite good :)
All code including timespec sapi wrapper and new test can be found at rtems github or by simple click here