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