]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - .travis-functions.sh
libmount: fix comment referring to passno field
[thirdparty/util-linux.git] / .travis-functions.sh
index 3e16d09a83292ef7a4817177de6f94052f9bbe7a..ba7ba1eaf85edbae40ab6cb0682ad1c1fb8751ad 100755 (executable)
@@ -17,8 +17,15 @@ MAKE="make -j2"
 DUMP_CONFIG_LOG="short"
 export TS_OPT_parsable="yes"
 
+# workaround ugly warning on travis OSX,
+# see https://github.com/direnv/direnv/issues/210
+shell_session_update() { :; }
+
 function xconfigure
 {
+       which "$CC"
+       "$CC" --version
+
        ./configure "$@" $OSX_CONFOPTS
        err=$?
        if [ "$DUMP_CONFIG_LOG" = "short" ]; then
@@ -29,36 +36,63 @@ function xconfigure
        return $err
 }
 
-function check_nonroot
+# TODO: integrate checkusage into our regular tests and remove this function
+function make_checkusage
 {
-       local opts="$MAKE_CHECK_OPTS"
+       local tmp
+       if ! tmp=$($MAKE checkusage 2>&1) || test -n "$tmp"; then
+               echo "$tmp"
+               echo "make checkusage failed" >&2
+               return 1
+       fi
+}
 
-       xconfigure \
+function check_nonroot
+{
+       local make_opts="$MAKE_CHECK_OPTS --show-diff"
+       local conf_opts="\
                --disable-use-tty-group \
-               --enable-all-programs \
-               || return
+               --disable-makeinstall-chown \
+               --enable-all-programs"
+
+       if [ "$TRAVIS_OS_NAME" != "osx" ]; then
+               conf_opts="$conf_opts --enable-asan"
+               make_opts="$make_opts --memcheck-asan"
+       fi
+
+       xconfigure $conf_opts || return
        $MAKE || return
 
        osx_prepare_check
-       $MAKE check TS_OPTS="$opts" || return
+       $MAKE check TS_OPTS="$make_opts" || return
+
+       make_checkusage || return
 
        $MAKE install DESTDIR=/tmp/dest || return
 }
 
 function check_root
 {
-       local opts="$MAKE_CHECK_OPTS --parallel=1"
+       local make_opts="$MAKE_CHECK_OPTS --show-diff"
+       local conf_opts="--enable-all-programs"
 
-       xconfigure \
-               --enable-all-programs \
-               || return
+       if [ "$TRAVIS_OS_NAME" != "osx" ]; then
+               conf_opts="$conf_opts --enable-asan"
+               make_opts="$make_opts --memcheck-asan"
+       fi
+
+       xconfigure $conf_opts || return
        $MAKE || return
 
        $MAKE check TS_COMMAND="true" || return
        osx_prepare_check
-       sudo -E $MAKE check TS_OPTS="$opts" || return
+       sudo -E $MAKE check TS_OPTS="$make_opts" || return
 
-       sudo $MAKE install || return
+       # root on osx has not enough permission for make install ;)
+       [ "$TRAVIS_OS_NAME" = "osx" ] && return
+
+       # keep PATH to make sure sudo would find $CC
+       sudo env "PATH=$PATH" $MAKE install || return
 }
 
 function check_dist
@@ -75,13 +109,14 @@ function travis_install_script
                return
        fi
 
-       # install some packages from Ubuntu's default sources
-       sudo apt-get -qq update || return
+       # install required packages
+       sudo apt-get -qq update --fix-missing
        sudo apt-get install -qq >/dev/null \
                bc \
                btrfs-tools \
                dnsutils \
                libcap-ng-dev \
+               libncursesw5-dev \
                libpam-dev \
                libudev-dev \
                gtk-doc-tools \
@@ -100,24 +135,18 @@ function travis_install_script
 function osx_install_script
 {
        brew update >/dev/null
-       brew tap homebrew/dupes
 
        brew install gettext ncurses socat xz
        brew link --force gettext
        brew link --force ncurses
 
        OSX_CONFOPTS="
-               --disable-runuser \
-               --disable-su \
-               --disable-login \
-               --disable-last \
-               --disable-utmpdump \
-               --disable-agetty \
-               --disable-wall \
                --disable-ipcrm \
                --disable-ipcs \
-               --disable-write \
        "
+
+       # workaround: glibtoolize could not find sed
+       export SED="sed"
 }
 
 function osx_prepare_check
@@ -129,7 +158,7 @@ function osx_prepare_check
 
        # symlink minimally needed gnu commands into PATH
        mkdir ~/bin
-       for cmd in md5sum readlink seq truncate find xargs tar sed; do
+       for cmd in readlink seq timeout truncate find xargs tar sed; do
                ln -s /usr/local/bin/g$cmd $HOME/bin/$cmd
        done
        hash -r