Troubleshooting

The instrumenter has a -o commandline switch to help troubleshoot. When invoked in this mode, the instrumenter will show command lines for each pass and keep the temporary files. Some typical problems are shown below.

Problems running any samples with mingw

You need to use the mingw-w64 distribution. TestApe will not work reliably with the old version of mingw as this toolchain may stop linking prematurely before disclosing all relevant unresolved externals.

Problems mocking malloc, free, printf and other clib functions
Most likely the problems are caused be the mix of static and dynamic linking. The testape library are statically linked and to avoid problems use the -static option to gcc when compiling the tests.

Creating mock for EXECUTE (and other TestApe macros)
Check that testape.h is included in the tests.

Creating mock for getreentrnet
Check that you are linking with all required standard libraries. Try and remove testape from the commandline and verify that you can compile the tests without the instrumenter and that you do not see unexpected unresolved external symbols.

Creating mock for _Z20testape_validate_intPcS_ii
Check that you have named the files with the extension .c if these are c files. Verify that you are compiling using gcc, not g++. If you want to to use g++ in order to write the tests in c++, the #include <testape.h> statement must be put inside a extern "C" declaration.

undefined reference to `testape_validate_int'
Check that you are linking with library (testape.a/testape.lib). The order of libraries and tests given on commandline is important. Verify that the library is given later on commandline than the tests using it.

Failures when functions returning doubles are implicitly declared
The following code will fail to return correct value to the calling function

  int degree_to_miliradians(int degrees) {
    return 1000*deg2rad(degrees)
  }
The code relies on the function deg2rad. This function accepts an integer and returns a double. However, in this example, deg2rad are implicitely declared to be of type int deg2rad(int) and not double deg2rad(int) as intented, so degree_to_miliradians will not work correctly.

However, it is possible to write a test, to discover this e.g.

  void test_degree_to_miliradians(void) {
    EXPECT(deg2rad, 2*PI);
    VALIDATE(degree_to_miliradians(360), 1000*2*PI);
  }

When TestApe detects a call to deg2rad, it correctly detects that deg2rad should return an integer, and will return (int)2*PI, e.g. 6, that will make degree_to_miliradians return 6000, and the test will fail.

However, if the bug is corrected, e.g.

  double deg2rad(int degrees);

  int degree_to_miliradians(int degrees) {
    return 1000*deg2rad(degrees)
  }

The TestApe will detect the deg2rad should return a floating point e.g. 2*PI, 6.28..., and that will make degree_to_miliradians return the correct value 6282, and the test will pass

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