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 opts
="$MAKE_CHECK_OPTS --show-diff"
55 --disable-use-tty-group \
56 --disable-makeinstall-chown \
57 --enable-all-programs \
62 $MAKE check TS_OPTS
="$opts" ||
return
64 make_checkusage ||
return
66 $MAKE install DESTDIR
=/tmp
/dest ||
return
71 local opts
="$MAKE_CHECK_OPTS --show-diff"
74 --enable-all-programs \
78 $MAKE check TS_COMMAND
="true" ||
return
80 sudo
-E $MAKE check TS_OPTS
="$opts" ||
return
82 # root on osx has not enough permission for make install ;)
83 [ "$TRAVIS_OS_NAME" = "osx" ] && return
85 # keep PATH to make sure sudo would find $CC
86 sudo env
"PATH=$PATH" $MAKE install ||
return
93 $MAKE distcheck ||
return
96 function travis_install_script
98 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
103 # install required packages
104 sudo apt-get
-qq update
--fix-missing
105 sudo apt-get
install -qq >/dev
/null \
119 # install only if available (e.g. Ubuntu Trusty)
120 sudo apt-get
install -qq >/dev
/null \
121 libsystemd-daemon-dev \
122 libsystemd-journal-dev \
126 function osx_install_script
128 brew update
>/dev
/null
130 brew
install gettext ncurses socat xz
131 brew link
--force gettext
132 brew link
--force ncurses
139 # workaround: glibtoolize could not find sed
143 function osx_prepare_check
145 [ "$TRAVIS_OS_NAME" = "osx" ] ||
return 0
147 # these ones only need to be gnu for our test-suite
148 brew
install coreutils findutils gnu-tar gnu-sed
150 # symlink minimally needed gnu commands into PATH
152 for cmd
in readlink
seq timeout truncate
find xargs tar sed; do
153 ln -s /usr
/local
/bin
/g
$cmd $HOME/bin
/$cmd
157 export TS_OPT_col_multibyte_known_fail
=yes
158 export TS_OPT_colcrt_regressions_known_fail
=yes
159 export TS_OPT_column_invalid_multibyte_known_fail
=yes
162 function travis_before_script
173 function travis_script
178 case "$MAKE_CHECK" in
189 echo "error, check environment (travis.yml)" >&2
194 # We exit here with case-switch return value!
200 function travis_after_script
205 # find diff dir from check as well as from distcheck
206 diff_dir
=$
(find .
-type d
-name "diff" |
grep "tests/diff" |
head -n 1)
207 if [ -d "$diff_dir" ]; then
208 tmp
=$
(find "$diff_dir" -type f |
sort)
209 echo -en "dump test diffs:\n${tmp}\n"
210 echo "$tmp" |
xargs cat