-
Notifications
You must be signed in to change notification settings - Fork 47
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 #251: cgreen-runner handle non-lib files #255
Fix #251: cgreen-runner handle non-lib files #255
Conversation
Thanks for this PR! It addresses something I/we have been thinking about for a long time. And it seems to be a good implementation with tests and all ;-) It comes with a backside, though. We really want to make sure that writing testcases and running them with a "programmed" runner is possible in as many environments as possible, including standard C-99 embedded environments. As this PR only affects the But there are a couple of things that I want to bring up: DocumentationThere are currently no "special" dependencies so there is no natural place for documenting the new dependency on User Experience when libbfd is missingAs it now stands the CMake build stops with
I'm not sure this is good user experience, the message requires a bit of CMake knowledge and Google-fu, in the situation that you just want to compile and get going. It also brings to mind that there are situations where you want to just build the library (in those embedded environments e.g.) but easy support to opt out from building Cygwin (and other platforms) buildOn Cygwin there is no
The Any ideas? I have not tried to build on Msys2 or Darwin. Before including this PR I want to make sure that this builds cleanly on as many platforms as possible, and that end users don't have to go through this dance (I don't mind ;-), ValgrindI tried to |
20162a4
to
fc91427
Compare
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'.
Add depending on the distro used: /usr/lib/libbfd.(a|so). Headers and libraries are provided by different package depending on the distro: binutils, binutils-devel, sys-libs/binutils-libs, etc.
Following change to dicoverer.c, unit tests needed some rewriting. Discoverer acceptance and unit tests were added to cmake.
This change allow dependency validation and parallel testing.
fc91427
to
2d7e2b8
Compare
libiberty definitely used to be in the Cygwin base distribution 20 years ago. Still, it looks like most of the feedback has been resolved in the follow-up commits. Can you take another look @thoni56 ? |
Thanks, @matthargett, for bringing this back to my attention. I had totally forgotten about this. @fnadeau thank you for the updates, and sorry for the delay. This works like a charm on Ubuntu, but unfortunately I still have problems building this in Cygwin/64.
I think Cygwin is becoming a bit marginalised nowadays, but I have a couple of project that I still need to build on Cygwin, so I'm reluctant to bring this in unless it works on Cygwin or we have special handling for it. But the only special handling that I can think of is using I'll also investigate this on Msys2 64-bit "native", which is basically Cygwin, and see if there is any difference. |
Ok, so these look mostly as an unresolved gettext dependency, maybe from EDIT: Msys2 has the same problem. |
This is more of a status report than anything else... I've fixed most of the issues I've seen (evident in the not exactly pretty commit sequence here...), but I still have one left. On Ubuntu 20.04 the discoverer unit tests build fine using the (verbose) CMake command:
but the exact same step fails on Cygwin:
Somehow |
Aaarrrgh... Now it builds cleanly... But only now do I realise that since shared libraries on Cygwin are actually PE32+ executables,
I'll investigate if |
Yes, But since the call to I don't (didn't) know anything about the binary file formats, so I don't know how to explore this further. Do anyone know about a "command line bfd explorer" or something similar? |
We need to distinguish between dynamic ( I'll start with adding that check to split |
…ng runner... When developing the cgreen-runner, we want to avoid using it for running the unittests as to not end up with unit tests not running.
…calize When reading a non-dynamic BFD object we need to use corresponding non-dynamic version of the functions. This made the runner correctly handle COFF/PE32+ files (.DLL's)
The difference is actually only which 'symtab_upper_bound' and 'canonicalize' you use.
Fixed. It was actually only a matter of using non-dynamic counterparts of two bfd-functions. So, ready to merge this now. (Sorry for re-using this for the fixes, I actually thought that I had created a branch when I saw that it needed some more research, but well...) |
Well, I suppose I should have know with so much fiddling with building on Cygwin, MacOS, ... that my initial concern about portability would come back and bite us. FYI, as indicated by #300, Debian has forbidden access to This means that this, and the related changes that ports it to other platforms, has to be reverted, going back to the more portable Sad, because it was an interesting approach and should really be the way to go (if it was just portable/stable enough). |
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'.