cppunit test library (c++test 10.3.4)

coinoperatedcoinoperated Posts: 18

I've been trying to reproduce the ATM example from the tutorial (eclipse variation using cygwin tools for make & g++). Although the static analysis, test & stub generation work as advertised I'm finding nothing is happing when i try to execute the 'Run Unit Tests'. The target 'test' executible does not seem to be getting build. If I try running 'Build Test Executible' i get unresolved references to w``hat appears to be the CppUnit libraries...i.e

C++test analysis errors in /Atm_MakefileOnly
    1. Test execution: error linking test executable for Test unit for selected sources.
D:\Devl\Workspaces\Parasoft\.cpptest\Atm_MakefileOnly\file-data\ATM.cxx18ec874a\tested\harness_ATM.o: In function `ATM::ATM(Bank*, BaseDisplay*)':
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5: undefined reference to `cpptestStackTraceFuncStartInfo'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cpptestStackTraceFuncStartInfo'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5: undefined reference to `cpptestCoverageFunction'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5:(.text+0x41): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cpptestCoverageFunction'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5: undefined reference to `cpptestCoverageStmt'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cpptestCoverageStmt'
D:\Devl\Workspaces\Parasoft\Atm_MakefileOnly/ATM.cxx:5: undefined reference to `cpptestStackTraceStmtInfo'....

Any suggestions?
Windows 10 host, cygwin 64

Comments

  • coinoperatedcoinoperated Posts: 18

    Just a follow-up for anyone encountering similar issues...

    I've found a couple of anomalies building and running unit tests using the eclipse-based version of C++test when targeting cyqwin (64bit).

    Environment:
    Windows 10 Pro version 1803 (64bit)
    C++Test version 10.3.4 (x86_64 installation)

    I normally do not add the cygwin environment to my Windows PATH as I prefer to keep it isolated from native windows cmd & powershell consoles. I found a recommendation that the cygwin path should be available before installing eclipse/CDT when targeting cygwin or MinGW. I reinstalled c++test after adding ‘c:/cygwin64/bin’ to the end of my system PATH which resolved several setup issues.

    My C++Test environment now supported build and debug (with some gdb limitations) of cygwin-based applications and libraries, however, the unit test fixtures failed to link (i.e. ‘Run Unit Tests’ & ‘Debug Unit Tests’). The problem appeared to be the default ‘cpptestruntime.a’ installed @ C:\Program Files\Parasoft\C++test\10.3\engine\lib. This library did not appear to be current or isn’t a cygwin built library as a number of 'cppunittest' methods are unresolved during link.

    Building the runtime library from a cygwin console produces ‘libcpptestruntime.a’ (@ C:\Program Files\Parasoft\C++test\10.3\engine\runtime) and can be added to the C++Test project as documented in ‘Working with the C++ Runtime Library’. Although you can modify the project Properties->Parasoft->C++test->Build Settings Linker options to include the built library (i.e. ${cpptest:original_options} "C:\Program Files\Parasoft\C++test\10.3\engine\runtime\build\libcpptestruntime.a”) I preferred to replace the default ‘lib/cpptestruntime.a’ with the newly constructed library to avoid having to modify every project. I haven’t noticed any drawback to this approach – if you know of pitfalls please update this post.

Sign In or Register to comment.