Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
05/24/12 02:56
Read: 632 times

#187488 - I do lot of testing in test bench on PC
Responding to: Michael Karas's previous message
I often write and test quite significant parts of code on a PC.

In an environment where the "main" application looks at inputs, sets outputs, picks up measurements and data from input ring-buffers and sends to output ring buffers, I can write code that uses TCP connections or threads to pick up data from outgoing queues and process, and to generate data and feed to input queues.

And when using a compiler that supports "inline", port access functions can be encapsulated into helper functions: "draw_relay0()" which is inlined to a port pin access on target hardware but interacting with the test bench code when testing on the PC.

Actual interrupts or peripherial code can not be tested in this kind of environment. But that isn't really a problem. The basic interrupt and peripherial code is just standard library code already tested and used by other projects. Additional business logic needed in an ISR is normally very trivial - maybe count down some timer variables, look for stuff characters in a data sequence to separate data into packets etc.

In the end, lots of business logic (which can be quite large) can be tested/debugged a long time before there exists any usable hardware. And the huge I/O bandwidth of a PC allows some tests that aren't practical to do in the real, embeddd, system. If working with a display controller software, the PC test bench can display the contents of internal display memory buffers in real time as the code draws text, images, ... Or when displaying scrolling/animating information, the test bench can capture frame-by-frame content and step forward/backward in produced output, to help spot drawing glitches that are too short to see on a real-target hardware with maybe 100Hz+ frame rate.

When testing communications code, a simulated environment allows the test bench code to introduce repeatable or random transfer errors to verify protocol recovery in a way that is hard/impossible to do with the real hardware.

List of 7 messages in thread
Unit Testing (on or off target)      David Good      05/23/12 10:29      
   Target - Yes or No      Michael Karas      05/23/12 22:39      
   Target - Yes or No      Michael Karas      05/23/12 22:39      
      I do lot of testing in test bench on PC      Per Westermark      05/24/12 02:56      
         Specifics of test setup      David Good      05/24/12 09:42      
            Is a progressive work      Per Westermark      05/24/12 12:05      
   Unit testing experience      Oliver Sedlacek      05/24/12 10:01      

Back to Subject List