Skip to content

Cmake: Add MBED_TEST_MODE macro #14538

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 4 commits into from
May 11, 2021
Merged

Conversation

harmut01
Copy link
Contributor

@harmut01 harmut01 commented Apr 13, 2021

Summary of changes

Fixes #14494

MBED_TEST_MODE was used in CLI1 to prevent multiple applications from
being built. Add the macro to provide backward compatibility, along with a test
application.

Impact of changes

None

Migration actions required

None

Documentation

CLI1 Reference: https://os.mbed.com/docs/mbed-os/v6.9/debug-test/greentea-for-testing-applications.html


Pull request type

[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

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

Reviewers


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Apr 13, 2021
@ciarmcom ciarmcom requested a review from a team April 13, 2021 12:00
@ciarmcom
Copy link
Member

@harmut01, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 13, 2021

Adding a test as well here?

@harmut01
Copy link
Contributor Author

Yes, I'm working on making a test project now 👍🏿

@harmut01 harmut01 force-pushed the cmake-test-mode branch 2 times, most recently from 177fea2 to a25fcdc Compare April 14, 2021 12:04
@harmut01 harmut01 requested review from rajkan01 and 0xc0170 April 14, 2021 12:04
@harmut01
Copy link
Contributor Author

I need to add a step to install mbed-tools in .travis.yml.

$ mbedtools configure -p tools/cmake/tests/mbed_test_mode -t GCC_ARM -m K64F --mbed-os-path .
No command 'mbedtools' found, did you mean:
 Command 'bedtools' from package 'bedtools' (universe)
mbedtools: command not found

@harmut01 harmut01 force-pushed the cmake-test-mode branch 5 times, most recently from ee1b8b1 to d69b2ef Compare April 15, 2021 10:22
@harmut01 harmut01 requested review from Patater and LDong-Arm April 15, 2021 12:02
@mergify mergify bot dismissed Patater’s stale review April 16, 2021 13:54

Pull request has been modified.

@harmut01
Copy link
Contributor Author

harmut01 commented Apr 16, 2021

@Patater looks like the "Extended" hiding of cmake isn't sufficient, i'll try and move it into the cmake job.

@mergify mergify bot dismissed Patater’s stale review April 16, 2021 16:16

Pull request has been modified.

@harmut01 harmut01 requested a review from Patater April 19, 2021 11:19
Fixes ARMmbed#14494

MBED_TEST_MODE is required for backward compatibilty with CLI1. This
adds a test to ensure that the macro is created when using CLI2 for
testing. This also adds a test in `.travis.yml` that checks whether
CMake defines the macro when BUILD_TESTING is on.

CLI1 Reference: https://os.mbed.com/docs/mbed-os/v6.9/debug-test/greentea-for-testing-applications.html

Also, explicitly create and set the macro BUILD_TESTING to allow for
MBED_TEST_MODE to be defined by CMake. MBED_TEST_MODE is required for
backward compatibilty with CLI1.  BUILD_TESTING is used to determine
whether to define MBED_TEST_MODE.  Normally, this would be automatically
done by CTest (which we intend to add for test automation) but this
hasn't yet been added to our Greentea tests.
@mergify mergify bot dismissed Patater’s stale review April 28, 2021 13:22

Pull request has been modified.

@0xc0170
Copy link
Contributor

0xc0170 commented May 4, 2021

@harmut01 Are you able to fix Travis failures ?

@harmut01
Copy link
Contributor Author

harmut01 commented May 5, 2021

yes @0xc0170, I'll take a look at it today.

@harmut01 harmut01 force-pushed the cmake-test-mode branch from 437857d to 680bede Compare May 5, 2021 10:56
The default distribution of CMake that comes with focal is 3.16.3. Add
kitware's repository (https://apt.kitware.com/) to the source list so
the latest copy of CMake is installed during CI.
@mergify mergify bot added needs: CI and removed needs: work labels May 5, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented May 7, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented May 7, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented May 10, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented May 10, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit e25e94e into ARMmbed:master May 11, 2021
@mergify mergify bot removed the ready for merge label May 11, 2021
@mbedmain mbedmain removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add MBED_TEST_MODE macro when compiling to run Greentea tests
9 participants