Add some Travis CI tests

This commit is contained in:
antao 2019-03-26 15:25:22 +08:00
parent 9132b08c87
commit 1f8be1ce8c
4 changed files with 39 additions and 10 deletions

View File

@ -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

View File

@ -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 ..."

View File

@ -645,4 +645,5 @@ int main(int argc, char *argv[])
//getchar();
loop[0].getLoop()->quit();
loop[1].getLoop()->quit();
return 0;
}

26
test.sh Executable file
View File

@ -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