4 # .travis-functions.sh:
5 # - helper functions to be sourced from .travis.yml
6 # - designed to respect travis' environment but testing locally is possible
10 # TS_OPT_<name>_<something>=yes
11 # - forces tests/functions.sh:ts_has_option() to return "yes" for
12 # variable <something> in test <name>
17 # - overwrites default from tests/Makemodule.am
19 # Do not use TS_* prefix for any travis or build-system stuff. This prefix is
20 # exclusively used by tests/ stuff.
23 if [ ! -f "configure.ac" ]; then
24 echo ".travis-functions.sh must be sourced from source dir" >&2
28 ## some config settings
29 # travis docs say we get 1.5 CPUs
31 DUMP_CONFIG_LOG
="short"
33 # workaround ugly warning on travis OSX,
34 # see https://github.com/direnv/direnv/issues/210
35 shell_session_update
() { :; }
42 .
/configure
"$@" $OSX_CONFOPTS
44 if [ "$DUMP_CONFIG_LOG" = "short" ]; then
45 grep -B1 -A10000 "^## Output variables" config.log |
grep -v "_FALSE="
46 elif [ "$DUMP_CONFIG_LOG" = "full" ]; then
52 # TODO: integrate checkusage into our regular tests and remove this function
53 function make_checkusage
56 if ! tmp
=$
($MAKE checkusage
2>&1) ||
test -n "$tmp"; then
58 echo "make checkusage failed" >&2
63 function check_nonroot
65 local make_opts
="$MAKE_CHECK_OPTS --show-diff --parsable"
67 --disable-use-tty-group \
68 --disable-makeinstall-chown \
69 --enable-all-programs"
71 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
72 conf_opts
="$conf_opts --enable-asan"
73 make_opts
="$make_opts --memcheck-asan"
76 xconfigure
$conf_opts ||
return
81 # TESTS_* overwrites default from tests/Makemodule.am
82 $MAKE check TESTS_OPTIONS
="$make_opts" ||
return
84 make_checkusage ||
return
86 $MAKE install DESTDIR
=/tmp
/dest ||
return
91 local make_opts
="$MAKE_CHECK_OPTS --show-diff"
92 local conf_opts
="--enable-all-programs"
94 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
95 conf_opts
="$conf_opts --enable-asan"
96 make_opts
="$make_opts --memcheck-asan"
99 xconfigure
$conf_opts ||
return
103 $MAKE check-programs ||
return
105 # Modify environment for OSX
108 # TESTS_* overwrites default from tests/Makemodule.am
109 sudo
-E $MAKE check TESTS_PARALLEL
="" TESTS_OPTIONS
="$make_opts" ||
return
111 # root on osx has not enough permission for make install ;)
112 [ "$TRAVIS_OS_NAME" = "osx" ] && return
114 # keep PATH to make sure sudo would find $CC
115 sudo env
"PATH=$PATH" $MAKE install ||
return
122 $MAKE distcheck ||
return
125 function travis_install_script
127 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
132 # install required packages
133 sudo apt-get
-qq update
--fix-missing
134 sudo apt-get
install -qq >/dev
/null \
148 # install only if available (e.g. Ubuntu Trusty)
149 sudo apt-get
install -qq >/dev
/null \
150 libsystemd-daemon-dev \
151 libsystemd-journal-dev \
155 function osx_install_script
157 brew update
>/dev
/null
159 brew
install gettext ncurses socat xz
160 brew link
--force gettext
161 brew link
--force ncurses
168 # workaround: glibtoolize could not find sed
172 function osx_prepare_check
174 [ "$TRAVIS_OS_NAME" = "osx" ] ||
return 0
176 # these ones only need to be gnu for our test-suite
177 brew
install coreutils findutils gnu-tar gnu-sed
179 # symlink minimally needed gnu commands into PATH
181 for cmd
in readlink
seq timeout truncate
find xargs tar sed; do
182 ln -s /usr
/local
/bin
/g
$cmd $HOME/bin
/$cmd
186 export TS_OPT_col_multibyte_known_fail
=yes
187 export TS_OPT_colcrt_regressions_known_fail
=yes
188 export TS_OPT_column_invalid_multibyte_known_fail
=yes
191 function travis_before_script
202 function travis_script
207 case "$MAKE_CHECK" in
218 echo "error, check environment (travis.yml)" >&2
223 # We exit here with case-switch return value!
229 function travis_after_script
234 # find diff dir from check as well as from distcheck
235 diff_dir
=$
(find .
-type d
-name "diff" |
grep "tests/diff" |
head -n 1)
236 if [ -d "$diff_dir" ]; then
237 tmp
=$
(find "$diff_dir" -type f |
sort)
238 echo -en "dump test diffs:\n${tmp}\n"
239 echo "$tmp" |
xargs cat