Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
* Add .drone.yml for debug arm64/32 libc files.
* Fix 32-bit issue temporary in test/fiddle/helper.rb setting path.
  • Loading branch information
junaruga committed Nov 21, 2019
1 parent 0ceba63 commit 312f4d3
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 5 deletions.
73 changes: 73 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
kind: pipeline
type: docker
name: arm64
platform:
os: linux
arch: arm64
steps:
- name: test
image: ruby:2.5-stretch
commands:
- uname -m
- apt-get -yq update
- apt-get -yq install software-properties-common
- apt-get -yq install bison sudo strace
# workaround ipv6 localhost
- ruby -e "hosts = File.read('/etc/hosts').sub(/^::1\s*localhost.*$/, ''); File.write('/etc/hosts', hosts)"
# create user
- useradd --shell /bin/bash --create-home test && chown -R test:test .
# configure
- /usr/bin/sudo -H -u test -- bash -c 'autoconf && ./configure --disable-install-doc --prefix=/tmp/ruby-prefix'
# make all install
- /usr/bin/sudo -H -u test -- make -j$(nproc) all install
# make test
# - /usr/bin/sudo -H -u test -- make test
# make test-spec
# - /usr/bin/sudo -H -u test -- make test-spec
# make test-all
# - /usr/bin/sudo -H -u test -- make test-all
- ls -l /lib32 || true
- strace -f ldd ruby || true
- /usr/bin/sudo -H -u test -- make test-all TESTS="test/fiddle/test_import.rb"
trigger:
branch:
- master

---
kind: pipeline
type: docker
name: arm32
platform:
os: linux
arch: arm
steps:
- name: test
image: ruby:2.5-stretch
commands:
- uname -m
- apt-get -yq update
- apt-get -yq install software-properties-common
- apt-get -yq install bison sudo file
# workaround ipv6 localhost
- ruby -e "hosts = File.read('/etc/hosts').sub(/^::1\s*localhost.*$/, ''); File.write('/etc/hosts', hosts)"
# create user
- useradd --shell /bin/bash --create-home test && chown -R test:test .
# configure
- /usr/bin/sudo -H -u test -- bash -c 'autoconf && ./configure --disable-install-doc --prefix=/tmp/ruby-prefix'
# make all install
- /usr/bin/sudo -H -u test -- make -j$(nproc) all install
# make test
# - /usr/bin/sudo -H -u test -- make test
# make test-spec
# - /usr/bin/sudo -H -u test -- make test-spec
# make test-all
# - /usr/bin/sudo -H -u test -- make test-all
- ls -l /lib32 || true
- file ruby
- ldd ruby || true
- /usr/bin/sudo -H -u test -- make test-all TESTS="test/fiddle/test_import.rb"
# failure: ignore # `make test` is failing on arm32
# trigger:
# branch:
# - master
26 changes: 24 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ env:
- |-
tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install \
ccache \
crossbuild-essential-armhf \
libc6-armhf-cross \
file \
libc6:armhf \
libstdc++-5-dev:armhf \
libffi-dev:armhf \
Expand All @@ -318,6 +319,7 @@ env:
libssl-dev:armhf \
libssl1.0.0:armhf \
linux-libc-dev:armhf \
strace \
zlib1g-dev:armhf \
zlib1g:armhf
Expand Down Expand Up @@ -512,7 +514,27 @@ before_script:
script:
# - $SETARCH make -s test -o showflags TESTOPTS="${TESTOPTS=$JOBS -q --tty=no}"
# - travis_wait 50 $SETARCH make -s test-all -o exts TESTOPTS="${TESTOPTS} ${TEST_ALL_OPTS}" RUBYOPT="-w"
- $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -v --tty=no" TESTS="../test/fiddle/test_import.rb" RUBYOPT="-w"

# Fiddle::DLError on arm32.
# - $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -v --tty=no" TESTS="../test/fiddle/test_import.rb" RUBYOPT="-w"
# Fiddle::DLError on arm32.
# - $SETARCH make -s test-all -o exts TESTOPTS="-v --tty=no" TESTS="../test/fiddle/test_import.rb" RUBYOPT="-w"
- |
ldd "$(command -v uname)" || true
- $SETARCH file ruby
- ldd ruby || true
- $SETARCH ldd ruby || true
- strace -f ldd ruby || true
- strace -f $SETARCH ldd ruby || true
- |
(
set -x
ls -l /lib32 || true
# dpkg-query -L libc6
dpkg-query -L libc6:arm64
dpkg-query -L libc6:armhf
$SETARCH make -s test-all -o exts TESTOPTS="-v --tty=no" TESTS="../test/fiddle/test_import.rb" RUBYOPT="-w"
)
# - $SETARCH make -s test-spec MSPECOPT=-ff # not using `-j` because sometimes `mspec -j` silently dies
# - $SETARCH make -s -o showflags leaked-globals
Expand Down
19 changes: 16 additions & 3 deletions test/fiddle/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

libc_so = libm_so = nil

p "[DEBUG] RUBY_PLATFORM: #{RUBY_PLATFORM}"

case RUBY_PLATFORM
when /cygwin/
libc_so = "cygwin1.dll"
Expand All @@ -23,6 +25,7 @@
when 4
# 32-bit ruby
libdir = '/lib32' if File.directory? '/lib32'
libdir = '/lib/arm-linux-gnueabihf' if File.directory? '/lib/arm-linux-gnueabihf'
when 8
# 64-bit ruby
libdir = '/lib64' if File.directory? '/lib64'
Expand Down Expand Up @@ -95,7 +98,7 @@
libc_so = ARGV[0] if ARGV[0] && ARGV[0][0] == ?/
libm_so = ARGV[1] if ARGV[1] && ARGV[1][0] == ?/
if( !(libc_so && libm_so) )
$stderr.puts("libc and libm not found: #{$0} <libc> <libm>")
$stderr.puts("libc or libm not found: #{$0} <libc> <libm>")
end
end

Expand All @@ -104,16 +107,26 @@

if !libc_so || !libm_so
ruby = EnvUtil.rubybin
p "[DEBUG] ruby: #{ruby}"
file_out = `file #{ruby}`
p "[DEBUG] file ruby result: #{file_out}"
ldd = `ldd #{ruby}`
#puts ldd
p "[DEBUG] ldd ruby result: #{ldd}"
libc_so = $& if !libc_so && %r{/\S*/libc\.so\S*} =~ ldd
libm_so = $& if !libm_so && %r{/\S*/libm\.so\S*} =~ ldd
#p [libc_so, libm_so]
p [libc_so, libm_so]
end

if !libc_so || !libm_so
warn "libc or libm not found"
end

Fiddle::LIBC_SO = libc_so
Fiddle::LIBM_SO = libm_so

p "[DEBUG] Fiddle::LIBC_SO: #{Fiddle::LIBC_SO}"
p "[DEBUG] Fiddle::LIBM_SO: #{Fiddle::LIBM_SO}"

module Fiddle
class TestCase < Test::Unit::TestCase
def setup
Expand Down

0 comments on commit 312f4d3

Please sign in to comment.