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>
15 # TESTS_PARALLEL_OPTION=
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"
32 export TS_OPT_parsable
="yes"
34 # workaround ugly warning on travis OSX,
35 # see https://github.com/direnv/direnv/issues/210
36 shell_session_update
() { :; }
43 .
/configure
"$@" $OSX_CONFOPTS
45 if [ "$DUMP_CONFIG_LOG" = "short" ]; then
46 grep -B1 -A10000 "^## Output variables" config.log |
grep -v "_FALSE="
47 elif [ "$DUMP_CONFIG_LOG" = "full" ]; then
53 # TODO: integrate checkusage into our regular tests and remove this function
54 function make_checkusage
57 if ! tmp
=$
($MAKE checkusage
2>&1) ||
test -n "$tmp"; then
59 echo "make checkusage failed" >&2
64 function check_nonroot
66 local make_opts
="$MAKE_CHECK_OPTS --show-diff"
68 --disable-use-tty-group \
69 --disable-makeinstall-chown \
70 --enable-all-programs"
72 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
73 conf_opts
="$conf_opts --enable-asan"
74 make_opts
="$make_opts --memcheck-asan"
77 xconfigure
$conf_opts ||
return
82 # TESTS_* overwrites default from tests/Makemodule.am
83 $MAKE check TESTS_OPTIONS
="$make_opts" ||
return
85 make_checkusage ||
return
87 $MAKE install DESTDIR
=/tmp
/dest ||
return
92 local make_opts
="$MAKE_CHECK_OPTS --show-diff"
93 local conf_opts
="--enable-all-programs"
95 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
96 conf_opts
="$conf_opts --enable-asan"
97 make_opts
="$make_opts --memcheck-asan"
100 xconfigure
$conf_opts ||
return
104 $MAKE check-programs ||
return
106 # Modify environment for OSX
109 # TESTS_* overwrites default from tests/Makemodule.am
110 sudo
-E $MAKE check
"TESTS_PARALLEL_OPTION=--parallel=none" TESTS_OPTIONS
="$make_opts" ||
return
112 # root on osx has not enough permission for make install ;)
113 [ "$TRAVIS_OS_NAME" = "osx" ] && return
115 # keep PATH to make sure sudo would find $CC
116 sudo env
"PATH=$PATH" $MAKE install ||
return
123 $MAKE distcheck ||
return
126 function travis_install_script
128 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
133 # install required packages
134 sudo apt-get
-qq update
--fix-missing
135 sudo apt-get
install -qq >/dev
/null \
149 # install only if available (e.g. Ubuntu Trusty)
150 sudo apt-get
install -qq >/dev
/null \
151 libsystemd-daemon-dev \
152 libsystemd-journal-dev \
156 function osx_install_script
158 brew update
>/dev
/null
160 brew
install gettext ncurses socat xz
161 brew link
--force gettext
162 brew link
--force ncurses
169 # workaround: glibtoolize could not find sed
173 function osx_prepare_check
175 [ "$TRAVIS_OS_NAME" = "osx" ] ||
return 0
177 # these ones only need to be gnu for our test-suite
178 brew
install coreutils findutils gnu-tar gnu-sed
180 # symlink minimally needed gnu commands into PATH
182 for cmd
in readlink
seq timeout truncate
find xargs tar sed; do
183 ln -s /usr
/local
/bin
/g
$cmd $HOME/bin
/$cmd
187 export TS_OPT_col_multibyte_known_fail
=yes
188 export TS_OPT_colcrt_regressions_known_fail
=yes
189 export TS_OPT_column_invalid_multibyte_known_fail
=yes
192 function travis_before_script
203 function travis_script
208 case "$MAKE_CHECK" in
219 echo "error, check environment (travis.yml)" >&2
224 # We exit here with case-switch return value!
230 function travis_after_script
235 # find diff dir from check as well as from distcheck
236 diff_dir
=$
(find .
-type d
-name "diff" |
grep "tests/diff" |
head -n 1)
237 if [ -d "$diff_dir" ]; then
238 tmp
=$
(find "$diff_dir" -type f |
sort)
239 echo -en "dump test diffs:\n${tmp}\n"
240 echo "$tmp" |
xargs cat