Using TestApe with gcc arm cross compiler

TestApe supports cross compiling on intel platforms for the ARM processor through the use of arm-linux-gnueabi-testape.a. This library is available in the linux installation packages. Cross compilation is not supported on any of the windows packages.

The implementation uses the arm-linux-gnueabi GNU sstandard C library that ships with the gnueabi toolchain. As default this library uses the software floating point model, but technically there should be no reason why -mfloat-abi=softfp and mfloat-abi=hard should not work. Also other standard C libraries should work as long as they adhere to the EABI standard. The following example shows how to compile and execute a test with the cross compiler and run the test in QEMU arm emulator.

testape arm-linux-gnueabi-gcc -o sample1 sample1.c calc.c add.c arm-linux-gnueabi-testape.a
qemu-arm -L /usr/arm-linux-gnueabi/lib/libc ./sample1

ARM and floating point return values

The gnueabi toolchain uses the software floating point model as default. It passes floating point value through the arm registers. The stack and register aligment as well as the floating point representation are affected by your choise of float versus double.

This is in contrast to the x86 platform which passes floating points on a seperate FPU stack and represents all type internally as 80 bit floating point. So on x86 it is not important, if your test do not accurately indicate if a return value is a floating point or not. TestApe will just push an integer representation onto the normal stack and a floating point representation onto the FPU stack.

However on the arm it is important that you cast the mock return value to the same return type as the mocked function would return normally. For example on Intel platforms this will work

  EXPECT(function_returning_float,10);
  EXPECT(function_returning_double,10);

but on ARM platforms you need to do this

  EXPECT(function_returning_float,(float)10);
  EXPECT(function_returning_float,10.0f);
  EXPECT(function_returning_double,(double)10);
  EXPECT(function_returning_double,10.0);

Note, that this limiation only affects floating point return values - any other type of return value follows the same pattern as the x86 implementation.

testape

News

The latest headlines from Testape.com

TestApe Release 1171 available, Aug 20th 2014

It has been a long time since last official release and the list of bugfixes, features and supported platforms accumulating in the beta has grown substantially. I am happy to annouce that a new release is ready.

more

TestApe beta version available, Jul 21th 2014

New beta version is now available for download.

more

TestApe Release 880 available, Dec 3rd 2011

New is this release are support for floating point validations and function mocking. Also, MinGW has been added to the list of supported platforms.

more

Forum change, Mar 27th 2011

TestApe forum is now hosted on Proboards. Support questions can be posted here or send directly on email. Due to ...

more

TestApe beta release available, Sep 27th 2011

TestApe can now be used with MinGW GCC on windows. Also supported in this beta are floating point types in validations or when mocking functions

more

IPad update for WebTTY, May 15th 2011

A small fix for webtty scripts, to allow the usage from Apple IPads. Tab on textarea to bring up IPad keyboard - you may have to scroll webpage beneath keyboard, in order to actually see what you're typing.

TestApe Release 791 available, Apr 2nd 2010

This release contains a new flexible mocking system with default mocks automatically generated for unresolved functions. Installation packages are available for GCC/Linux, GCC/CygWin as well Visual Studio 2009/Windows XP or Vista.

more