Unverified Commit 815e2cdc authored by Matthew Brett's avatar Matthew Brett Committed by GitHub
Browse files

Merge pull request #288 from matthew-brett/native-apis-pr-212

MRG Ivan's changes from #212, rebased

A rebased and slightly edited version of #212 - with thanks.
parents c851480b b5490e33
......@@ -117,13 +117,14 @@ function suppress {
# Set -e stuff agonized over in
# https://unix.stackexchange.com/questions/296526/set-e-in-a-subshell
local tmp=$(mktemp tmp.XXXXXXXXX) || return
local opts=$-
local errexit_set
echo "Running $@"
if [[ $- = *e* ]]; then errexit_set=true; fi
set +e
( set_opts $opts ; $@ > "$tmp" 2>&1 ) ; ret=$?
( if [[ -n $errexit_set ]]; then set -e; fi; "$@" > "$tmp" 2>&1 ) ; ret=$?
[ "$ret" -eq 0 ] || cat "$tmp"
rm -f "$tmp"
set_opts $opts
if [[ -n $errexit_set ]]; then set -e; fi
return "$ret"
}
......@@ -151,7 +152,7 @@ function untar {
function install_rsync {
if [ -z "$IS_OSX" ]; then
[[ $(type -P rsync) ]] || yum install -y rsync
[[ $(type -P rsync) ]] || yum_install rsync
fi
}
......
......@@ -110,7 +110,7 @@ function build_zlib {
# Gives an old but safe version
if [ -n "$IS_OSX" ]; then return; fi # OSX has zlib already
if [ -e zlib-stamp ]; then return; fi
yum install -y zlib-devel
yum_install zlib-devel
touch zlib-stamp
}
......@@ -157,7 +157,7 @@ function get_cmake {
if [ -n "$IS_OSX" ]; then
brew install cmake > /dev/null
else
yum install -y cmake28 > /dev/null
yum_install cmake28 > /dev/null
cmake=cmake28
fi
echo $cmake
......@@ -360,7 +360,7 @@ function build_suitesparse {
if [ -n "$IS_OSX" ]; then
brew install suite-sparse > /dev/null
else
yum install -y suitesparse-devel > /dev/null
yum_install suitesparse-devel > /dev/null
fi
touch suitesparse-stamp
}
......
......@@ -62,7 +62,7 @@ function activate_ccache {
ln -s /parent-home/.ccache $HOME/.ccache
# Now install ccache
suppress yum install -y ccache
suppress yum_install ccache
# Create fake compilers and prepend them to the PATH
# Note that yum is supposed to create these for us,
......@@ -78,3 +78,8 @@ function activate_ccache {
# Prove to the developer that ccache is activated
echo "Using C compiler: $(which gcc)"
}
function yum_install {
# CentOS 5 yum doesn't fail in some cases, e.g. if package is not found
# https://serverfault.com/questions/694942/yum-should-error-when-a-package-is-not-available
yum install -y "$1" && rpm -q "$1"
}
......@@ -64,11 +64,13 @@ function good_cmd {
}
# Store state of options including -e, -x
# https://stackoverflow.com/questions/14564746/in-bash-how-to-get-the-current-status-of-set-x?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
# https://stackoverflow.com/questions/14564746/in-bash-how-to-get-the-current-status-of-set-x
ORIG_OPTS=$-
set +ex
[ "$(suppress bad_cmd)" == "$(printf "Running bad_cmd\nbad")" ] \
|| ingest "suppress bad_cmd"
suppress bash -c '! false' &>/dev/null \
|| ingest "suppress cmd with space"
[ "$(suppress good_cmd)" == "Running good_cmd" ] \
|| ingest "suppress good_cmd"
[ "$(suppress bad_mid_cmd)" == "Running bad_mid_cmd" ] \
......
# Tests for manylinux utils
# Tests for manylinux utils that can run outside docker
# CPython path calculator
[ "$(cpython_path 2.7)" == "/opt/python/cp27-cp27mu" ] || ingest "cp 2.7"
......
# Tests for manylinux utils that must run inside docker
source manylinux_utils.sh
source tests/utils.sh
suppress yum_install rsync && suppress yum erase -y rsync \
|| ingest "yum_install valid"
suppress bash -c '! yum_install nonexistent' || ingest "yum_install nonexistent"
barf
\ No newline at end of file
......@@ -36,7 +36,10 @@ if [ -n "$TEST_BUILDS" ]; then
touch config.sh
source travis_linux_steps.sh
my_plat=${PLAT:-x86_64}
build_multilinux $my_plat "source tests/test_library_builders.sh"
build_multilinux $my_plat "
source tests/test_manylinux_utils_docker.sh
source tests/test_library_builders.sh
"
fi
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment