test: Enable macOS shell testing

* Check and install libvirt with Homebrew

  macOS does not have apt, dnf or yum. Add checking for homebrew for
  installing libvirt.

* Use platform timeout for tests
    * Add timeout detection to test/util.sh
    * Use $timeout for shell test requiring timeout
This commit is contained in:
Sean Jones
2017-02-06 21:18:35 +01:00
committed by James Shubin
parent 8c2c552164
commit 610202097a
14 changed files with 27 additions and 16 deletions

View File

@@ -14,13 +14,14 @@ sudo_command=$(which sudo)
YUM=`which yum 2>/dev/null`
DNF=`which dnf 2>/dev/null`
APT=`which apt-get 2>/dev/null`
BREW=`which brew 2>/dev/null`
# if DNF is available use it
if [ -x "$DNF" ]; then
YUM=$DNF
fi
if [ -z "$YUM" -a -z "$APT" ]; then
if [ -z "$YUM" -a -z "$APT" -a -z "$BREW" ]; then
echo "The package managers can't be found."
exit 1
fi
@@ -36,6 +37,10 @@ if [ ! -z "$APT" ]; then
$sudo_command $APT install -y libpcap0.8-dev || true
fi
if [ ! -z "$BREW" ]; then
$BREW install libvirt || true
fi
if [ $travis -eq 0 ]; then
if [ ! -z "$YUM" ]; then
# some go dependencies are stored in mercurial