Test on arm32v7-linux-gnu, ppc64le-linux-gnu and aarch64-linux-gnu.

Use docker images and qemu to test libffi for non-x86 architectures on
travis-ci.
Use the LIBFFI_TEST_OPTIMIZATION environment variable to
force specific optimization levels at test time.
This commit is contained in:
Anthony Green
2019-10-16 16:05:46 -04:00
parent d2a4095af6
commit 825b2a3594
5 changed files with 118 additions and 25 deletions
+19 -1
View File
@@ -7,6 +7,24 @@ matrix:
include: include:
- os: osx - os: osx
env: HOST=arm-apple-darwin env: HOST=arm-apple-darwin
- os: linux
env: HOST=ppc64le-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O0"
- os: linux
env: HOST=ppc64le-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2"
- os: linux
env: HOST=ppc64le-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2 -fomit-frame-pointer"
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O0"
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2"
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2 -fomit-frame-pointer"
- os: linux
env: HOST=aarch64-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O0"
- os: linux
env: HOST=aarch64-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2"
- os: linux
env: HOST=aarch64-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2 -fomit-frame-pointer"
- os: linux - os: linux
compiler: gcc compiler: gcc
env: HOST=i386-pc-linux-gnu MEVAL='export CC="$CC -m32" && CXX="$CXX -m32"' env: HOST=i386-pc-linux-gnu MEVAL='export CC="$CC -m32" && CXX="$CXX -m32"'
@@ -27,7 +45,7 @@ before_install:
- if test x"$MEVAL" != x; then eval ${MEVAL}; fi - if test x"$MEVAL" != x; then eval ${MEVAL}; fi
install: install:
- ./.travis/install.sh - travis_wait 30 ./.travis/install.sh
script: script:
- if ! test x"$MEVAL" = x; then eval ${MEVAL}; fi - if ! test x"$MEVAL" = x; then eval ${MEVAL}; fi
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
cd /opt
./configure
make
make dist
make check RUNTESTFLAGS="-a $RUNTESTFLAGS"
EXITCODE=$?
gzip -c -9 */testsuite/libffi.log > libffi.log.gz
echo ================================================================
echo The logs are too long for travis to handle, so we compress and
echo uuencode them. Download, decode and uncompress if you need to
echo read them.
echo ================================================================
uuencode libffi.log.gz -
echo ================================================================
echo ================================================================
exit $EXITCODE
+25 -6
View File
@@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
# exit this script if any commmand fails
# set -e
function build_linux() function build_linux()
{ {
./autogen.sh ./autogen.sh
@@ -10,16 +7,26 @@ function build_linux()
make make
make dist make dist
make check RUNTESTFLAGS="-a $RUNTESTFLAGS" make check RUNTESTFLAGS="-a $RUNTESTFLAGS"
EXITCODE=$?
gzip -c -9 */testsuite/libffi.log > libffi.log.gz gzip -c -9 */testsuite/libffi.log > libffi.log.gz
echo ================================================================ echo ================================================================
echo The logs are too long for travis to handle, so we compress and echo The logs are too long for travis to handle, so we compress and
echo uuencode them. Download, decode and uncompress if you need to echo uuencode them. Download, decode and uncompress if you need to
echo read them. echo read them. For example, if you select and save this text
echo as libffi.uu, run: 'cat libffi.uu | uudecode | gzip -d | less'.
echo ================================================================ echo ================================================================
uuencode libffi.log.gz - uuencode libffi.log.gz -
echo ================================================================ echo ================================================================
echo ================================================================ echo ================================================================
exit $EXITCODE
}
function build_foreign_linux()
{
docker run --rm -t -i -v `pwd`:/opt --rm -ti -e LIBFFI_TEST_OPTIMIZATION="${LIBFFI_TEST_OPTIMIZATION}" $2 bash -c /opt/.travis/build-in-container.sh
exit $?
} }
function build_ios() function build_ios()
@@ -28,8 +35,8 @@ function build_ios()
# export PYTHON_BIN=/usr/local/bin/python # export PYTHON_BIN=/usr/local/bin/python
./generate-darwin-source-and-headers.py ./generate-darwin-source-and-headers.py
xcodebuild -showsdks xcodebuild -showsdks
xcodebuild -project libffi.xcodeproj -target "libffi-iOS" -configuration Release -sdk iphoneos10.3 xcodebuild -project libffi.xcodeproj -target "libffi-iOS" -configuration Release -sdk iphoneos11.4
find ./ exit $?
} }
./autogen.sh ./autogen.sh
@@ -37,6 +44,18 @@ case "$HOST" in
arm-apple-darwin*) arm-apple-darwin*)
build_ios build_ios
;; ;;
arm32v7-linux-gnu)
build_foreign_linux arm moxielogic/arm32v7-ci-build-container:latest
;;
aarch64-linux-gnu)
build_foreign_linux aarch64 moxielogic/aarch64-ci-build-container:latest
;;
ppc64le-linux-gnu)
build_foreign_linux ppc64le moxielogic/ppc64le-ci-build-container:latest
;;
s390x-linux-gnu)
build_foreign_linux s390x s390x/ubuntu
;;
*) *)
build_linux build_linux
;; ;;
+29 -14
View File
@@ -2,24 +2,39 @@
set -x set -x
if [[ $TRAVIS_OS_NAME != 'linux' ]]; then if [[ $TRAVIS_OS_NAME != 'linux' ]]; then
brew update brew update > brew-update.log 2>&1
# fix an issue with libtool on travis by reinstalling it # fix an issue with libtool on travis by reinstalling it
brew uninstall libtool; brew uninstall libtool;
brew install libtool dejagnu; brew install libtool dejagnu;
else else
sudo apt-get clean # clear the cache
sudo apt-get update sudo apt-get update
sudo apt-get install dejagnu texinfo sharutils case $HOST in
case "$HOST" in arm32v7-linux-gnu | aarch64-linux-gnu | ppc64le-linux-gnu | s390x-linux-gnu)
i386-pc-linux-gnu) sudo apt-get install qemu-user-static
sudo apt-get install gcc-multilib g++-multilib ;;
;; i386-pc-linux-gnu)
moxie-elf) sudo apt-get install gcc-multilib g++-multilib;
echo 'deb https://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list ;;
sudo apt-get clean # clear the cache moxie-elf)
sudo apt-get update ## -qq echo 'deb https://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
# debug... sudo apt-get clean # clear the cache
curl https://repos.moxielogic.org:7114/MoxieLogic/dists/moxiedev/main/binary-amd64/Packages sudo apt-get update ## -qq
sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim # debug...
;; curl https://repos.moxielogic.org:7114/MoxieLogic/dists/moxiedev/main/binary-amd64/Packages
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
;;
i686-w64-mingw32)
sudo apt-get install gcc-mingw-w64-i686 binutils-mingw-w64-i686 wine;
;;
esac
case $HOST in
arm32v7-linux-gnu | aarch64-linux-gnu | ppc64le-linux-gnu | s390x-linux-gnu)
# don't install host tools
;;
*)
sudo apt-get install dejagnu texinfo sharutils
;;
esac esac
fi fi
+25 -4
View File
@@ -266,6 +266,12 @@ proc libffi-dg-test { prog do_what extra_tool_flags } {
return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags]
} }
proc libffi-dg-prune { target_triplet text } {
# We get this with some qemu emulated systems (eg. ppc64le-linux-gnu)
regsub -all "(^|\n)\[^\n\]*unable to perform all requested operations" $text "" text
return $text
}
proc libffi-init { args } { proc libffi-init { args } {
global gluefile wrap_flags; global gluefile wrap_flags;
global srcdir global srcdir
@@ -477,22 +483,37 @@ proc libffi-dg-runtest { testcases default-extra-flags } {
proc run-many-tests { testcases extra_flags } { proc run-many-tests { testcases extra_flags } {
global compiler_vendor global compiler_vendor
global has_gccbug global has_gccbug
global env
switch $compiler_vendor { switch $compiler_vendor {
"clang" { "clang" {
set common "-W -Wall" set common "-W -Wall"
set optimizations { "-O0" "-O2" } if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "-O0" "-O2" }
}
} }
"gnu" { "gnu" {
set common "-W -Wall -Wno-psabi" set common "-W -Wall -Wno-psabi"
set optimizations { "-O0" "-O2" "-O2 -fomit-frame-pointer" } if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "-O0" "-O2" "-O2 -fomit-frame-pointer" }
}
} }
default { default {
# Assume we are using the vendor compiler. # Assume we are using the vendor compiler.
set common "" set common ""
set optimizations { "" } if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "" }
}
} }
} }
info exists env(LD_LIBRARY_PATH)
set targetabis { "" } set targetabis { "" }
if [string match $compiler_vendor "gnu"] { if [string match $compiler_vendor "gnu"] {
if [libffi_feature_test "#ifdef __i386__"] { if [libffi_feature_test "#ifdef __i386__"] {