Unit test problem with original method stub files

giova_inafgiova_inaf Posts: 3

Hello to everybody. I encounter a problem during the unit test of a software developed in Tornado environment with Vxworks 5.5 for a PowerPC embedded system. I import the project in Parasoft cpp test (in Eclipse IDE) with the wizard and the project compiles correctly. When I create the Unit Test I encounter a problem by testing single functions that call original method function defined in other sources. Although I added those source files to the list of stubs, during compilation of the unit test, only a few files indicated were instrumented. Thank you all for help

Comments

  • JromeroJromero Posts: 24

    Hello,
    When generating and running Unit Test all or any external third party libraries or source code dependencies should be available, otherwise you will run into this type of compilations errors at Unit Test running time, go ahead and generate a Technical Support Archive to have more in depth details regarding missing dependencies

    How to generate a Technical Support Archive:
    To configure the product to automatically prepare and send archives when testing problems occur:
    1. Open the Technical Support panel by choosing Parasoft> Preferences, then selecting the Parasoft> Technical Support category.
    2. Check Enable auto-creation of support archives.
    3. Customize additional options as needed.
    4. Click Apply, then OK.

    To manually create a support archive:
    • Choose Parasoft> Preferences, select the Technical Support category, select the desired archive options, then click Create Archive.
    To open the Technical Support Archive Manager, which allows you to review, e-mail, or delete recent support archives:
    • Choose Parasoft> Preferences, select the Technical Support category, then click Browse Recent Archives.

    When creating a support archive it is best to ensure that it contains all the info which is relevant to the problem and does not contain any unrelated info.

    To make visible to the current project any external dependency -
    Right Click in the Project
    Select Properties
    Select Parasoft
    Select Scope setting and Include any external resources

  • giova_inafgiova_inaf Posts: 3

    Thank you very much Jromero,
    I tried to set the Scope as you said but the Scope Setting seems that Exclude resource instead of Include.
    To better explain my problem, I describe how the unit test is setted:

    • the file scope is in file mode (Unit testing->Execution->Symbols->Use symbols from additional progject files==NO)
    • in Test Case Explorer window:
      1) double click the Test suite name (with triple wheel)
      2)in Additional Stub Files window insert the source file (crc.c) that contains the external orginal method function (crc16_table_calc) I need in the function under unit test.

    An extract of the log during compilation:


    ...done.
    Sending static coverage data......done.
    Instrumenting stubs source: C:\Program Files\Parasoft\C++test\9.6\engine\etc\safestubs\safe_stubs_win32.c ......result is up-to-date.
    Reading symbols data......done.
    Checking missing definitions...
    Reading symbols file "C:\workspace.cpptest\EuclidTornado\file-data\AcceptReportFunc.c9dcb0064\tested\harness_symbols.xml"
    Reading symbols file "C:\workspace.cpptest\EuclidTornado\file-data\safe_stubs_win32.c7abd3a7c\harness_symbols.xml"
    Using libraries detection schema: gnu
    Using real command line extraction schema: default
    Using default library enumeration only....done.
    Reading available definitions data.....done.
    Analyzing missing definitions...
    Unable to locate definitions for the following functions:
    crc16_t crc16_table_calc(const uint8 *, uint32)

    Unit Test execution terminated - please provide missing symbol definitions and run analysis again.

    ...................

    In Instrumenting stubs source should be there too the file "crc.c" that I have inserted in stub list but there isn't.
    Thank in advance for the help

  • JromeroJromero Posts: 24

    I am converting this use-case as a support case and our Support team will be contacting you soon to continue helping you with this missing symbols use-case, it needs more in-depth troubleshooting as example: Environment details, libraries details, Unit Test generation details, are you using external stubs or Parasoft created stubs and so on. Support Team would be able to gather all the details to get this use-case solve at your earliest convenience.

  • giova_inafgiova_inaf Posts: 3

    Hello Jromero thank you very much. I attached some screenshoot about the configuration I'm using in this moment.
    about configuration:

    • no external libraries are used;
    • no autogenerated stub are used, only original file stub are used;
    • all the source files are internal to the project.

    The key screenshot is the error_missing_symbols where you can see that:

    • additional stub files are added: TM_BlockHandler.c,CDPU_Builder.c, VIS.c, crc.
    • during compilation only crc.c is recognized
    • consequently the functions declared inside other file than crc.c are unable to be located.
      Thank you for all.
Sign In or Register to comment.