diff --git a/.travis.yml b/.travis.yml index 7a15aa66..cacaf80b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,14 @@ os: - linux - osx + +osx_image: xcode10.1 + sudo: required -dist: trusty + +dist: xenial language: cpp -compiler: - - gcc - - clang addons: apt: @@ -15,11 +16,12 @@ addons: - xenial - sourceline: 'deb http://archive.ubuntu.com/ubuntu xenial main' packages: + - gcc + - g++ - libjsoncpp-dev - uuid-dev - zlib1g-dev - postgresql-server-dev-10 - - libmariadbclient-dev - openssl - libssl-dev - libsqlite3-dev @@ -27,6 +29,8 @@ addons: - cmake homebrew: packages: + - jsoncpp + - ossp-uuid - openssl - cmake - libtool @@ -36,6 +40,4 @@ addons: - sqlite3 script: - - ./build.sh - - + - ./build.sh && ./test.sh diff --git a/build.sh b/build.sh index 3abe12b8..792fe2d2 100755 --- a/build.sh +++ b/build.sh @@ -28,14 +28,14 @@ function build_drogon() { #If errors then exit if [ "$?" != "0" ]; then - exit + exit -1 fi make #If errors then exit if [ "$?" != "0" ]; then - exit + exit -1 fi echo "Installing ..." diff --git a/examples/simple_example_test/main.cc b/examples/simple_example_test/main.cc index fea291dc..45e8b488 100644 --- a/examples/simple_example_test/main.cc +++ b/examples/simple_example_test/main.cc @@ -645,4 +645,5 @@ int main(int argc, char *argv[]) //getchar(); loop[0].getLoop()->quit(); loop[1].getLoop()->quit(); + return 0; } diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..787dac8c --- /dev/null +++ b/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +cd build/examples/ + +#Make webapp run as a daemon +sed -i -e "s/\"run_as_daemon.*$/\"run_as_daemon\": true\,/" config.example.json +sed -i -e "s/\"relaunch_on_error.*$/\"relaunch_on_error\": true\,/" config.example.json + +if [ ! -f "webapp" ]; then + echo "Build failed" + exit -1 +fi +if [ ! -f "webapp_test" ]; then + echo "Build failed" + exit -1 +fi + +killall -9 webapp +./webapp +./webapp_test + +if [ $? -ne 0 ];then + echo "Error in testing" + exit -1 +fi + +exit 0