简体   繁体   中英

TestRealTime: How to test a realtime Operating System with Rational Test Real Time

On an AUTOSAR realtime Operating System (OS), the software architecture is layered separately (User space, systemcall interface, kernel space). Also, the switching between user context and kernel context is handled by hardware-specific infrastructure and typically the context switching handler is written in assembly code.

IBM® Rational® Test RealTime v8.0.1 (RTRT) currently treats embedded-assembly-code as mentioned in the below Q&A.

https://www.ibm.com/support/pages/how-treat-embedded-assembly-code ( ** )

RTRT tool using code insertion technololy (technically known as instrumentation process) to insert its own code to measure code coverage of the system under test.

In my case, OS with full pre-emptive design doesn't have the termination points. As the result, OS always runs unless loss of power supply. If there's no work, OS shall be in sleep (normally an idle state and do nothing). If any unexpected errors or exceptions occurs, OS shall be shutdown and run into an infinite loop . These indicated that OS is always running .

I learnt from ( ** ) and ensure context switching working correctly. But I don't know how to teach RTRT to finish its postprocessing (consisting of attolcov and attolpostpro ) in a right way. Note that OS has worked correctly throughout all my tasks already and was confirmed by debugger. SHUTDOWN OS procedure has been executed correctly and OS has been in INFINITE loop (such as while(1){}; ) 在此处输入图像描述

After RTRT ends all its processes, the coverage report of OS module is still empty.

Based on IBM guideline for RTRT https://www.ibm.com/developerworks/community/forums/atom/download/attachment_14076432_RTRT_User_Guide.pdf?nodeId=de3b0048-968c-4111-897e-b73654af32af

在此处输入图像描述

RTRT provides two breakpoints to mark the logging point ( priv_writeln ) and termination point ( priv_close ) of its process.

I already tried to drive from INFINITE (my OS) to priv_close (RTRT) by interacting PC register and all Context Switching registers with the Lauterbach debugger but RTRT coverage report was empty even thougth none of errors happened. No error meant that the context switch from kernel space to user space is able to work well and main() function returned correctly.

Solved the problem.

It definitely came from context switching process of Operating System.

In my case, I did a RAM dump to see how user context memory (befor Starting OS) look like.

After that, I will backup all context areas and retore them from Sleep or Infiniteloop in the exact order.

在此处输入图像描述

Hereby, RTRT can know the return point and reach its own main() function's _exit to finish report generation progress.

Finally, the code coverage report has been generated.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM