Building ctest test, that is supposed to print ERR(ors) but terminate cleanly

I’ve created a bunch of tests for the CDI (netcdf) reader, and I would like to also add tests with broken files / … where paraview is supposed to throw errors, but not crash. Now, when I build a test that causes an error message (via vtkErrorMacro), the output contains ERR and the test fails because of that (vtkSMTestDriver: Error string found in output, vtkSMTestDriver returning 1).

Can I anchor the test in the CMakeLists.txt in a way that it can print whatever it wants, but it needs to exit cleanly with exit status 0?
Here’s my current CMakeLists.txt file using paraview_add_client_tests:
https://gitlab.kitware.com/florian.ziemen/paraview/-/blob/merge-with-master/Plugins/CDIReader/Testing/XML/CMakeLists.txt

Hmm. Tests with expected failure in plugins…

Usually, one would attach a vtkErrorObserver to the object in question and verify that the right errors occur. This would swallow up the error from reaching the output while not interfering with any other error output at the same time. I think what might be easiest is to do one of:

  • write the test on the module with the relevant reader
  • write a Python script that loads the plugin and then use the Python APIs to construct objects and attach observers as necessary