Custom compiler with cpptestcli

ThomasMooreThomasMoore Posts: 7

Is there a way to specify the custom compilers path when using cpptestcli from version 10.4.2 of the professional edition? I've tried setting the value in the Parasoft/Configurations screen and then exporting the localsettings with Configurations selected, but no values are exported. We would prefer to not have to manually install the compiler settings into the cpptest installation folder if at all possible.

Comments

  • brian_nucklesbrian_nuckles Posts: 32 admin
    edited April 20

    @ThomasMoore You may be looking for the compiler.dir.user property. https://docs.parasoft.com/display/CPPTEST1043/Compiler+Settings#CompilerSettings-cpptest.compiler.family
    After specifying the user compiler directory you should be able to refer to its name with the -compiler flag.

  • ThomasMooreThomasMoore Posts: 7

    The -compiler flag is not supported in the Professional version of C/C++test according to the output of cpptestcli below.

    $ cpptestcli -data . -config Run_Unit_Tests.properties -compiler ceel_1_0_4
    Parasoft C/C++test Professional 10.4.2.20190409B424 -- Copyright (C) 2019 Parasoft Corporation
    Parasoft Test 9.7.12.20190404 -- Copyright (C) 2010-2019 Parasoft Corporation
    ERROR: Error: unknown option: -compiler (supported in C/C++test Standard only)
    HINT: Command line contains the option(s) only supported in C/C++test Standard.
    Modify the command line with C/C++test Professional options or consider using C/C++test Standard.
    See the C/C++test User Guide for details or contact Parasoft Support.

    Where is the "cpptest.compiler.dir.user" property provided? I tried setting it in the file that is passed via the -localsettings command line parameter, but it still complains about not being able to find the compiler.

  • mhernandezmhernandez Posts: 6

    @Thomas Moore In C++test Professional: the configuration files should be saved at: .metadata.plugins\com.parasoft.xtest.checkers.eclipse.core.cpp/compilers

    https://docs.parasoft.com/display/CPPDESKE1043/Configuring+Testing+with+the+Cross+Compiler

    In C++test Standard, the "cpptest.compiler.dir.user" property is used to specify the directory where the compiler files are at.

  • brian_nucklesbrian_nuckles Posts: 32 admin

    Hi Thomas, the link above also describes the property to set inside the localsettings file named cpptest.compiler.family, this may allow you to specify ceel_1_0_4 in the properties file itself. The error you received was due to the version of C/C++test installed. The Professional version is designed to be run through the GUI of Eclipse or Visual Studio and lacks some of the more intricate features (like the -compiler flag) as the C/C++test Standard version. Standard is designed to be run in automation/headless/embedded environments and contains the full custom compiler functionality mentioned above. It can be downloaded from the customer portal and licensed using your existing key.

  • ThomasMooreThomasMoore Posts: 7

    I downloaded the standard version, but it's not working with the license I'm able to use with the professional version. Any ideas?

    $ ~/parasoft/cpptest/cpptestcli -config Build_Test_Executable.properties -localsettings localsettings
    Parasoft C/C++test Standard 10.4.2.20190408B2313 -- Copyright (C) 2019 Parasoft Corporation

    Loading preferences...
    Checking license...
    License: Activation failed: Cannot connect to license server.
    License: Machine id LINUX2-479cd542

    ERROR: License not set - aborting

    HINT: license settings can be added to /cpptestcli.properties
    or to a custom configuration file (-localsettings )
    HINT: for network license, specify the following settings:
    cpptest.license.use_network=true
    dtp.server=[server]
    dtp.port=[port]
    dtp.user=[user]
    dtp.password=[password]
    HINT: for local license, specify the following settings:
    cpptest.license.use_network=false
    cpptest.license.local.password=[password]

    $ cat localsettings
    cpptest.license.custom_edition_features=Static Analysis, Flow Analysis, Unit Test, Rule Wizard, Desktop Command Line, Embedded Support, Code Review, Runtime Error Detection, DTP Publish, Coverage, Assembly Coverage, AUTOSAR Rules, HIC++ Rules, JSF Rules, MISRA Rules, MISRA C 2012 Rules, Security Rules, SEI CERT C Rules, SEI CERT C++ Rules
    cpptest.license.local.password=
    cpptest.license.network.edition=custom_edition
    cpptest.license.use_network=true
    license.network.host=158.147.79.106
    license.network.port=2002

  • mzwawamzwawa Posts: 18

    Hi Thomas,
    in the localsettings file you use the properties:
    license.network.host=[server]
    license.network.port=[port]
    this means that you are trying to connect to a standalone License Server. Is that true?
    Probably you also need this one:
    license.network.enabled=true
    However, if you want to get a license from the DTP License Server, then you should use the properties like:
    dtp.server=[server]
    dtp.port=[port]
    dtp.user=[user]
    dtp.password=[password]
    cpptest.license.use_network=true
    cpptest.license.network.edition=custom_edition
    cpptest.license.custom_edition_features=C++test, Static Analysis, Flow Analysis, Unit Test, Rule Wizard, Desktop Command Line, Embedded Support, Code Review, Runtime Error Detection, DTP Publish, Coverage, Assembly Coverage, AUTOSAR Rules, HIC++ Rules, JSF Rules, MISRA Rules, MISRA C 2012 Rules, Security Rules, SEI CERT C Rules, SEI CERT C++ Rules

  • ThomasMooreThomasMoore Posts: 7

    Yes, I'm trying to use a standalone license server as we don't have DTP setup. However, I'm still getting the same error when adding license.network.enabled=true to the settings file.

    Can the standard edition run unit tests developed in the professional version? It looks like the standard edition can only perform static analysis and analysis of unit tests performed in other unit test tools.

  • mzwawamzwawa Posts: 18

    Hi Thomas,
    I've checked the license settings for standalone license server and it looks that they are different for C/C++test Standard and Professional.
    The common part is:
    cpptest.license.use_network=true
    license.network.connection.type=tcp
    license.network.host=[server name]
    license.network.use.specified.server=true
    license.network.enabled=true

    specific for Standard:
    cpptest.license.network.edition=server_edition
    license.network.port=8080

    and for Professional:
    cpptest.license.network.edition=automation_edition
    license.network.port=2002

    To answer your second question:
    Unit tests created in Professional can be only executed in Professional. Standard can only run static code analysis and execute unit tests created in other tools.

  • ThomasMooreThomasMoore Posts: 7

    Going back to my original question. Since only the professional version can run the unit tests we've developed, and we need to cross-compile in order to run the unit tests, the only way to use the professional cpptestcli with a custom compiler is to manually copy the compiler into either the C/C++test installation folder or into the workspace folder? There's no equivalent to the "cpptest.compiler.dir.user" property in C/C++test Professional?

    Note that the only reason I've created a custom compiler is to remove the inclusion of cpptestruntime.lib in the linker command because I need to cross compile the runtime library and not use the pre-compiled one. The compiler is GCC-based and I can change the paths to the compiler in the Project settings, which works except for the need to remove cpptestruntime.lib from the linker settings. Is creating a custom compiler the only way to make this work?

  • Andrey MadanAndrey Madan Posts: 331 ✭✭✭

    @ThomasMoore - You cannot execute parasoft unit testing framework using C/C++test standard edition. You need to use C/C++test Professional for that. What is the name of your company? Let me know more details - [email protected]

  • JeffEstesJeffEstes Posts: 97 admin

    Just to let others know on this thread. I am connected with Thomas and will answer his questions on this.

Sign In or Register to comment.