Reply by Marco November 4, 20052005-11-04
"I have been able to perform some testings on host, but I need to do
many modifications to the original code in order to be able to compile
it with a host compiler."

 What mods? This is probably a good thing since you want to isolate
target specific stuff from your "problem solution" code.  We target 16
or 32 bit processors that can use standard C ( easily compiles for host
and target) so maybe I can't relate to your particular environment.

I'm not convinced unit testing on the target is worth the effort. I
have tried a fair number of tools and most are a pain to use. Better to
convince your boss that this will cost too much time and money.  On the
other hand, good unit tests ( -> good test cases) on the host is a must
so you're not trying to debug junk on the target.

If your target is big endian, you may want to setup Linux and gcc on a
cheap Mac PowerPC box (get 'em why you can) so you don't run into that
thorny issue.

Reply by Chris Hills November 3, 20052005-11-03

Hi


See 

www.hitex.de

They do the Tessy tool that will do in target testing when used with an
ICE. That is hard real time unit testing on the actual target. 

Once set up it is fully automated.


In article <1130802311.875374.193990@g43g2000cwa.googlegroups.com>,
Enrique Lizarraga <enrique.lizarraga@gmail.com> writes
>Good afternoon: > >I need to perform some unit testing and I'm totally lost. Right now I'm >working in two projects. In the first one I use a Freescale MC908AS60A >microcontroller with Cosmic compiler and the other one a Infineon XC161 >with Tasking C166 compiler. > >The manager is asking me to perform Unit testing on host and on target. >I have been able to perform some testings on host, but I need to do >many modifications to the original code in order to be able to compile >it with a host compiler. > >I have reviewed some of the automated tools available and none of those >have the compiler-target combination I need. > >Did any of you have performed a Unit testing similar to this one?? How >do you modify the code to be able to use 2 different compilers?? How do >you perform on target testing?? > >Thank you. >
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply by JohnK November 3, 20052005-11-03
> How much effort you build these wrappers? > > Sam
Hi Sam Depending on the functionality to test, the simulator, the system your runnning on and so on ... a couple of hours (having a small setup) - a couple of days () - to a couple of weeks if you want to reuse the efforts and system ... The minimum system, is the easiest, but also most often the one you newer maintain!!!!! The more complex (more functionality and flexability) the more and ofte it's used. The more reliable is gets (evetually) ... Examples: Ex.1) eCos on target, linux + eCos on PC You have a module with 3 message-queues (eg. for your eCos target) You pull out the required module, compile it with your eCos wrapper/simulator (your then proberly running on a linux platform) ... The test code - create a task (the module we test), and a task to the TestcaseExecuter. You identifies the 3 msg-queues. You generate a simle test msg, putting a test msg on the upper A-queue. Now you awaits output from the module - in this case a signal out on queue-B. Look into the result. If result is Ok, msg was received on the correct queue ... this test (though simple) is home free. The adwantage here is that you haven't change anything inside the module beeing tested. (only look into little/big endians, and those specific register routines.) Ex.2) if your' not having any 'adwanced' and biig RTOS on your target - another method would be almost the same. Since you dont have a RTOS, everything is function/call based. Well well ... just call the function (or module to test) with the required test paramater(s), and wait for any outcome..... Ex.3) If you have you own RTOS/Kernel you might port the API to a windows or Linux pletform. Giving support for queues, memory management, scheduling, task handling etc ... This wrapper layer, makes it wery nice duing of-ftarget testing ... This is actually why many RTOS's is ported to a windows or linux platform. It giving you the opportunity to do test off-target. Ex.4) Intarget-testing: I'll skip this here .... but this is also a nice approach. TDD: If you dont want to make lots of test cases _after_ having developed your system, I could suggest using a more modern approach - TDD. (TDD = Test Driven Development.) Basically you have a simple setup with a very small skeleton/testsystem. You specifies what is the sucess criteria for this test (=specification), and implement this. This is a LED lighting red or green. Initially its red (=testcase failed). Then you add more and more functions/functionality, that exactly does what this specification requires..... when the LED turn green ... you home free! Search the www for better and more informative informations ... dont flame me folks for giving a short fluffy input .... plzzz search words: tdd junit ctdd - I know several people are using junit - including a colleage of mine - and he loves it! - I have seen graphical front-ends (windows) with real LED's indicating testcase and progress ... - the framework is open and downloadble from the web ... - links http://www.methodsandtools.com/mt/download.html http://software-quality.blogspot.com/ http://software-quality.blogspot.com/2005/09/test-driven-project-management.html http://software-quality.blogspot.com/2005/07/customer-test-driven-development-ctdd.html http://www.jera.com/techinfo/jtns/jtn002.html So here the answer to "How much effort you build these wrappers?" depends on many factors .. - your target (PC or an embedded platform) - your develop system and capability - your short/middle/long term requirements (and available efforts/resources) - type of testing (one-time-only, regression, black/white box etc etc) - but also stuff like test coverage, code coverage, branch coverage, and more ... - starting from scratch now, coding/testing along with development, are you making fast prototyping project ... etc - Is the requirements firm and stable (if ever), or do you create the as you develop ... - Your customer ... is he in on this, support on open issues .... - now I stop ... you proberly got the picture now :-) I hope this gave you a couple of ideas ... rg, johnk
Reply by bsder November 3, 20052005-11-03
JohnK wrote:
> Hi > > Optimal result is acheived, if you make as small changes as possible (no > #ifdef or simulary)... > > Ofcause you need to recompile for your host and target respectively ... > depending on where the tests run. > > I have often made a small (!Note here below) module that encapsulate the > module/objects or even smaller a function. > > !Note: > this module (wrapping the fnc's being tested) needs to simulate > what-ever environemnt your fnc's requires, and depending on its Linux, > Windows or a properitary RTOS, this needs to be ported to the > simulation/testing environment. > > Then - with these basic functionalities supported - it easy to start > testing embedded code on your eg. PC > > rg, > johnk
How much effort you build these wrappers? Sam
Reply by JohnK November 2, 20052005-11-02
Hi

Optimal result is acheived, if you make as small changes as possible (no 
#ifdef or simulary)...

Ofcause you need to recompile for your host and target respectively ... 
depending on where the tests run.

I have often made a small (!Note here below) module that encapsulate the 
module/objects or even smaller a function.

!Note:
this module (wrapping the fnc's being tested) needs to simulate what-ever 
environemnt your fnc's requires, and depending on its Linux, Windows or a 
properitary RTOS, this needs to be ported to the simulation/testing 
environment.

Then - with these basic functionalities supported - it easy to start testing 
embedded code on your eg. PC

rg,
johnk 

Reply by EventHelix.com October 31, 20052005-10-31
Use conditional compilation to handle the compiler specific changes.
Drive the unit testing from stub code.

I would recommend trying out cppunit:
http://cppunit.sourceforge.net/cppunit-wiki

CCPUnit lets you automate the tests. You can the unit tests as
regression tests in later releases.

--
EventStudio System Designer 2.5 - http://www.EventHelix.com/EventStudio
Sequence Diagram Based Real-time and Embedded System Design Tool

Reply by Enrique Lizarraga October 31, 20052005-10-31
Good afternoon:

I need to perform some unit testing and I'm totally lost. Right now I'm
working in two projects. In the first one I use a Freescale MC908AS60A
microcontroller with Cosmic compiler and the other one a Infineon XC161
with Tasking C166 compiler.

The manager is asking me to perform Unit testing on host and on target.
I have been able to perform some testings on host, but I need to do
many modifications to the original code in order to be able to compile
it with a host compiler.

I have reviewed some of the automated tools available and none of those
have the compiler-target combination I need.

Did any of you have performed a Unit testing similar to this one?? How
do you modify the code to be able to use 2 different compilers?? How do
you perform on target testing??

Thank you.