4 # .travis-functions.sh:
5 # - helper functions to be sourced from .travis.yml
6 # - designed to respect travis' environment but testing locally is possible
9 if [ ! -f "configure.ac" ]; then
10 echo ".travis-functions.sh must be sourced from source dir" >&2
14 ## some config settings
15 # travis docs say we get 1.5 CPUs
17 DUMP_CONFIG_LOG
="short"
18 export TS_OPT_parsable
="yes"
20 # workaround ugly warning on travis OSX,
21 # see https://github.com/direnv/direnv/issues/210
22 shell_session_update
() { :; }
29 .
/configure
"$@" $OSX_CONFOPTS
31 if [ "$DUMP_CONFIG_LOG" = "short" ]; then
32 grep -B1 -A10000 "^## Output variables" config.log |
grep -v "_FALSE="
33 elif [ "$DUMP_CONFIG_LOG" = "full" ]; then
39 # TODO: integrate checkusage into our regular tests and remove this function
40 function make_checkusage
43 if ! tmp
=$
($MAKE checkusage
2>&1) ||
test -n "$tmp"; then
45 echo "make checkusage failed" >&2
50 function check_nonroot
52 local make_opts
="$MAKE_CHECK_OPTS --show-diff"
54 --disable-use-tty-group \
55 --disable-makeinstall-chown \
56 --enable-all-programs"
58 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
59 conf_opts
="$conf_opts --enable-asan"
60 make_opts
="$make_opts --memcheck-asan"
63 xconfigure
$conf_opts ||
return
67 $MAKE check TS_OPTS
="$make_opts" ||
return
69 make_checkusage ||
return
71 $MAKE install DESTDIR
=/tmp
/dest ||
return
76 local make_opts
="$MAKE_CHECK_OPTS --show-diff"
77 local conf_opts
="--enable-all-programs"
79 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
80 conf_opts
="$conf_opts --enable-asan"
81 make_opts
="$make_opts --memcheck-asan"
84 xconfigure
$conf_opts ||
return
87 $MAKE check TS_COMMAND
="true" ||
return
89 sudo
-E $MAKE check TS_OPTS
="$make_opts" ||
return
91 # root on osx has not enough permission for make install ;)
92 [ "$TRAVIS_OS_NAME" = "osx" ] && return
94 # keep PATH to make sure sudo would find $CC
95 sudo env
"PATH=$PATH" $MAKE install ||
return
102 $MAKE distcheck ||
return
105 function travis_install_script
107 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
112 # install required packages
113 sudo apt-get
-qq update
--fix-missing
114 sudo apt-get
install -qq >/dev
/null \
128 # install only if available (e.g. Ubuntu Trusty)
129 sudo apt-get
install -qq >/dev
/null \
130 libsystemd-daemon-dev \
131 libsystemd-journal-dev \
135 function osx_install_script
137 brew update
>/dev
/null
139 brew
install gettext ncurses socat xz
140 brew link
--force gettext
141 brew link
--force ncurses
148 # workaround: glibtoolize could not find sed
152 function osx_prepare_check
154 [ "$TRAVIS_OS_NAME" = "osx" ] ||
return 0
156 # these ones only need to be gnu for our test-suite
157 brew
install coreutils findutils gnu-tar gnu-sed
159 # symlink minimally needed gnu commands into PATH
161 for cmd
in readlink
seq timeout truncate
find xargs tar sed; do
162 ln -s /usr
/local
/bin
/g
$cmd $HOME/bin
/$cmd
166 export TS_OPT_col_multibyte_known_fail
=yes
167 export TS_OPT_colcrt_regressions_known_fail
=yes
168 export TS_OPT_column_invalid_multibyte_known_fail
=yes
171 function travis_before_script
182 function travis_script
187 case "$MAKE_CHECK" in
198 echo "error, check environment (travis.yml)" >&2
203 # We exit here with case-switch return value!
209 function travis_after_script
214 # find diff dir from check as well as from distcheck
215 diff_dir
=$
(find .
-type d
-name "diff" |
grep "tests/diff" |
head -n 1)
216 if [ -d "$diff_dir" ]; then
217 tmp
=$
(find "$diff_dir" -type f |
sort)
218 echo -en "dump test diffs:\n${tmp}\n"
219 echo "$tmp" |
xargs cat