]> git.localhorst.tv Git - blank.git/commitdiff
add option to skip tests requiring a display
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 24 Nov 2016 16:32:00 +0000 (17:32 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 24 Nov 2016 16:33:55 +0000 (17:33 +0100)
.travis.yml
Makefile
scripts/docker/exec.bash
tst/integration/InvocationTest.cpp
tst/integration/StandaloneTest.cpp
tst/test.cpp

index f83818b01b8743d3b3f9493253577dc70eb3323f..402b55a53b693fc203cf2acd46a5889680f0869f 100644 (file)
@@ -11,11 +11,11 @@ services:
 matrix:
   include:
     - env: "IMAGE=archlinux-build TARGETS=codecov"
-    - env: "IMAGE=debian-build:latest TARGETS=test"
-    - env: "IMAGE=debian-build:testing TARGETS=test"
+    - env: "IMAGE=debian-build:latest TARGETS=unittest"
+    - env: "IMAGE=debian-build:testing TARGETS=unittest"
     - env: "IMAGE=ubuntu-build:latest TARGETS=test"
     - env: "IMAGE=ubuntu-build:devel TARGETS=test"
-    - env: "IMAGE=centos-build:latest TARGETS=test"
+    - env: "IMAGE=centos-build:latest TARGETS=unittest"
 
 script:
     - bash scripts/docker/exec.bash
index a2e0d37121e26743b3cb8f34e6a28273ca74eb7c..bb382a76a81f4eac8d4e337d171f4e9028248bf5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -154,6 +154,10 @@ test: $(TEST_BIN) $(TEST_TEST_BIN) $(ASSET_DEP)
        @echo run: test.test
        @./test.test
 
+unittest: $(TEST_BIN) $(TEST_TEST_BIN) $(ASSET_DEP)
+       @echo run: test.test --headless
+       @./test.test --headless
+
 coverage: $(COVER_BIN) $(COVER_TEST_BIN) $(ASSET_DEP)
        @echo run: test.cover
        @./test.cover
@@ -177,7 +181,7 @@ distclean: clean
        rm -f $(BIN) cachegrind.out.* callgrind.out.*
        rm -Rf build client-saves saves
 
-.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test coverage codecov lint clean distclean
+.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test unittest coverage codecov lint clean distclean
 
 -include $(DEP)
 
index 3ba2d6f44420e43b0e7b719b2b3953930c3af850..ea6f97daa93e1825dcaeeca1616ca9cafb38953e 100755 (executable)
@@ -13,7 +13,7 @@ image_path="scripts/docker/${IMAGE//:/-}"
 
 xvfb_cmd="xvfb-run -a --server-args='-screen 0 1024x768x24 +extension RANDR +extension GLX'"
 
-build_cmd="git clone /repo /workdir && cd /workdir && make -j\$(nproc) $TARGETS"
+build_cmd="cp -R /repo /workdir && cd /workdir && make -j\$(nproc) $TARGETS"
 
 if [[ "$KEEP" != "" ]]; then
        build_cmd="${build_cmd} && cp -Rv $KEEP /repo"
index 0d4c52ca464fbb2c66a3e49e4818e81e960dd064..fd9c98fff1150afff115049ee96992577e23f31d 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "TestInstance.hpp"
 
-CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::InvocationTest);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(blank::test::InvocationTest, "integration");
 
 
 namespace blank {
index d008ec806ac1a99321463c02a015a851762ba6f3..40930a7c39687799d0ff50e9951e2ea74d4e1c72 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "TestInstance.hpp"
 
-CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::StandaloneTest);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(blank::test::StandaloneTest, "integration");
 
 
 namespace blank {
index f95ead372d3ce212faa3b17872aae9dd6a5fa38e..04244675655e0565dc373b3b3338cc2e1dfd030b 100644 (file)
@@ -1,3 +1,4 @@
+#include <cstring>
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
 
@@ -5,10 +6,23 @@ using CppUnit::TestFactoryRegistry;
 using CppUnit::TextUi::TestRunner;
 
 
-int main(int, char **) {
+int main(int argc, char **argv) {
+
+       bool headless = false;
+       if (argc > 1 && std::strcmp(argv[1], "--headless") == 0) {
+               headless = true;
+       }
+
        TestRunner runner;
-       TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry();
-       runner.addTest(registry.makeTest());
+       {
+               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 {