]> git.localhorst.tv Git - blank.git/blobdiff - tst/test.cpp
add option to skip tests requiring a display
[blank.git] / tst / test.cpp
index 180b0edca640286a520c767d37a74f2a4547eea0..04244675655e0565dc373b3b3338cc2e1dfd030b 100644 (file)
@@ -1,5 +1,4 @@
-#include "app/init.hpp"
-
+#include <cstring>
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
 
@@ -7,18 +6,26 @@ using CppUnit::TestFactoryRegistry;
 using CppUnit::TextUi::TestRunner;
 
 
-int main(int, char **) {
-       blank::InitSDL sdl;
-       blank::InitGL gl;
-       blank::Window win;
-       blank::GLContext ctx(win.CreateContext());
-       blank::InitGLEW glew;
+int main(int argc, char **argv) {
 
-       TestRunner runner;
-       TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry();
-       runner.addTest(registry.makeTest());
-       runner.run();
+       bool headless = false;
+       if (argc > 1 && std::strcmp(argv[1], "--headless") == 0) {
+               headless = true;
+       }
 
-       return 0;
+       TestRunner runner;
+       {
+               TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry();
+               runner.addTest(registry.makeTest());
+       }
+       if (!headless) {
+               TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry("integration");
+               runner.addTest(registry.makeTest());
+       }
 
+       if (runner.run()) {
+               return 0;
+       } else {
+               return 1;
+       }
 }