Skip to content
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

Fix test targets arguments for MSVC #3636

Merged
merged 3 commits into from
Feb 21, 2020

Conversation

larshg
Copy link
Contributor

@larshg larshg commented Feb 8, 2020

Adds arguments to test projects in VS, so clouds etc. is properly found.

However I later found out that running the unit test from the unit test explorer in VS, still doesn't pick them up.

Also, if I run the Tests project, which seems to init ctest, some other arguments are passed and it complains about -C 'release/debug' argument is not present.

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

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

Could you please add a brief description of what problem this PR is solving?

cmake/pcl_targets.cmake Outdated Show resolved Hide resolved
@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

Arguments can't be quoted, when I "build" the test project, as it fails to properly parse the arguments and show error about missing -C (debug/release) configuration argument.

Additionally, I can't run unit tests which has arguments from VS's test explorer, but this is not something we can do about here. I'll eventually add a bug report to MS for both things.

@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

Hmm, I can see that the CIs are also calling ctest without quoted arguments - so maybe it should just be removed for all cases?

cmake/pcl_targets.cmake Outdated Show resolved Hide resolved
cmake/pcl_targets.cmake Outdated Show resolved Hide resolved
@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

@taketwo you "fixed" :D the quotes in #460 after they where introduced in #431 looong time ago... I wonder if no one has used the tests project since then within VS.

How does it work, when you call make tests - does it call ctest automatically, or do you have to call it explicitly afterwards?

@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

Does ctest default to release on linux systems, ie. the configuration is explicit set here

@taketwo
Copy link
Member

taketwo commented Feb 16, 2020

I can see that the CIs are also calling ctest without quoted arguments

Are you referring to the fact that ctest is called directly in our CI pipelines?

We used to do cmake --build . -- tests, which is equivalent to make tests. However, this was changed in #2948. As far as I understand, this was done to add -T Test argument, which enables test results publication. Maybe we should have added it directly to CMake target instead.

I wonder if no one has used the tests project since then within VS.

I wouldn't be surprised. Unit tests are mostly for contributors and most of our contributors don't use VS.

How does it work, when you call make tests - does it call ctest automatically,

Yes.

Does ctest default to release on linux system

Not sure I understand the question. ctest is a test runner, it does not build. So it will call test exectutables, whatever build type they have.

@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

I can see that the CIs are also calling ctest without quoted arguments

Are you referring to the fact that ctest is called directly in our CI pipelines?

Yes, in the cmake target the arguments are in qoutes, which doesn't work when "build" in VS - it just call ctest on build.

We used to do cmake --build . -- tests, which is equivalent to make tests. However, this was changed in #2948. As far as I understand, this was done to add -T Test argument, which enables test results publication. Maybe we should have added it directly to CMake target instead.

yes, that would properly give the same result, ie. generating the XML file. Additionally it would also be reflected locally, if you just run make tests. This won't happen now as it only has the -V argument

I wonder if no one has used the tests project since then within VS.

I wouldn't be surprised. Unit tests are mostly for contributors and most of our contributors don't use VS.

How does it work, when you call make tests - does it call ctest automatically,

Yes.

Does ctest default to release on linux system

Not sure I understand the question. ctest is a test runner, it does not build. So it will call test exectutables, whatever build type they have.

If I run ctest.exe directly in my build tree it shows:

E:\Libraries\pclBuild>ctest
Test project E:/Libraries/pclBuild
    Start 1: registration_warp_api
Test not available without configuration.  (Missing "-C <config>"?)
1/9 Test #1: registration_warp_api ............***Not Run   0.00 sec

The -C argument is only present on the two windows CI, but not in the linux variants.
On multi configuration systems you can supply -C Config, to make ctest look for either release or debug version of the tests and run the appropriate.

So I'm puzzled that it is required on windows, but seems optional on linux.

@taketwo
Copy link
Member

taketwo commented Feb 16, 2020

So I'm puzzled that it is required on windows, but seems optional on linux.

On Linux a build tree can only have a single configuration. So the directory from which ctest is called unambiguously decides the configuration that is used.

@larshg
Copy link
Contributor Author

larshg commented Feb 16, 2020

Ahh okay.

I'll try update the CI to make use of the --build . --tests again and see if it can work this way.

@taketwo taketwo removed the needs: more work Specify why not closed/merged yet label Feb 17, 2020
@taketwo
Copy link
Member

taketwo commented Feb 20, 2020

Could you please squash everything into two commits: one for the -T change, another for arguments?

@kunaltyagi kunaltyagi merged commit 6657995 into PointCloudLibrary:master Feb 21, 2020
@larshg larshg deleted the AddArgumentsToProjectsVS branch February 21, 2020 20:57
@kunaltyagi kunaltyagi added the changelog: enhancement Meta-information for changelog generation label Feb 28, 2020
@taketwo taketwo changed the title Add arguments to VS projects. Fix test targets arguments for MSVC Mar 18, 2020
@taketwo taketwo added changelog: fix Meta-information for changelog generation and removed changelog: enhancement Meta-information for changelog generation labels Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation module: cmake platform: windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants