diff --git a/.travis.sh b/.travis.sh new file mode 100755 index 0000000000..77a0820a4c --- /dev/null +++ b/.travis.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# A hacky way of running the unit tests at the same time as the normal builds. +if [ $RUNTESTS ] ; then + cd ./src/test && make test +else + make -j2 +fi diff --git a/.travis.yml b/.travis.yml index a4457c2c02..7db4e3f0ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ env: + - RUNTESTS=True - TARGET=CC3D - TARGET=CC3D OPBL=yes - TARGET=CHEBUZZF3 @@ -12,14 +13,15 @@ env: - TARGET=SPARKY - TARGET=STM32F3DISCOVERY - TARGET=ALIENWIIF1 -language: c -compiler: arm-none-eabi-gcc +# We use cpp for unit tests, and c for the main project. +language: cpp +compiler: clang before_install: sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded && sudo apt-get update install: sudo apt-get install build-essential gcc-arm-none-eabi git -before_script: $CC --version -script: make -j2 +before_script: arm-none-eabi-gcc --version +script: ./.travis.sh notifications: irc: "chat.freenode.net#cleanflight" use_notice: true - skip_join: true \ No newline at end of file + skip_join: true diff --git a/src/test/Makefile b/src/test/Makefile index f089fdddf6..6642d98b8f 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -318,4 +318,8 @@ ws2811_unittest : \ $(CXX) $(CXX_FLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@ +test: $(TESTS) + set -e && for test in $(TESTS) ; do \ + $(OBJECT_DIR)/$$test; \ + done