.travis.yml: try to run tests in -mavx2 mode if the CPU supports it

And modify settings so as to hae a AVX2 compatible CPU
This commit is contained in:
Even Rouault 2017-07-01 01:46:55 +02:00
parent 8fa405ee15
commit 69a001819c
2 changed files with 15 additions and 2 deletions

View File

@ -27,9 +27,11 @@ matrix:
# Test compilation with AVX2
- os: linux
# "sudo: yes" and "dist: trusty" give us a worker with the AVX2 instruction set
sudo: yes
dist: trusty
compiler: clang-3.8
# skip tests since Travis doesn't have AVX2 compatible machines
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_SKIP_TESTS=1
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
sources:

View File

@ -111,6 +111,17 @@ elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then
else
echo "Compiler not supported: ${CC}"; exit 1
fi
if [ "${OPJ_CI_INSTRUCTION_SETS-:}" == "-mavx2" ]; then
AVX2_AVAIL=1
cat /proc/cpuinfo | grep avx2 >/dev/null || AVX2_AVAIL=0
if [[ "${AVX2_AVAIL}" == "1" ]]; then
echo "AVX2 available on CPU"
else
echo "AVX2 not available on CPU. Disabling tests"
cat /proc/cpuinfo | grep flags | head -n 1
export OPJ_CI_SKIP_TESTS=1
fi
fi
elif [ "${TRAVIS_OS_NAME}" == "windows" ]; then
OPJ_OS_NAME=windows
if which cl > /dev/null; then