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

Giving something not a library to cgreen-runner will result in error from nm #251

Closed
thoni56 opened this issue Mar 21, 2021 · 0 comments
Closed

Comments

@thoni56
Copy link
Contributor

thoni56 commented Mar 21, 2021

If you do

cgreen-runner <dir>

you get

/usr/bin/nm: Warning: '<dir>' is a directory
No tests found in '<dir>'.

This should really be catched by cgreen-runner.

fnadeau added a commit to fnadeau/cgreen that referenced this issue May 9, 2021
Remove dependency to nm and rather use libbfd, which is the same lib
used by nm. There is no additional depency, but cmake will fail if it
cannot find libbfd. There was no check for nm before.

Unit test still use nm to count the number of symbols. It provides a
double check on this implementation.

Before we would get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
/usr/bin/nm: ./build/tests/Makefile: file format not recognized
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
/usr/bin/nm: /usr/lib/libgit2.so: no symbols
No tests found in '/usr/lib/libgit2.so'.

After this patch we get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
No tests found in '/usr/lib/libgit2.so'.
fnadeau added a commit to fnadeau/cgreen that referenced this issue May 9, 2021
Remove dependency to nm and rather use libbfd, which is the same lib
used by nm. There is no additional depency, but cmake will fail if it
cannot find libbfd. There was no check for nm before.

Unit test still use nm to count the number of symbols. It provides a
double check on this implementation.

Before we would get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
/usr/bin/nm: ./build/tests/Makefile: file format not recognized
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
/usr/bin/nm: /usr/lib/libgit2.so: no symbols
No tests found in '/usr/lib/libgit2.so'.

After this patch we get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
No tests found in '/usr/lib/libgit2.so'.
fnadeau added a commit to fnadeau/cgreen that referenced this issue May 30, 2021
Remove dependency to nm and rather use libbfd, which is the same lib
used by nm. There is no additional depency, but cmake will fail if it
cannot find libbfd. There was no check for nm before.

Unit test still use nm to count the number of symbols. It provides a
double check on this implementation.

Before we would get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
/usr/bin/nm: ./build/tests/Makefile: file format not recognized
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
/usr/bin/nm: /usr/lib/libgit2.so: no symbols
No tests found in '/usr/lib/libgit2.so'.

After this patch we get:
$ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so
Running "libbreadcrumb_tests" (9 tests)...
  "Breadcrumb": 9 passes in 3ms.
Completed "libbreadcrumb_tests": 9 passes in 3ms.

$ ./build/tools/cgreen-runner ./build/tests/Makefile
No tests found in './build/tests/Makefile'.

$ ./build/tools/cgreen-runner /usr/lib/libgit2.so
No tests found in '/usr/lib/libgit2.so'.
fnadeau added a commit to fnadeau/cgreen that referenced this issue Jun 7, 2021
thoni56 added a commit that referenced this issue Dec 28, 2021
Replace use of `nm` with calls to `libbfd`. This also fixes #251: cgreen-runner handle non-lib files
thoni56 added a commit that referenced this issue Jun 29, 2022
Re-fixes #251, this time by capturing the stderr from `nm` instead of
replacing it.
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

1 participant