Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: "contains(matrix.os, 'ubuntu')"
- name: Install libraries
run: |
brew upgrade
brew update
brew install gdbm gmp libffi openssl@1.1 zlib autoconf automake libtool readline
if: "contains(matrix.os, 'macos')"
- name: git config
Expand Down
151 changes: 90 additions & 61 deletions .github/workflows/compilers.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
name: Compilations

on: [push, pull_request]
on:
push:
paths-ignore:
- 'doc/**'
- '**.md'
- '**.rdoc'
pull_request:
paths-ignore:
- 'doc/**'
- '**.md'
- '**.rdoc'

concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}

# Github actions does not support YAML anchors. This creative use of
# environment variables (plus the "echo ::set-env" hack) is to reroute that
# environment variables (plus the "echo $GITHUB_ENV" hack) is to reroute that
# restriction.
env:
default_cc: clang-11
default_cc: clang-14
append_cc: ''
crosshost: ''

# -O1 is faster than -O3 in our tests... Majority of time are consumed trying
# to optimize binaries. Also Github Actions runs on a relatively modern CPU
# to optimize binaries. Also Github Actions run on relatively modern CPUs
# compared to, say, GCC 4 or Clang 3. We don't specify `-march=native`
# because compilers tend not understand what the CPU is.
optflags: '-O1'
Expand Down Expand Up @@ -47,45 +61,60 @@ jobs:
fail-fast: false
matrix:
entry:
- { key: default_cc, name: gcc-10, value: gcc-10 }
# - { key: default_cc, name: gcc-9, value: gcc-9 }
# - { key: default_cc, name: gcc-8, value: gcc-8 }
# - { key: default_cc, name: gcc-7, value: gcc-7 }
# - { key: default_cc, name: gcc-6, value: gcc-6 }
# - { key: default_cc, name: gcc-5, value: gcc-5 }
- { key: default_cc, name: gcc-4.8, value: gcc-4.8 }
- { key: default_cc, name: clang-12, value: clang-12 }
# - { key: default_cc, name: clang-11, value: clang-11 }
# - { key: default_cc, name: clang-10, value: clang-10 }
# - { key: default_cc, name: clang-9, value: clang-9 }
# - { key: default_cc, name: clang-8, value: clang-8 }
# - { key: default_cc, name: clang-7, value: clang-7 }
# - { key: default_cc, name: clang-6.0, value: clang-6.0 }
# - { key: default_cc, name: clang-5.0, value: clang-5.0 }
# - { key: default_cc, name: clang-4.0, value: clang-4.0 }
- { key: default_cc, name: clang-3.9, value: clang-3.9 }

- { key: crosshost, name: aarch64-linux-gnu, value: aarch64-linux-gnu }
- { key: default_cc, name: gcc-11, value: gcc-11, container: gcc-11 }
- { key: default_cc, name: gcc-10, value: gcc-10, container: gcc-10 }
- { key: default_cc, name: gcc-9, value: gcc-9, container: gcc-9 }
- { key: default_cc, name: gcc-8, value: gcc-8, container: gcc-8 }
- { key: default_cc, name: gcc-7, value: gcc-7, container: gcc-7 }
- { key: default_cc, name: gcc-6, value: gcc-6, container: gcc-6 }
- { key: default_cc, name: gcc-5, value: gcc-5, container: gcc-5 }
- { key: default_cc, name: gcc-4.8, value: gcc-4.8, container: gcc-4.8 }
- key: default_cc
name: 'gcc-11 LTO'
value: 'gcc-11 -O2 -flto=auto -ffat-lto-objects'
container: gcc-11
shared: '--disable-shared'
# check: true
- { key: default_cc, name: clang-14, value: clang-14, container: clang-14 }
- { key: default_cc, name: clang-13, value: clang-13, container: clang-13 }
- { key: default_cc, name: clang-12, value: clang-12, container: clang-12 }
- { key: default_cc, name: clang-11, value: clang-11, container: clang-11 }
- { key: default_cc, name: clang-10, value: clang-10, container: clang-10 }
- { key: default_cc, name: clang-9, value: clang-9, container: clang-9 }
- { key: default_cc, name: clang-8, value: clang-8, container: clang-8 }
- { key: default_cc, name: clang-7, value: clang-7, container: clang-7 }
- { key: default_cc, name: clang-6.0, value: clang-6.0, container: clang-6.0 }
- { key: default_cc, name: clang-5.0, value: clang-5.0, container: clang-5.0 }
- { key: default_cc, name: clang-4.0, value: clang-4.0, container: clang-4.0 }
- { key: default_cc, name: clang-3.9, value: clang-3.9, container: clang-3.9 }
- key: default_cc
name: 'clang-14 LTO'
value: 'clang-14 -O2 -flto=auto'
container: clang-14
shared: '--disable-shared'
# check: true

- { key: crosshost, name: aarch64-linux-gnu, value: aarch64-linux-gnu, container: crossbuild-essential-arm64 }
# - { key: crosshost, name: arm-linux-gnueabi, value: arm-linux-gnueabi }
# - { key: crosshost, name: arm-linux-gnueabihf, value: arm-linux-gnueabihf }
# - { key: crosshost, name: i686-w64-mingw32, value: i686-w64-mingw32 }
# - { key: crosshost, name: powerpc-linux-gnu, value: powerpc-linux-gnu }
- { key: crosshost, name: powerpc64le-linux-gnu, value: powerpc64le-linux-gnu }
- { key: crosshost, name: s390x-linux-gnu, value: s390x-linux-gnu }
- { key: crosshost, name: x86_64-w64-mingw32, value: x86_64-w64-mingw32 }
- { key: crosshost, name: powerpc64le-linux-gnu, value: powerpc64le-linux-gnu, container: crossbuild-essential-ppc64el }
- { key: crosshost, name: s390x-linux-gnu, value: s390x-linux-gnu, container: crossbuild-essential-s390x }
- { key: crosshost, name: x86_64-w64-mingw32, value: x86_64-w64-mingw32, container: mingw-w64 }

- { key: append_cc, name: c99, value: '-std=c99 -Werror=pedantic -pedantic-errors' }
# - { key: append_cc, name: c11, value: '-std=c11 -Werror=pedantic -pedantic-errors' }
# - { key: append_cc, name: c17, value: '-std=c17 -Werror=pedantic -pedantic-errors' }
- { key: append_cc, name: c2x, value: '-std=c2x -Werror=pedantic -pedantic-errors' }
# - { key: append_cc, name: c2x, value: '-std=c2x -Werror=pedantic -pedantic-errors' }
- { key: CXXFLAGS, name: c++98, value: '-std=c++98 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }
# - { key: CXXFLAGS, name: c++11, value: '-std=c++11 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }
# - { key: CXXFLAGS, name: c++14, value: '-std=c++14 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }
# - { key: CXXFLAGS, name: c++17, value: '-std=c++17 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }
- { key: CXXFLAGS, name: c++2a, value: '-std=c++2a -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }

- { key: optflags, name: '-O0', value: '-O0 -march=x86-64 -mtune=generic' }
# - { key: optflags, name: '-O3', value: '-O3 -march=x86-64 -mtune=generic' }
# - { key: optflags, name: '-O3', value: '-O3 -march=x86-64 -mtune=generic', check: true }

- { key: append_configure, name: gmp, value: '--with-gmp' }
- { key: append_configure, name: jemalloc, value: '--with-jemalloc' }
Expand Down Expand Up @@ -130,7 +159,7 @@ jobs:

- { key: cppflags, name: DEBUG_FIND_TIME_NUMGUESS, value: '-DDEBUG_FIND_TIME_NUMGUESS' }
- { key: cppflags, name: DEBUG_INTEGER_PACK, value: '-DDEBUG_INTEGER_PACK' }
- { key: cppflags, name: ENABLE_PATH_CHECK, value: '-DENABLE_PATH_CHECK' }
# - { key: cppflags, name: ENABLE_PATH_CHECK, value: '-DENABLE_PATH_CHECK' }

- { key: cppflags, name: GC_DEBUG_STRESS_TO_CLASS, value: '-DGC_DEBUG_STRESS_TO_CLASS' }
# - { key: cppflags, name: GC_ENABLE_LAZY_SWEEP=0, value: '-DGC_ENABLE_LAZY_SWEEP=0' }
Expand All @@ -152,50 +181,50 @@ jobs:
# - { key: cppflags, name: VM_DEBUG_VERIFY_METHOD_CACHE, value: '-DVM_DEBUG_VERIFY_METHOD_CACHE' }

- { key: cppflags, name: MJIT_FORCE_ENABLE, value: '-DMJIT_FORCE_ENABLE' }
- { key: cppflags, name: YJIT_FORCE_ENABLE, value: '-DYJIT_FORCE_ENABLE' }

name: ${{ matrix.entry.name }}
runs-on: ubuntu-20.04
container: ghcr.io/ruby/ruby-ci-image:latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
container:
image: ghcr.io/ruby/ruby-ci-image:${{ matrix.entry.container || 'clang-14' }}
options: --user root
if: ${{ !startsWith(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }}
steps:
- run: id
working-directory:
- run: mkdir build
working-directory:
- name: setenv
run: |
echo "${{ matrix.entry.key }}=${{ matrix.entry.value }}" >> $GITHUB_ENV
echo "make=make -sj$((1 + $(nproc --all)))" >> $GITHUB_ENV
- uses: actions/checkout@v2
echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
path: src
- uses: actions/cache@v3
with:
path: src/.downloaded-cache
key: downloaded-cache
- run: ./autogen.sh
working-directory: src
- name: Run configure
run: |
if [ -n "${crosshost}" ]; then
../src/configure -C \
${default_configure} \
${append_configure} \
--host="${crosshost}"
else
../src/configure -C \
${default_configure} \
${append_configure} \
--with-gcc="${default_cc} ${append_cc}"
fi
- run: $make extract-extlibs
- run: $make incs
- run: $make
- run: $make test
- run: $make install
if: "matrix.entry.name == '-O3'"
- run: /usr/local/bin/gem install --no-doc timezone tzinfo
if: "matrix.entry.name == '-O3'"
- run: $make test-tool
if: "matrix.entry.name == '-O3'"
- run: $make test-all TESTS='-- ruby -ext-'
if: "matrix.entry.name == '-O3'"
- run: $make test-spec
if: "matrix.entry.name == '-O3'"
run: >
../src/configure -C ${default_configure} ${append_configure}
${{ matrix.entry.key == 'crosshost' && '--host="${crosshost}"' || '--with-gcc="${default_cc} ${append_cc}"' }}
${{ matrix.entry.shared || '--enable-shared' }}
- run: make extract-extlibs
- run: make incs
- run: make
# - run: make leaked-globals
- run: make test
- run: make install
if: ${{ matrix.entry.check }}
- run: make test-tool
if: ${{ matrix.entry.check }}
- run: make test-all TESTS='-- ruby -ext-'
if: ${{ matrix.entry.check }}
- run: make test-spec
if: ${{ matrix.entry.check }}

- uses: k0kubun/action-slack@v2.0.0
with:
Expand All @@ -209,7 +238,7 @@ jobs:
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
if: ${{ failure() && github.event_name == 'push' }}

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install libraries
run: |
export WAITS='5 60'
tool/travis_retry.sh brew upgrade
tool/travis_retry.sh brew update
tool/travis_retry.sh brew install gdbm gmp libffi openssl@1.1 zlib autoconf automake libtool readline
working-directory: src
- name: Set ENV
Expand Down
20 changes: 14 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ platform:
- x64
environment:
ruby_version: "24-%Platform%"
zlib_version: "1.2.13"
matrix:
- build: vs
vs: 120
ssl: OpenSSL
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
GEMS_FOR_TEST: ""
- build: vs
vs: 140
Expand All @@ -22,6 +21,8 @@ environment:
GEMS_FOR_TEST: ""
RELINE_TEST_ENCODING: "Windows-31J"
UPDATE_UNICODE: "UNICODE_FILES=. UNICODE_PROPERTY_FILES=. UNICODE_AUXILIARY_FILES=. UNICODE_EMOJI_FILES=."
cache:
- c:\Tools\vcpkg\installed\
for:
-
matrix:
Expand All @@ -33,6 +34,12 @@ for:
- SET BITS=%Platform:x86=32%
- SET BITS=%BITS:x=%
- SET OPENSSL_DIR=C:\%ssl%-Win%BITS%
- cd C:\Tools\vcpkg
- git pull -q
- .\bootstrap-vcpkg.bat
- cd %APPVEYOR_BUILD_FOLDER%
- vcpkg --triplet %Platform%-windows install libffi libyaml zlib
- set PATH=c:\Tools\vcpkg\installed\%Platform%-windows\bin;%PATH%
- CALL SET vcvars=%%^VS%VS%COMNTOOLS^%%..\..\VC\vcvarsall.bat
- SET vcvars
- '"%vcvars%" %Platform:x64=amd64%'
Expand All @@ -53,16 +60,17 @@ for:
- mkdir \usr\local\bin
- mkdir \usr\local\include
- mkdir \usr\local\lib
- SET ZLIB_ZIP=.downloaded-cache\zlib%zlib_version:.=%.zip
- if not exist %ZLIB_ZIP% curl -fsSL -o %ZLIB_ZIP% --retry 10 https://zlib.net/zlib%zlib_version:.=%.zip
- 7z x -aos -o%APPVEYOR_BUILD_FOLDER%\ext\zlib %ZLIB_ZIP%
- for %%I in (%OPENSSL_DIR%\*.dll) do mklink /h \usr\local\bin\%%~nxI %%I
- attrib +r /s /d
- mkdir %Platform%-mswin_%vs%
build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- cd %Platform%-mswin_%vs%
- ..\win32\configure.bat --without-ext=+,dbm,gdbm,readline --with-opt-dir=/usr/local --with-openssl-dir=%OPENSSL_DIR:\=/%
- >-
..\win32\configure.bat
--without-ext=+,dbm,gdbm,readline
--with-opt-dir="/usr/local;c:/Tools/vcpkg/installed/%Platform%-windows"
--with-openssl-dir=%OPENSSL_DIR:\=/%
- nmake -l
- nmake install-nodoc
- \usr\bin\ruby -v -e "p :locale => Encoding.find('locale'), :filesystem => Encoding.find('filesystem')"
Expand Down
2 changes: 1 addition & 1 deletion template/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -684,4 +684,4 @@ mjit_build_dir.$(SOEXT): $(MJIT_MIN_HEADER) $(srcdir)/ruby-runner.c ruby-runner.

# yes-test-basic: leaked-globals
leaked-globals: $(COMMONOBJS) prog $(tooldir)/leaked-globals PHONY
$(Q) $(XRUBY) $(tooldir)/leaked-globals NM=$(NM) SYMBOL_PREFIX=$(SYMBOL_PREFIX) $(srcdir)/configure.ac $(COMMONOBJS)
$(Q) $(XRUBY) $(tooldir)/leaked-globals NM="$(NM) -Pgp" SYMBOL_PREFIX=$(SYMBOL_PREFIX) PLATFORM=$(hdrdir)/ruby/$(PLATFORM_DIR).h $(srcdir)/configure.ac $(COMMONOBJS)
32 changes: 29 additions & 3 deletions tool/leaked-globals
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ until ARGV.empty?
SYMBOL_PREFIX = $1
when /\ANM=(.*)/ # may be multiple words
NM = $1
when /\APLATFORM=(.+)?/
platform = $1
else
break
end
Expand All @@ -16,15 +18,39 @@ end
config = ARGV.shift
count = 0
col = Colorize.new
REPLACE = File.read(config).scan(/\bAC_(?:REPLACE|CHECK)_FUNCS?\(\K\w+/)
config_code = File.read(config)
REPLACE = config_code.scan(/\bAC_(?:REPLACE|CHECK)_FUNCS?\((\w+)/).flatten
# REPLACE << 'memcmp' if /\bAC_FUNC_MEMCMP\b/ =~ config_code
REPLACE.push('main', 'DllMain')
if platform and !platform.empty?
begin
h = File.read(platform)
rescue Errno::ENOENT
else
REPLACE.concat(
h .gsub(%r[/\*.*?\*/]m, " ") # delete block comments
.gsub(%r[//.*], " ") # delete oneline comments
.gsub(/^\s*#.*(?:\\\n.*)*/, "") # delete preprocessor directives
.gsub(/(?:\A|;)\K\s*typedef\s.*?;/m, "")
.scan(/\b((?!rb_|DEPRECATED|_)\w+)\s*\(.*\);/)
.flatten)
end
end
missing = File.dirname(config) + "/missing/"
ARGV.reject! do |n|
unless (src = Dir.glob(missing + File.basename(n, ".*") + ".[cS]")).empty?
puts "Ignore #{n} because of #{src.map {|s| File.basename(s)}.join(', ')} under missing"
true
end
end
print "Checking leaked global symbols..."
STDOUT.flush
IO.foreach("|#{NM} -Pgp #{ARGV.join(' ')}") do |line|
IO.foreach("|#{NM} #{ARGV.join(' ')}") do |line|
n, t, = line.split
next unless /[A-TV-Z]/ =~ t
next unless n.sub!(/^#{SYMBOL_PREFIX}/o, "")
next if n.include?(".")
next if /\A(?:Init_|InitVM_|RUBY_|ruby_|rb_|[Oo]nig|dln_|mjit_|coroutine_|nu(?:comp|rat)_)/ =~ n
next if /\A(?:Init_|InitVM_|RUBY_|ruby_|rb_|[Oo]nig|dln_|mjit_|coroutine_)/ =~ n
next if REPLACE.include?(n)
puts col.fail("leaked") if count.zero?
count += 1
Expand Down