Tests not found

Hello.

I am trying to build VTK, and then run the tests on my machine.

  • I am using CMake 3.22.4.
  • I have downloaded the release source tarball for VTK on the website (version 9.1.0).
  • I am on macOS (Big Sur 11.6.5).
  • I have Macports python 3.10 in the path (which python finds it).
  • I have used ccmake and changed the following variables:
    * BUILD_SHARED_LIBS = OFF
    * CMAKE_BUILD_TYPE = Release
    * CMAKE_INSTALL_PREFIX = /sw/local/
    * VTK_BUILD_TESTING = WANT

When I start the build, it runs through 4238 targets and completes. But when I then run ctest, it says it does not find any test, and if I try ninja test, it says it is not a target.

Am I doing something wrong. From the build documentation, I could not find anything. I tried rebuilding setting (on top of VTK_BUILD_TESTING) the variable TESTING=ON and BUILD_TESTING=ON. It changed absolutely nothing.

Any help would be appreciated.
Thanks.

(Edit: added the BUILD_SHARED_LIBS=OFF variable to the modified CMake variables.)

I have further tried some of the instructions in the build.md file.
Specifically, I have tried downloading the data via the VTKData target.
I have tried using ninja and make.
In either case, the VTKData target does not exist.
I am attaching a screenshot of the results.

If VTK_BUILD_TESTING is ON, then the test data will automatically be downloaded when you build VTK.

So all that should be needed is to run “ninja” to build, and run “ctest” to test. Both of these must be run from the build directory.

1 Like

I tried setting it to ON or WANT and neither worked. I always issued all my commands from the build directory.

Looking deeper into this, I found this code in vtkTesting.cmake

if (NOT EXISTS "${VTK_SOURCE_DIR}/.ExternalData/README.rst")
  # This file is always present in version-controlled source trees
  # so we must have been extracted from a source tarball with no
  # data objects needed for testing.  Turn off tests by default
  # since enabling them requires network access or manual data
  # store configuration.
  set(VTK_BUILD_TESTING OFF)
endif ()

Right after those lines, I inserted an extra message command and realized that no matter what I asked for, testing was always set back to OFF.

Does this mean that testing is not supported anymore when building from the tarball and that I should clone the VTK git?

For most libraries, I like to download the tarball and build from it with tests to insure the build is not bad, but if it is not supported anymore, I’ll look into using git.

I have currently cheated and modified the vtkTesting.cmake file manually to set VTK_BUILD_TESTING back to ON right after it was set to OFF. I now have over 8000 targets (most of them download targets) and the build is ongoing.

Thanks for your time.

I’d never seen that before, though it dates back to VTK 6.1.

It would have been easy for the developer who wrote that code to provide a message:

    if (VTK_BUILD_TESTING)
        message(STATUS "VTK_BUILD_TESTING was ${VTK_BUILD_TESTING}, but testing"
                " is disabled because there is no .ExternalData/README.rst in the"
                " source tree.")
    endif ()

etcetera

I would tend to agree, but I would also prefer that when I as a user specify that I want the tests, that even if they required bandwith or someting, that request is “honored”.

Warn me that it will download a large amount of data at the configure stage so that I can change my mind or something, but simply not compiling the tests without any other signal was a bit confusing. It is weird to have the option if it ends up being ignored. Maybe a better alternative is to not present the option (i.e. not have VTK_BUILD_TESTING in ccmake or cmake-gui) when the file is not found?

Anyhow, I have redownloaded the source tarball, I went into the source directory and created an empty .ExternalData/README.rst file. Then, in another location, I created a build directory, configure with ccmake specifying that I want the tests and everything went as I expected.

Thanks again.

I hear your frustration. I did a little bit more digging. Unfortunately there seems to be no documentation about how to build and test with the download tarballs.

The VTKData-9.1.0.tar.gz tarball contains VTK-9.1.0/.ExternalData/README.rst and all the data files (as an object store in VTK-9.1.0/.ExternalData/SHA512).

It seems that, for testing, people are expected (but not told) to untar VTKData-9.1.0.tar.gz over top of their VTK-9.1.0 source directory. This will provide the thousands of data files that would otherwise be downloaded during the build.

How anyone is expected to figure this out on their own, I don’t know. Especially since .ExternalData is a hidden directory. The VTKData build target doesn’t appear unless this is done before VTK_BUILD_TESTING is turned on.