build, docs: Improve macOS building

- New docker command for quickly running tasks in a Linux environment.
- Updated docs with macOS specific details.
- Fixed some test issues.
- Add (fallible) macOS test target for Travis.
This commit is contained in:
Johan Bloemberg
2018-02-09 13:10:59 +01:00
committed by James Shubin
parent e37bb3ac8a
commit ba21554c5f
17 changed files with 104 additions and 14 deletions

View File

@@ -10,7 +10,7 @@ mkdir -p "${MGMT_TMPDIR}"
> "${MGMT_TMPDIR}"sshd_config
# run empty graph, with prometheus support
timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --yaml=augeas-1.yaml &
$timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --yaml=augeas-1.yaml &
pid=$!
sleep 5s # let it converge

View File

@@ -1,9 +1,15 @@
#!/bin/bash -e
if [[ $(uname) == "Darwin" ]] ; then
# https://github.com/purpleidea/mgmt/issues/33
echo "This test is broken on macOS, skipping!"
exit
fi
set -x
# run till completion
timeout --kill-after=40s 35s ./mgmt run --yaml file-mode.yaml --converged-timeout=5 --no-watch --tmp-prefix &
$timeout --kill-after=40s 35s ./mgmt run --yaml file-mode.yaml --converged-timeout=5 --no-watch --tmp-prefix &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -1,10 +1,16 @@
#!/bin/bash -e
if [[ $(uname) == "Darwin" ]] ; then
# https://github.com/purpleidea/mgmt/issues/33
echo "This test is broken on macOS, skipping!"
exit
fi
mkdir -p /tmp/mgmt/
rm /tmp/mgmt/f1 || true
# run empty graph, with prometheus support
timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
$timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
pid=$!
sleep 5s # let it converge

View File

@@ -9,7 +9,7 @@ if ! timeout 1s sudo -A true; then
fi
# run till completion
timeout --kill-after=30s 25s sudo -A ./mgmt run --yaml file-owner.yaml --converged-timeout=5 --no-watch --tmp-prefix &
$timeout --kill-after=30s 25s sudo -A ./mgmt run --yaml file-owner.yaml --converged-timeout=5 --no-watch --tmp-prefix &
pid=$!
wait $pid # get exit status
e=$?

View File

@@ -1,7 +1,13 @@
#!/bin/bash -e
if [[ $(uname) == "Darwin" ]] ; then
# https://github.com/purpleidea/mgmt/issues/33
echo "This test is broken on macOS, skipping!"
exit
fi
# run a graph, with prometheus support
timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-3.yaml &
$timeout --kill-after=40s 35s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-3.yaml &
pid=$!
sleep 10s # let it converge

View File

@@ -1,7 +1,13 @@
#!/bin/bash -xe
if [[ $(uname) == "Darwin" ]] ; then
# https://github.com/purpleidea/mgmt/issues/33
echo "This test is broken on macOS, skipping!"
exit
fi
# run a graph, with prometheus support
timeout --kill-after=30s 25s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-4.yaml &
$timeout --kill-after=30s 25s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-4.yaml &
pid=$!
sleep 10s # let it converge

View File

@@ -19,7 +19,7 @@ make build
buildout='test-examples.out'
# make symlink to outside of package
linkto="`pwd`/examples/lib/"
tmpdir="`mktemp --tmpdir -d tmp.XXX`" # get a dir outside of the main package
tmpdir="`$mktemp --tmpdir -d tmp.XXX`" # get a dir outside of the main package
cd "$tmpdir"
ln -s "$linkto" # symlink outside of dir
cd `basename "$linkto"`

View File

@@ -31,7 +31,7 @@ COUNT=`echo -e "$LINT" | wc -l` # number of golint problems in current branch
[ "$LINT" = "" ] && echo PASS && exit # everything is "perfect"
echo "$LINT" # display the issues
T=`mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's
T=`$mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's
[ "$T" = "" ] && fail_test "Could not create tmpdir"
cd $T || fail_test "Could not change into tmpdir $T"
git clone --recursive "${ROOT}" 2>/dev/null # make a copy

View File

@@ -25,7 +25,7 @@ function simplify-gocase() {
function token-coloncheck() {
# add quotes to avoid matching three X's
if grep -Ei "[\/]+[\/]+[ ]*+(FIXME[^:]|TODO[^:]|X"'X'"X[^:])" "$1"; then
if grep -Ei "[\/]+[\/]+[ ]*(FIXME[^:]|TODO[^:]|X"'X'"X[^:])" "$1"; then
return 1 # tokens must end with a colon
fi
return 0

View File

@@ -7,7 +7,7 @@ set -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
cd "$DIR" >/dev/null # work from main mgmt directory
make build
T=`mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's
T=`$mktemp --tmpdir -d tmp.X'X'X` # add quotes to avoid matching three X's
cp -a ./mgmt "$T"/mgmt.1
make clean
make build

View File

@@ -2,8 +2,10 @@
if [[ $(uname) == "Darwin" ]] ; then
export timeout="gtimeout"
export mktemp="gmktemp"
else
export timeout="timeout"
export mktemp="mktemp"
fi
fail_test()