Skip to content

CMake: Update README.md with CTest/greentea instructions #15001

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

Closed
wants to merge 1 commit into from

Conversation

rwalton-arm
Copy link
Contributor

@rwalton-arm rwalton-arm commented Aug 13, 2021

Summary of changes

The steps for building and running a greentea test have changed since
40154ee. This commit updates the README
with the current instructions for building and running greentea tests
using CMake/Ninja/CTest.

Partially fixes #14854

Impact of changes

N/A

Migration actions required

N/A

Documentation

None


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

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] 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 Aug 13, 2021
@ciarmcom ciarmcom requested a review from a team August 13, 2021 14:00
@ciarmcom
Copy link
Member

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

0xc0170
0xc0170 previously approved these changes Aug 16, 2021
cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja -DMBED_GREENTEA_TEST_BAREMETAL=ON && cmake --build .
cmake --build __build
cd __build
ctest -V
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth adding a note on how to run an individual test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a link to the ctest documentation to avoid repeating it here.

Copy link
Contributor

@LDong-Arm LDong-Arm Sep 8, 2021

Choose a reason for hiding this comment

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

Even though how to filter an individual test(s) is in the CTest documentation, it only covers the "run" stage. It's still good to let users know how to build one test. Presumably using --target <test-name> instead of --target test? Since building & testing of one test is a very commonly done task, giving a special mention of both in one place could be useful in my opinion.

Especially that the build time for all tests has increased quite a lot by now (e.g. over 10K object files as of today). Even though it's partially because INTERFACE libraries does lots of duplicated compilation than STATIC (a bit off-topic now...)

```
* Build the test binary with the full profile
## How to build and run greentea tests

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we need a note that migration of all tests is still in progress?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the last remaining question. Can we merge this to get into the upcoming release (code freeze today).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we wait until the migration of all tests is complete before merging this? I can see it causing confusion for users. This PR also removes the previous instructions for running greentea tests, which users could've been relying on. Rather than adding caveats or calling out both methods of running the tests, maybe we wait until the work to migrate all tests is complete, then the documentation is correct (and doesn't need to be changed again later)?

The steps for building and running a greentea test have changed since
40154ee. This commit updates the README
with the current instructions for building and running greentea tests
using CMake/Ninja/CTest.
Comment on lines +110 to +112
The `MBED_HTRUN_ARGUMENTS` argument is a semicolon separated list of arguments
to forward to `mbedhtrun`. You can pass any of the optional flags you would
usually pass to `mbedhtrun` by adding them to this list.
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth noting that each argument is already quoted by CTest so the user should not add quotation marks or escape any characters.
For example, a mount point has a space inside, in which case -DMBED_HTRUN_ARGUMENTS="-p;/dev/tty.usbmodem14402;-d;/Volumes/NuMicro MCU" just works, but -DMBED_HTRUN_ARGUMENTS="-p;/dev/tty.usbmodem14402;-d;/Volumes/NuMicro\ MCU" causes the backslash to be treated as a literal character, and -DMBED_HTRUN_ARGUMENTS="-p;/dev/tty.usbmodem14402;-d;'/Volumes/NuMicro\ MCU'" causes the single quotes to be treated as literal characters.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 10, 2022

Closing due to inactivity.

@0xc0170 0xc0170 closed this Feb 10, 2022
@mergify mergify bot removed component: tools needs: preceding PR release-type: patch Indentifies a PR as containing just a patch labels Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to use CTests to run all Greentea tests
5 participants