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

How should unit tests be run? #784

Closed
translunar opened this issue Jul 2, 2014 · 19 comments
Closed

How should unit tests be run? #784

translunar opened this issue Jul 2, 2014 · 19 comments

Comments

@translunar
Copy link

I have looked all over the documentation and cannot find instructions anywhere on actually running unit tests. Are they run automatically when I do a make? Do I need to call some specific make target like make gtest?

There's a section for it on the Advanced page: http://pointclouds.org/documentation/advanced/
but I can't find any place that explains this. It would make contributing much more accessible if there were instructions.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

make tests will compile all tests + dependencies and then run them.

Note: this is a bug tracker, the appropriate place to ask such questions is the mailing list.

@translunar
Copy link
Author

@taketwo It's actually not a question, but rather a request that the documentation be improved. When I run make test, I get the following output:

Running tests...
/usr/local/Cellar/cmake/2.8.12.2/bin/ctest --force-new-ctest-process
Test project /Users/jwoods/Projects/pcl/build
No tests were found!!!

@translunar
Copy link
Author

I'd also note that this page has instructions which appear to be out of date:
http://pointclouds.org/documentation/tutorials/building_pcl.php

There is no BUILD_TESTS option. Furthermore, if I try to enable BUILD_global_tests, it reverts to OFF as soon as I configure.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Please read my message carefully, plural "tests" should be used.

Well... with the current title it looks like a question, not a feature request. Anyways, you are welcome to propose a modification to the "advanced" page (or any other page for that matter, all the sources are in this repository) through a pull request.

@translunar
Copy link
Author

Okay, make tests also does not work, so I figured it for a typo.

$ make tests
make: *** No rule to make target `tests'.  Stop.

@translunar
Copy link
Author

I can't propose a modification myself if I don't know the answer. Thus the opening of the issue.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

So you have test target but not tests? This is strange. Are you using the trunk version?

@translunar
Copy link
Author

I pulled last night.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Okay, it seems like test target is created even if BUILD_global_tests is OFF. (Which is wrong, of course.) The tests target will appear after you enable that option.

if I try to enable BUILD_global_tests, it reverts to OFF as soon as I configure.

Check the output messages of CMake. It is likely that you have not enabled some other module on which global tests depend (and they depend on pretty much all modules, because they need to test everything).

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

If you are using ccmake, then put the cursor on the line with BUILD_global_test after trying to generate. In the bottom of the screen there will be something like

BUILD_global_tests: Disabled: recognition missing.

@translunar
Copy link
Author

Ahh, that was helpful. I was able to get BUILD_global_tests to remain enabled once I also turned on BUILD_people, which was off by default. However, I still have no tests target.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Just in case, did you press g in the end?

@translunar
Copy link
Author

I'm fairly sure I did, but just now I went back to try to generate it again — just in case — and it reverted the BUILD_global_tests option again. I was able to enable a few more options, such as BUILD_outofcore, but now I'm getting this:

 CMake Error at
 /usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindPackageHandleStandard
 Args.cmake:108 (message):
   Could NOT find Gtest (missing: GTEST_INCLUDE_DIR GTEST_SRC_DIR)
 Call Stack (most recent call first):

 /usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindPackageHandleStandard
 Args.cmake:315 (_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindGtest.cmake:34 (find_package_handle_standard_args)
   test/CMakeLists.txt:19 (find_package)

I'm not quite sure how gtest is to be installed, since a pre-compiled install is not recommended.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Until recently we distributed gtest with PCL, so everyone got it automatically. But now you have to install it yourself. (apt-get install libgtest-dev on Ubuntu.)

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Citing Jochen (from #722):

the FAQ only states that you shouldn't use a precompiled version. But for example if you install libgtest-dev on Debian, you only get the headers in /usr/include, simple as with any other dependency.

@translunar
Copy link
Author

Apologies, but I'm on Mac OS X, and homebrew does not include a brew for gtest:

$ brew info gtest
Installing gtest system-wide is not recommended; it should be vendored
in your projects that use it.

This was the first thing I tried, before even asking this question.

I can download the sources, configure, and make, but when I try to do make install, I get:

echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.

Should I just manually install it by copying include/* to /usr/include/? Or do I also need to copy the libs?

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

Please see #731.

@taketwo
Copy link
Member

taketwo commented Jul 2, 2014

@MohawkJohn I suppose we can close this?

@VictorLamoine
Copy link
Contributor

@taketwo I think so, it looks solved

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

No branches or pull requests

3 participants