ARMmbed / mbed-cli

Arm Mbed Command Line Interface
https://os.mbed.com
Apache License 2.0
332 stars 175 forks source link

Added tests in UNITTESTS directory but not recognised with 'mbed status' command #855

Open ZaneV opened 5 years ago

ZaneV commented 5 years ago

First time posting a github issue and I feel like this is a rookie error I am making but here goes:

I have added unit test files under the mbed-os/UNITTESTS directory and am at the stage that I want to commit all my files and push. However, (I am using Mercurial) if I use the command : mbed status No changes have been detected. Also, hg add doesn't detect any changes either.

If I look in the mbed-os directory I see a .gitignore file. Changing this to .hgignore and then running: mbed status Give the following:

[mbed] Working path "/home/zanev/mbed/AFDAU_0_01" (program)
[mbed] Status for "mbed-os":
 D .gitignore
?? .hgignore
?? UNITTESTS/app/
?? UNITTESTS/bits.cpp
?? UNITTESTS/build/

However it isn't detecting the actual unit test .cpp & cmake files.

ciarmcom commented 5 years ago

Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-906

theotherjimmy commented 5 years ago

@ZaneV That's because you have made change to mbed-os, which is a different repo (and uses git) from your project.

ZaneV commented 5 years ago

@theotherjimmy okay so that's what I am concerned about... How do I keep my unit test code apart of my repo and not modify the mbed-os repo if all the unit testing code has to live inside the mbed-os/UNIT TEST folder?

theotherjimmy commented 5 years ago

@ZaneV I don't think that the unittest mechanism from mbed-os is designed to be used outside the repo. As these are unit tests, you can use any build system that you like, and are not constrained to use mbed-cli

ZaneV commented 5 years ago

@theotherjimmy okay that makes sense. I will run cmake with Googletest for my own program. The mbed-cli usage documentation on unittests doesn't seem to spell that out too clearly for us rookies and kind of implies that the unittests feature with mbed-cli would be suitable for using on your own program. But that is my opinion. Thanks for all your help.

theotherjimmy commented 5 years ago

We'll keep this issue open to clarify the usage of mbed test --unittest (or remove it entirely as it's not a user-facing feature)

ZaneV commented 5 years ago

Okay thanks, could I recommend not removing the unit test section in the documentation but perhaps have a brief guideline on how unit testing might be implemented using cmake and point the reader to some helpful resources. I think the page has been good for me to get an idea of writing unit tests. Anyway thanks again for all your help, I'll leave it in your hands!

theotherjimmy commented 5 years ago

Sure, we can have the documentation outline how a user could write unit tests for their app/lib. That's independent of having a "sub-subcommand" for it.

adbridge commented 4 years ago

Apologies, this was closed in error by the automated bot - re-opening.

ciarmcom commented 4 years ago

Internal Jira reference: https://jira.arm.com/browse/IOTBTOOL-465