Skip to content

TOOLS: enable build greentea test coverage for HW #11904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 21, 2020

Conversation

jamesbeyond
Copy link
Contributor

@jamesbeyond jamesbeyond commented Nov 20, 2019

Description (required)

This PR adds a hidden option --coverage-filters to the mbed test function. this option allows filters to be passed into the tests building stage. for the files matches with filters will be compiled with a gcov option, the rest of the files will be covered by the default compiler options.

Summary of change (What the change is for and why)
  • This option is key to enabling code coverage from HW, only in the way the gcov complied images should be small enough to fit a HW target

  • This option only applies to GCC_ARM toolchain, no impact to other toolchains

  • This option is not visible from mbed test --help , so no public users impact, because the function is still in an experimental stage.

  • for the file that matches with given filter compiler options --coverage, -DENABLE_LIBGCOV_PORT are added

  • linker options --coverage, -Wl,--wrap,GREENTEA_SETUP, -Wl,--wrap,_Z25GREENTEA_TESTSUITE_RESULTi are added if the option is enabled.

  • if the option is not in use normal mbed test option will not get impacted

Documentation (Details of any document updates required)

becasue this is

Pull request type (required)

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results (required)

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers (optional)

@mark-edgeworth


Release Notes (required for feature/major PRs)

Summary of changes
Impact of changes
Migration actions required

@ciarmcom ciarmcom requested review from mark-edgeworth and a team November 20, 2019 12:00
@ciarmcom
Copy link
Member

@jamesbeyond, thank you for your changes.
@mark-edgeworth @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@@ -44,7 +44,7 @@ def check_executable():
)

def __init__(self, target, notify=None, macros=None, build_profile=None,
build_dir=None):
build_dir=None, coverage_patterns=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for arm.py; change only applies for gcc-arm so no need to change here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see my above comments, about why ARM and IAR need to be changed as well.

self.coverage_cppc = self.cppc + ["--coverage", "-DENABLE_LIBGCOV_PORT"]
self.coverage_ld = self.ld + ['--coverage', '-Wl,--wrap,GREENTEA_SETUP', '-Wl,--wrap,_Z25GREENTEA_TESTSUITE_RESULTi']

for flag in ["-DMBED_DEBUG"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do with a comment here explaining what this is doing, and more importantly why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments added

@@ -208,6 +223,12 @@ def get_compile_options(self, defines, includes, for_asm=False):
opts = opts + self.get_config_option(config_header)
return opts

def match_coverage_patterns(self, source):
for pattern in self.coverage_patterns:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document what this new function is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments added

):
ARM.__init__(
self,
target,
notify,
macros,
build_dir=build_dir,
build_profile=build_profile
build_profile=build_profile,
coverage_patterns=None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to change this - gcc-arm only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see my above comments, about why ARM and IAR need to be changed as well.

@adbridge
Copy link
Contributor

@jamesbeyond could you please take a look at the review comments ?

@jamesbeyond
Copy link
Contributor Author

the asked changes been addressed, could you review again ? @mark-edgeworth

@adbridge
Copy link
Contributor

Ci started

@mbed-ci
Copy link

mbed-ci commented Jan 20, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@adbridge adbridge added release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 and removed ready for merge labels Jan 21, 2020
@adbridge adbridge merged commit 48f90c0 into ARMmbed:master Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants