travis: add testing on osx

This commit is contained in:
Rainer Gerhards 2017-04-12 13:46:08 +02:00
parent bd28fbf909
commit caff8cf37b
7 changed files with 149 additions and 20 deletions

View File

@ -1,3 +1,7 @@
os:
- osx
- linux
language: c
compiler:
@ -44,31 +48,42 @@ matrix:
- compiler: "gcc"
- compiler: "clang"
include:
# test for OS X
- os: osx
compiler: "clang"
env: CFLAGS="-g "
#env: CFLAGS="-g -std=c99 -Werror -W -Wall -Wextra -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute"
# note: -Werror makes ./configure.sh not properly detect functions
# like strndup() on Ubuntu 12.04. So we enable it on trusty builds
# only. The first build with gcc actually only has the purpose of
# checking for warnings (the testbench currently has some issues
# on travis Ubuntu 14.04, but not in the regular environments, we
# need to find out some time why this is).
- compiler: "gcc"
- os: linux
compiler: "gcc"
env: KAFKA="YES", CFLAGS="-g -std=c99 -Werror -W -Wall -Wextra -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute"
dist: trusty
- compiler: "clang"
- os: linux
compiler: "clang"
env: STAT_AN="YES", GROK="YES", KAFKA="YES", CFLAGS="-g -O2 -std=c99 -Werror -W -Wall -Wextra -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute -Wno-unused-function"
# note: we currently need -Wno-unused-function until we fix inline
# functions (C99 semantics are really ugly...)
dist: trusty
- compiler: "clang"
- os: linux
compiler: "clang"
env: MERGE="YES", STAT_AN="YES", CHECK="YES", GROK="YES", KAFKA="YES", CFLAGS="-g -O2 -std=c99 -Werror -W -Wall -Wextra -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute -Wno-unused-function"
# note: we currently need -Wno-unused-function until we fix inline
# functions (C99 semantics are really ugly...)
dist: trusty
- compiler: "gcc"
- os: linux
compiler: "gcc"
env: BUILD_FROM_TARBALL="YES", GROK="YES", KAFKA="YES", CHECK="YES", CFLAGS="-g -O2 -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute", RS_TESTBENCH_VALGRIND_EXTRA_OPTS="--suppressions=travis/trusty.supp --gen-suppressions=all"
dist: trusty
- compiler: "clang"
- os: linux
compiler: "clang"
env: CHECK="YES", ESTEST="YES", CFLAGS="-g -O1 -fsanitize=address -fno-color-diagnostics"
- compiler: "clang"
- os: linux
compiler: "clang"
# we run this test without assert() enabled, so that we get "production timing"
dist: trusty
env: AD_PPA="v8-devel", CHECK="YES", CFLAGS="-g -O1 -fsanitize=address -fno-color-diagnostics", CONFIGURE_FLAGS="--disable-debug"
@ -78,17 +93,18 @@ services:
before_install:
- if [ "${AD_PPA}x" == "x" ] ; then AD_PPA="v8-stable"; fi
- sudo add-apt-repository ppa:adiscon/$AD_PPA -y
- sudo add-apt-repository ppa:qpid/released -y
- sudo apt-get update -qq
- mysql -u root -e "CREATE USER 'rsyslog'@'localhost' IDENTIFIED BY 'testbench';"
- mysql -u root -e "GRANT ALL PRIVILEGES ON * . * TO 'rsyslog'@'localhost'; FLUSH PRIVILEGES;"
- mysql -u root -e "CREATE DATABASE Syslog; GRANT ALL ON Syslog.* to 'rsyslog'@'localhost' identified by 'testbench';"
- mysql -u root -e "USE Syslog; CREATE TABLE SystemEvents (ID int unsigned not null auto_increment primary key, CustomerID bigint,ReceivedAt datetime NULL,DeviceReportedTime datetime NULL,Facility smallint NULL,Priority smallint NULL,FromHost varchar(60) NULL,Message text,NTSeverity int NULL,Importance int NULL,EventSource varchar(60),EventUser varchar(60) NULL,EventCategory int NULL,EventID int NULL,EventBinaryData text NULL,MaxAvailable int NULL,CurrUsage int NULL,MinUsage int NULL,MaxUsage int NULL,InfoUnitID int NULL,SysLogTag varchar(60),EventLogType varchar(60),GenericFileName VarChar(60),SystemID int NULL); CREATE TABLE SystemEventsProperties (ID int unsigned not null auto_increment primary key,SystemEventID int NULL,ParamName varchar(255) NULL,ParamValue text NULL);"
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "${AD_PPA}x" == "x" ] ; then AD_PPA="v8-stable"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then sudo add-apt-repository ppa:adiscon/$AD_PPA -y ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then sudo add-apt-repository ppa:qpid/released -y ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then sudo apt-get update -qq ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then mysql -u root -e "CREATE USER 'rsyslog'@'localhost' IDENTIFIED BY 'testbench';" ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then mysql -u root -e "GRANT ALL PRIVILEGES ON * . * TO 'rsyslog'@'localhost'; FLUSH PRIVILEGES;" ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then mysql -u root -e "CREATE DATABASE Syslog; GRANT ALL ON Syslog.* to 'rsyslog'@'localhost' identified by 'testbench';" ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then mysql -u root -e "USE Syslog; CREATE TABLE SystemEvents (ID int unsigned not null auto_increment primary key, CustomerID bigint,ReceivedAt datetime NULL,DeviceReportedTime datetime NULL,Facility smallint NULL,Priority smallint NULL,FromHost varchar(60) NULL,Message text,NTSeverity int NULL,Importance int NULL,EventSource varchar(60),EventUser varchar(60) NULL,EventCategory int NULL,EventID int NULL,EventBinaryData text NULL,MaxAvailable int NULL,CurrUsage int NULL,MinUsage int NULL,MaxUsage int NULL,InfoUnitID int NULL,SysLogTag varchar(60),EventLogType varchar(60),GenericFileName VarChar(60),SystemID int NULL); CREATE TABLE SystemEventsProperties (ID int unsigned not null auto_increment primary key,SystemEventID int NULL,ParamName varchar(255) NULL,ParamValue text NULL);" ; fi
install:
script:
- CI/check_line_length.sh
- tests/travis/run.sh
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "${AD_PPA}x" == "x" ] ; then CI/check_line_length.sh ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then tests/travis/run.sh ; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then tests/travis/run-osx.sh ; fi

View File

@ -1923,11 +1923,14 @@ AM_CONDITIONAL(ENABLE_OMTCL, test x$enable_omtcl = xyes)
# man pages
AC_CHECKING([if required man pages already exist])
have_to_generate_man_pages="no"
git_src_have_to_generate_man_pages="yes" # default to use when building from git source
AC_ARG_ENABLE(generate-man-pages,
[AS_HELP_STRING([--enable-generate-man-pages],[Generate man pages from source @<:@default=no@:>@])],
[case "${enableval}" in
yes) have_to_generate_man_pages="yes" ;;
no) have_to_generate_man_pages="no" ;;
no) have_to_generate_man_pages="no" ;
git_src_have_to_generate_man_pages="no"
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-generate-man-pages) ;;
esac],
[have_to_generate_man_pages=no]
@ -1951,7 +1954,7 @@ AM_CONDITIONAL(ENABLE_DISTCHECK_WORKAROUND, test x$enable_distcheck_workaround =
if test "x$in_git_src" = "xyes"; then
AC_MSG_NOTICE([Running from git source])
have_to_generate_man_pages=yes
have_to_generate_man_pages=git_src_have_to_generate_man_pages
if test "x$LEX" != "xflex"; then
AC_MSG_ERROR([flex program is needed to build rsyslog, please install flex.])

View File

@ -78,8 +78,6 @@ librsyslog_la_SOURCES = \
lookup.h \
cfsysline.c \
cfsysline.h \
sd-daemon.c \
sd-daemon.h \
\
../action.h \
../action.c \
@ -89,6 +87,9 @@ librsyslog_la_SOURCES = \
../parse.c \
../parse.h \
\
sd-daemon.c \
sd-daemon.h
\
hashtable.c \
hashtable.h \
hashtable_itr.c \
@ -102,6 +103,9 @@ librsyslog_la_SOURCES = \
# the files with ../ we need to work on - so that they either become part of the
# runtime or will no longer be needed. -- rgerhards, 2008-06-13
#
#if OS_LINUX
#librsyslog_la_SOURCES += \
#endif
if WITH_MODDIRS
librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\"

17
tests/CI/prep-libestr.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "****** PREPARE libestr"
#set -o xtrace
PWD_HOME=$PWD
if [ ! -d "local_env" ]; then mkdir local_env; fi
if [ ! -d "local_env/install" ]; then mkdir local_env/install; fi
cd local_env
pwd
git clone git://github.com/rsyslog/libestr
cd libestr
autoreconf -fvi
./configure --prefix=/opt/rsyslog > /dev/null
#./configure --prefix=$PWD_HOME/local_env/install &> /dev/null
#find /opt/rsyslog
make
sudo make install
cd $PWD_HOME

16
tests/CI/prep-libfastjson.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
echo "****** PREPARE libfastjson"
#set -o xtrace
PWD_HOME=$PWD
if [ ! -d "local_env" ]; then mkdir local_env; fi
if [ ! -d "local_env/install" ]; then mkdir local_env/install; fi
cd local_env
pwd
git clone git://github.com/rsyslog/libfastjson
cd libfastjson
autoreconf -fvi
./configure --prefix=/opt/rsyslog > /dev/null
make
sudo make install
cd $PWD_HOME
#set +o xtrace

16
tests/CI/prep-liblogging.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
echo "****** PREPARE liblogging"
#set -o xtrace
PWD_HOME=$PWD
if [ ! -d "local_env" ]; then mkdir local_env; fi
if [ ! -d "local_env/install" ]; then mkdir local_env/install; fi
cd local_env
pwd
git clone git://github.com/rsyslog/liblogging
cd liblogging
autoreconf -fvi
./configure --prefix=/opt/rsyslog --disable-man-pages > /dev/null
make
sudo make install
cd $PWD_HOME
#set +o xtrace

57
tests/travis/run-osx.sh Executable file
View File

@ -0,0 +1,57 @@
# this script runs the travis CI testbench. It's easier and more
# powerful this way than using .travis.yml (plus recommended by travis support)
#
# THIS IS THE OSX VERSION OF THAT SCRIPT
#
# This environment is so different that it does not make sense to do
# both osx and linux in a single script.
#
#set -v # we want to see the execution steps
set -e # abort on first failure
#set -x # debug aid
echo "****************************** BEGIN ACTUAL SCRIPT STEP ******************************"
echo "OS: $TRAVIS_OS_NAME"
echo "DISTRIB_CODENAME: $DISTRIB_CODENAME"
echo "CLANG: $CLANG"
echo "PWD: $PWD"
export PKG_CONFIG_PATH="/opt/rsyslog/lib/pkgconfig"
source tests/CI/prep-liblogging.sh
source tests/CI/prep-libestr.sh
source tests/CI/prep-libfastjson.sh
echo "****************************** END PREP STEP ******************************"
# we turn off leak sanitizer at this time because it reports some
# pretty irrelevant problems in startup code. In the longer term,
# we should clean these up, but we also have a lot of other leak
# tests, so this is not our priority at the moment (much more
# important things are on the TODO list).
export ASAN_OPTIONS=detect_leaks=0
autoreconf --force --verbose --install
#export CONFIG_FLAGS="--prefix=/opt/rsyslog --enable-silent-rules --disable-generate-man-pages --enable-testbench --enable-imdiag --enable-imfile --enable-impstats --enable-mmrm1stspace --enable-imptcp --enable-mmanon --enable-mmaudit --enable-mmfields --enable-mmjsonparse --enable-mmpstrucdata --enable-mmsequence --enable-mmutf8fix --enable-mail --enable-omprog --enable-omstdout --enable-omuxsock --enable-pmaixforwardedfrom --enable-pmciscoios --enable-pmcisconames --enable-pmlastmsg --enable-pmsnare --enable-libgcrypt --enable-mmnormalize --disable-omudpspoof --enable-relp --disable-snmp --disable-mmsnmptrapd --enable-gnutls --enable-usertools --enable-libdbi --enable-pgsql --enable-omhttpfs --enable-elasticsearch --enable-omrelp-default-port=13515 --enable-omtcl --enable-mmdblookup"
export CONFIG_FLAGS="--prefix=/opt/rsyslog --enable-silent-rules --disable-generate-man-pages --enable-testbench --enable-imdiag --enable-imfile --enable-impstats --enable-mmrm1stspace --enable-imptcp --enable-mmanon --enable-mmaudit --enable-mmfields --enable-mmjsonparse --enable-mmpstrucdata --enable-mmsequence --enable-mmutf8fix --enable-mail --enable-omprog --enable-omstdout --enable-omuxsock --enable-pmaixforwardedfrom --enable-pmciscoios --enable-pmcisconames --enable-pmlastmsg --enable-pmsnare --disable-omudpspoof --disable-snmp --disable-mmsnmptrapd --disable-uuid --disable-libgcrypt"
./configure $CONFIG_FLAGS
export USE_AUTO_DEBUG="off" # set to "on" to enable this for travis
make -j
if [ "x$CHECK" == "xYES" ]
then
set +e # begin testbench, here we do not want to abort
make check
ALL_OK=$?
if [ -f tests/test-suite.log ]
then
cat tests/test-suite.log
fi
if [ $ALL_OK -ne 0 ]
then
echo "error in make check, error-terminating now"
exit $ALL_OK
fi
set -e # now errors are no longer permited, again
make distcheck
fi