unable to get coverage of source.c while execution via polyspace test

6 visualizaciones (últimos 30 días)
Sunil
Sunil el 5 de Ag. de 2025
Editada: Sunil el 13 de Ag. de 2025
i have created a target am2632 with polyspace test, ensured the rtiostreamtest function works with application loaded in target. i have a sample source.c which is an abs fuction. i created a sample test which take in input -10.0 and verifies with output +10.0. after creating a build with test case and clicking run over test case via polypace i get only pass/fail.
the below is the log of the while running:
==================================
[2025-08-05 11:16:42 Info] Building test 'New Test Case 1' [DONE].
[2025-08-05 11:16:46 Info] Initializing run ...
[2025-08-05 11:16:46 Info] Run created.
[2025-08-05 11:17:08 Info] Test results 'ex Results (8/5/2025, 11:16:46 AM)' done.
==================================
---------------------------------------------------------
Running Graphical tests (2ffb8ccd-2c19-4028-a5be-5c4f6c191770)
Starting test executable
### Connectivity configuration for function 'testbin': '<a href="matlab: targets_hyperlink_manager('run',2);">TI_AM2632</a>' ### Starting application: 'pstest\lib\testbin\pil\testbin.elf' To terminate execution: <a href="matlab: targets_hyperlink_manager('run',3);">clear testbin_pil</a> ### Starting the Application using DSS... Programming testbin.elf Running command: "C:\ti\ccs2010\ccs\ccs_base\scripting\bin\dss.bat" "C:/Sunil/Programs/PnC/Target_compilor/P16582_Collins_Input/AM2632/TI_AM2632/load_and_run.js" "C:\Sunil\Programs\PnC\Target_compilor\P16582_Collins_Input\AM2632\TI_AM2632\ex\polyspace_artifacts\p000584DC0\b85dd31TI_AM2636FD12\buildcov\graphic_6c191770\pstest\lib\testbin\pil\testbin.elf" ### Application successfully programmed and started on target.
Running Graphical test 'New Test Case 1'
--> Passed
Done running Graphical tests (2ffb8ccd-2c19-4028-a5be-5c4f6c191770)
### Application stopped Code coverage report: <a href="matlab: targets_hyperlink_manager('run',4);">getCodeCoverageData('testbin_pil')</a>
---------------------------------------------------------

Respuestas (1)

Aryan
Aryan el 13 de Ag. de 2025
Hi @Sunil!
I understand that you are running a Polyspace Test on your AM2632 target and are seeing only pass/fail results, but no code coverage data for your source.c (abs function) test case.
In Polyspace Test, code coverage is not enabled by default. Even if the test executes successfully over PIL (Processor-in-the-Loop) and passes, you won’t get coverage metrics unless the build is instrumented for it and the target streams coverage data back to the host.
How to enable and view code coverage
1. Enable coverage metrics in the configuration
  • In your Polyspace Test project, go to:
Configuration → Testing & Profiling tab.
  • Under Code coverage metrics, select at least one option, for example:
o Statement/Line coverage
o Decision coverage
o Condition coverage
o MC/DC
  • Save changes. This ensures the build is instrumented to collect coverage counters.
2. Rebuild the test executable
  • After enabling metrics, rebuild your test application so that Polyspace inserts coverage instrumentation into the generated code.
  • The AM2632 uses the TI Arm-Clang toolchain (tiarmclang), which supports source-based code coverage (function, line, region, branch coverage).
Ensure you are not using the older ti-cgt-arm compiler, which lacks this feature.
3. Run the instrumented application on the target
  • Re-run your test case via PIL.
  • Make sure your RTIOSTREAM connectivity works (you already verified with rtiostreamtest).
  • During execution, the target will update coverage counters and stream them back to the host.
4. View coverage results
  • After execution, in the test log, you’ll see:
Code coverage report: getCodeCoverageData('testbin_pil')
  • In MATLAB, run:
getCodeCoverageData('testbin_pil')
This opens the coverage report inside Polyspace, showing executed/not executed lines and percentages.
For more details, see:
  3 comentarios
Aryan
Aryan el 13 de Ag. de 2025
Hi @Sunill!
You’ve enabled MC/DC in Polyspace Test, are building with ti-cgt-armllvm_4.0.2.LTS, your rtiostreamtest passes, but getCodeCoverageData('testbin_pil') shows no coverage.
Likely cause: The abs function compiles without any real branch (e.g., branchless intrinsic), so MC/DC has nothing to measure.
Sunil
Sunil el 13 de Ag. de 2025
Editada: Sunil el 13 de Ag. de 2025
Hi Aryan,
When i select host compilor, i get coverage along side of the result. when target compilor is selected the coverage along side of the result is missed. i have attached the build log. please find the error log:Polyspace Code Profiler Issue Report.txt

Iniciar sesión para comentar.

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by