vtkTestingRenderingDriver.cmake 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN
  2. "
  3. vtksys::SystemInformation::SetStackTraceOnError(1);
  4. #ifndef NDEBUG
  5. vtkFloatingPointExceptions::Enable();
  6. #endif
  7. // Set defaults
  8. vtkTestingInteractor::ValidBaseline = \"Use_-V_for_Baseline\";
  9. vtkTestingInteractor::TempDirectory =
  10. std::string(\"${_vtk_build_TEST_OUTPUT_DIRECTORY}\");
  11. vtkTestingInteractor::DataDirectory = std::string(\"Use_-D_for_Data\");
  12. int interactive = 0;
  13. for (int ii = 0; ii < ac; ++ii)
  14. {
  15. if (strcmp(av[ii], \"-I\") == 0)
  16. {
  17. interactive = 1;
  18. continue;
  19. }
  20. if (ii < ac-1 && strcmp(av[ii], \"-V\") == 0)
  21. {
  22. vtkTestingInteractor::ValidBaseline = std::string(av[++ii]);
  23. continue;
  24. }
  25. if (ii < ac-1 && strcmp(av[ii], \"-T\") == 0)
  26. {
  27. vtkTestingInteractor::TempDirectory = std::string(av[++ii]);
  28. continue;
  29. }
  30. if (ii < ac-1 && strcmp(av[ii], \"-D\") == 0)
  31. {
  32. vtkTestingInteractor::DataDirectory = std::string(av[++ii]);
  33. continue;
  34. }
  35. if (ii < ac-1 && strcmp(av[ii], \"-E\") == 0)
  36. {
  37. vtkTestingInteractor::ErrorThreshold =
  38. static_cast<double>(atof(av[++ii]));
  39. continue;
  40. }
  41. if (ii < ac-1 && strcmp(av[ii], \"-v\") == 0)
  42. {
  43. vtkLogger::SetStderrVerbosity(static_cast<vtkLogger::Verbosity>(atoi(av[++ii])));
  44. continue;
  45. }
  46. }
  47. // init logging
  48. vtkLogger::Init(ac, av, nullptr);
  49. // turn on windows stack traces if applicable
  50. vtkWindowsTestUtilitiesSetupForTesting();
  51. vtkSmartPointer<vtkTestingObjectFactory> factory = vtkSmartPointer<vtkTestingObjectFactory>::New();
  52. if (!interactive)
  53. {
  54. // Disable any other overrides before registering our factory.
  55. vtkObjectFactoryCollection *collection = vtkObjectFactory::GetRegisteredFactories();
  56. collection->InitTraversal();
  57. vtkObjectFactory *f = collection->GetNextItem();
  58. while (f)
  59. {
  60. f->Disable(\"vtkRenderWindowInteractor\");
  61. f = collection->GetNextItem();
  62. }
  63. vtkObjectFactory::RegisterFactory(factory);
  64. }
  65. "
  66. )
  67. SET(CMAKE_TESTDRIVER_AFTER_TESTMAIN
  68. "
  69. if (result == VTK_SKIP_RETURN_CODE)
  70. {
  71. printf(\"Unsupported runtime configuration: Test returned \"
  72. \"VTK_SKIP_RETURN_CODE. Skipping test.\\n\");
  73. return result;
  74. }
  75. if (!interactive)
  76. {
  77. if (vtkTestingInteractor::TestReturnStatus != -1)
  78. {
  79. if (vtkTestingInteractor::TestReturnStatus != vtkTesting::PASSED)
  80. {
  81. result = EXIT_FAILURE;
  82. }
  83. else
  84. {
  85. result = EXIT_SUCCESS;
  86. }
  87. }
  88. vtkObjectFactory::UnRegisterFactory(factory);
  89. }
  90. "
  91. )