-
Notifications
You must be signed in to change notification settings - Fork 180
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
cmake: tests that are not .cpp standalones #2836
Comments
To define a command line test (i.e. a chain of bash commands that return 0 on success), we use the Generally speaking, I think we should change and simplify the structure of the testing directory. I find it to be, even before our switch to CMake, confusing. Here are some thoughts on this:
|
For us it was probably a case of "unit test" == "smaller in scale than a per-command-input-to-output regression test". If there's more suitable terminology, happy to change.
Because the addition of NPY support was in the C++ code. "
In the repository this is already the case. Is this maybe supposed to be in reference to the way that
Certainly the Python executables depend on the C++ executables; the Python tests don't depend on the C++ tests. But if testing can only be done following a
Where I eventually landed on #2789 was to take each file containing multiple tests, and turn each line into an appropriately named bash script in a sub-directory belonging to that command. This would give more sensible test names when run in |
Ok so would the more appropriate place for files in
Yeah sorry, I'm using "tests" wrongly here. What I was referring to is to tools (e.g. under |
Assuming you meant "A C++ test wouldn't need a Python tool", yes, that's precisely what the NPY tests do need. I'm generating NPY data using Python and then reading it in a C++ command, and vice versa. Part of where I'm stumbling I think is that the port to So what I think we need is:
|
Ok, yes that makes sense to me. |
Closed by #2842. |
@daljit46 I'll need your input on this one.
I believe that this was a failure on my part to fully resolve #2437 against #2689.
Whatever is the solution here, will also be applicable to #2678, where I'm trying to add a test of the Python CLI changes.
Relates to #2834, but is sufficiently different to justify a separate thread.
Previously, the "unit tests", as distinct from the "binaries" (ie. C++) and "scripts" (ie. Python) tests, were all just
.cpp
files, that could be compiled by invoking thebuild
script in thetesting/
directory. A set of text files then defined the tests, each of which literally just invoked the compiled binary with no arguments.I think in #2437 (and now coming in #2678), I was exploiting this design to achieve testing in a different way, and now with the move to
cmake
perhaps it no longer works.There, I added a more complex test structure:
testing/bin/testing_*_npy
are written in Python (though do not use the MRtrix3 Python API), and are used to generate and check data for evaluating the C++ NPY support;testing/tools/testing_unit_tests_npy*.cpp
result in compilation of binaries that perform functionalities to be evaluated by the Python commands above;testing/tests/npy
executes the C++ and Python functions above in sequence as necessary to evaluate the proper function of the C++ NPY support.This is however being overlooked by the new
cmake
test suite construction, which I am naive to.On naive inspection, I think what's happening now on
dev
is that:testing/unit_tests/CMakeLists.txt
.cpp
file with that name is compiled;Trouble here is that my NPY tests don't conform to this structure.
Files
testing/tools/testing_unit_tests_npy*.cpp
are I think in the correct location, though "unit_tests_
" should probably be stripped from their names. The problem is that I want to be able to define a unit test (ie. it's test of neither a specific binary nor a Python command), where the commands to be invoked to complete that test is more complex than just the name of a compiled binary. That will I think require more complexcmake
directives than what currently exists ondev
.I'm hoping that if
dev
is modified such that the NPY tests are performed as intended, then #2678 will re-use that structure.The text was updated successfully, but these errors were encountered: