diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ca68ed20abd91f..00000000000000 --- a/.travis.yml +++ /dev/null @@ -1,111 +0,0 @@ -# -*- YAML -*- -# Copyright (C) 2011 Urabe, Shyouhei. All rights reserved. -# -# This file is a part of the programming language Ruby. Permission is hereby -# granted, to either redistribute or modify this file, provided that the -# conditions mentioned in the file COPYING are met. Consult the file for -# details. - -# When you see Travis CI issues, or you are interested in understanding how to -# manage, please check the link below. -# https://github.com/ruby/ruby/wiki/CI-Servers#travis-ci - -# We enable Travis on the specific branches or forked repositories here. -# https://docs.travis-ci.com/user/conditions-v1 -if: >- - (fork OR branch = master OR branch =~ /^ruby_\d_\d$/) - AND (commit_message !~ /(\[DOC\]|Document)/) - AND NOT (type = 'push' AND sender =~ /\[bot\]/) - -language: c - -os: linux - -dist: jammy - -git: - quiet: true - -env: - global: - - NPROC="$(nproc)" - - JOBS="-j${NPROC}" - # https://github.com/travis-ci/travis-build/blob/e411371dda21430a60f61b8f3f57943d2fe4d344/lib/travis/build/bash/travis_apt_get_options.bash#L7 - - travis_apt_get_options='--allow-downgrades --allow-remove-essential --allow-change-held-packages' - - travis_apt_get_options="-yq --no-install-suggests --no-install-recommends $travis_apt_get_options" - # -g0 disables backtraces when SEGV. Do not set that. - - debugflags=-ggdb3 - - RUBY_TESTOPTS="$JOBS -q --tty=no" - -.org.ruby-lang.ci.matrix-definitions: - - &gcc-11 - compiler: gcc-11 - before_install: - - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq" - - >- - tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install - gcc-11 - g++-11 - libffi-dev - libncurses-dev - libncursesw5-dev - libreadline-dev - libssl-dev - libyaml-dev - openssl - zlib1g-dev - - gcc-11 --version - - &ppc64le-linux - name: ppc64le-linux - arch: ppc64le - <<: *gcc-11 - - &s390x-linux - name: s390x-linux - arch: s390x - <<: *gcc-11 - env: - # Avoid possible test failures with the zlib applying the following patch - # on s390x CPU architecture. - # https://github.com/madler/zlib/pull/410 - - DFLTCC=0 - -matrix: - include: - - <<: *ppc64le-linux - - <<: *s390x-linux - allow_failures: - - name: ppc64le-linux - - name: s390x-linux - fast_finish: true - -before_script: - - lscpu - - ./autogen.sh - - mkdir build - - cd build - - ../configure -C --disable-install-doc --prefix=$(pwd)/install - - make -s $JOBS - - make -s $JOBS install - # Useful info to report issues to the Ruby. - - $(pwd)/install/bin/ruby -v - # Useful info To report issues to the RubyGems. - - $(pwd)/install/bin/gem env - -script: - - make -s test - - ../tool/travis_wait.sh make -s test-all RUBYOPT="-w" - - ../tool/travis_wait.sh make -s test-spec - -# We want to be notified when something happens. -notifications: - webhooks: - urls: - # ruby-lang slack: ruby/simpler-alerts-bot (travis) - - secure: mRsoS/UbqDkKkW5p3AEqM27d4SZnV6Gsylo3bm8T/deltQzTsGzZwrm7OIBXZv0UFZdE68XmPlyHfZFLSP2V9QZ7apXMf9/vw0GtcSe1gchtnjpAPF6lYBn7nMCbVPPx9cS0dwL927fjdRM1vj7IKZ2bk4F0lAJ25R25S6teqdk= - on_success: never - on_failure: always - email: - recipients: - - jun.aruga@gmail.com - on_success: never - on_failure: always diff --git a/gc.rb b/gc.rb index 6cb22a96df9843..883206dde85323 100644 --- a/gc.rb +++ b/gc.rb @@ -78,27 +78,36 @@ def self.disable end # call-seq: - # GC.stress -> integer, true, or false + # GC.stress -> setting # - # Returns the current status of \GC stress mode. + # Returns the current \GC stress-mode setting, + # which initially is +false+. + # + # The stress mode may be set by method GC.stress=. def self.stress Primitive.gc_stress_get end # call-seq: - # GC.stress = flag -> flag + # GC.stress = value -> value + # + # Enables or disables stress mode; + # enabling stress mode will degrade performance; it is only for debugging. # - # Updates the \GC stress mode. + # Sets the current \GC stress mode to the given value: # - # When stress mode is enabled, the \GC is invoked at every \GC opportunity: - # all memory and object allocations. + # - If the value is +nil+ or +false+, disables stress mode. + # - If the value is an integer, + # enables stress mode with certain flags; see below. + # - Otherwise, enables stress mode; + # \GC is invoked at every \GC opportunity: all memory and object allocations. # - # Enabling stress mode will degrade performance; it is only for debugging. + # The flags are bits in the given integer: + # + # - +0x01+: No major \GC. + # - +0x02+: No immediate sweep. + # - +0x04+: Full mark after malloc/calloc/realloc. # - # The flag can be true, false, or an integer bitwise-ORed with the following flags: - # 0x01:: no major GC - # 0x02:: no immediate sweep - # 0x04:: full mark after malloc/calloc/realloc def self.stress=(flag) Primitive.gc_stress_set_m flag end @@ -117,85 +126,127 @@ def self.count end # call-seq: - # GC.stat -> Hash - # GC.stat(hash) -> Hash - # GC.stat(:key) -> Numeric + # GC.stat -> new_hash + # GC.stat(key) -> value + # GC.stat(hash) -> hash # - # Returns a Hash containing information about the \GC. + # This method is implementation-specific to CRuby. # - # The contents of the hash are implementation-specific and may change in - # the future without notice. + # Returns \GC statistics. + # The particular statistics are implementation-specific + # and may change in the future without notice. + # + # With no argument given, + # returns information about the most recent garbage collection: + # + # GC.stat + # # => + # {count: 28, + # time: 1, + # marking_time: 1, + # sweeping_time: 0, + # heap_allocated_pages: 521, + # heap_empty_pages: 0, + # heap_allocatable_slots: 0, + # heap_available_slots: 539590, + # heap_live_slots: 422243, + # heap_free_slots: 117347, + # heap_final_slots: 0, + # heap_marked_slots: 264877, + # heap_eden_pages: 521, + # total_allocated_pages: 521, + # total_freed_pages: 0, + # total_allocated_objects: 2246376, + # total_freed_objects: 1824133, + # malloc_increase_bytes: 50982, + # malloc_increase_bytes_limit: 18535172, + # minor_gc_count: 18, + # major_gc_count: 10, + # compact_count: 0, + # read_barrier_faults: 0, + # total_moved_objects: 0, + # remembered_wb_unprotected_objects: 0, + # remembered_wb_unprotected_objects_limit: 2162, + # old_objects: 216365, + # old_objects_limit: 432540, + # oldmalloc_increase_bytes: 1654232, + # oldmalloc_increase_bytes_limit: 16846103} + # + # With symbol argument +key+ given, + # returns the value for that key: + # + # GC.stat(:count) # => 30 + # + # With hash argument +hash+ given, + # returns that hash with GC statistics merged into its content; + # this form may be useful in minimizing {probe effects}[https://en.wikipedia.org/wiki/Probe_effect]: + # + # h = {foo: 0, bar: 1} + # GC.stat(h) + # h.keys.take(5) # => [:foo, :bar, :count, :time, :marking_time] # - # The hash includes internal statistics about \GC such as: + # The hash includes entries such as: # - # [count] + # - +:count+: # The total number of garbage collections run since application start - # (count includes both minor and major garbage collections) - # [time] - # The total time spent in garbage collections (in milliseconds) - # [heap_allocated_pages] - # The total number of +:heap_eden_pages+ + +:heap_tomb_pages+ - # [heap_sorted_length] - # The number of pages that can fit into the buffer that holds references to - # all pages - # [heap_allocatable_pages] - # The total number of pages the application could allocate without additional \GC - # [heap_available_slots] - # The total number of slots in all +:heap_allocated_pages+ - # [heap_live_slots] - # The total number of slots which contain live objects - # [heap_free_slots] - # The total number of slots which do not contain live objects - # [heap_final_slots] - # The total number of slots with pending finalizers to be run - # [heap_marked_slots] - # The total number of objects marked in the last \GC - # [heap_eden_pages] - # The total number of pages which contain at least one live slot - # [heap_tomb_pages] - # The total number of pages which do not contain any live slots - # [total_allocated_pages] - # The cumulative number of pages allocated since application start - # [total_freed_pages] - # The cumulative number of pages freed since application start - # [total_allocated_objects] - # The cumulative number of objects allocated since application start - # [total_freed_objects] - # The cumulative number of objects freed since application start - # [malloc_increase_bytes] - # Amount of memory allocated on the heap for objects. Decreased by any \GC - # [malloc_increase_bytes_limit] - # When +:malloc_increase_bytes+ crosses this limit, \GC is triggered - # [minor_gc_count] - # The total number of minor garbage collections run since process start - # [major_gc_count] - # The total number of major garbage collections run since process start - # [compact_count] - # The total number of compactions run since process start - # [read_barrier_faults] - # The total number of times the read barrier was triggered during - # compaction - # [total_moved_objects] - # The total number of objects compaction has moved - # [remembered_wb_unprotected_objects] - # The total number of objects without write barriers - # [remembered_wb_unprotected_objects_limit] - # When +:remembered_wb_unprotected_objects+ crosses this limit, - # major \GC is triggered - # [old_objects] - # Number of live, old objects which have survived at least 3 garbage collections - # [old_objects_limit] - # When +:old_objects+ crosses this limit, major \GC is triggered - # [oldmalloc_increase_bytes] - # Amount of memory allocated on the heap for objects. Decreased by major \GC - # [oldmalloc_increase_bytes_limit] - # When +:oldmalloc_increase_bytes+ crosses this limit, major \GC is triggered - # - # If the optional argument, hash, is given, - # it is overwritten and returned. - # This is intended to avoid the probe effect. + # (count includes both minor and major garbage collections). + # - +:time+: + # The total time spent in garbage collections (in milliseconds). + # - +:heap_allocated_pages+: + # The total number of +:heap_eden_pages+ + +:heap_tomb_pages+. + # - +:heap_sorted_length+: + # The number of pages that can fit into the buffer that holds references to all pages. + # - +:heap_allocatable_pages+: + # The total number of pages the application could allocate without additional \GC. + # - +:heap_available_slots+: + # The total number of slots in all +:heap_allocated_pages+. + # - +:heap_live_slots+: + # The total number of slots which contain live objects. + # - +:heap_free_slots+: + # The total number of slots which do not contain live objects. + # - +:heap_final_slots+: + # The total number of slots with pending finalizers to be run. + # - +:heap_marked_slots+: + # The total number of objects marked in the last \GC. + # - +:heap_eden_pages+: + # The total number of pages which contain at least one live slot. + # - +:heap_tomb_pages+: + # The total number of pages which do not contain any live slots. + # - +:total_allocated_pages+: + # The cumulative number of pages allocated since application start. + # - +:total_freed_pages+: + # The cumulative number of pages freed since application start. + # - +:total_allocated_objects+: + # The cumulative number of objects allocated since application start. + # - +:total_freed_objects+: + # The cumulative number of objects freed since application start. + # - +:malloc_increase_bytes+: + # Amount of memory allocated on the heap for objects. Decreased by any \GC. + # - +:malloc_increase_bytes_limit+: + # When +:malloc_increase_bytes+ crosses this limit, \GC is triggered. + # - +:minor_gc_count+: + # The total number of minor garbage collections run since process start. + # - +:major_gc_count+: + # The total number of major garbage collections run since process start. + # - +:compact_count+: + # The total number of compactions run since process start. + # - +:read_barrier_faults+: + # The total number of times the read barrier was triggered during compaction. + # - +:total_moved_objects+: + # The total number of objects compaction has moved. + # - +:remembered_wb_unprotected_objects+: + # The total number of objects without write barriers. + # - +:remembered_wb_unprotected_objects_limit+: + # When +:remembered_wb_unprotected_objects+ crosses this limit, major \GC is triggered. + # - +:old_objects+: + # Number of live, old objects which have survived at least 3 garbage collections. + # - +:old_objects_limit+: + # When +:old_objects+ crosses this limit, major \GC is triggered. + # - +:oldmalloc_increase_bytes+: + # Amount of memory allocated on the heap for objects. Decreased by major \GC. + # - +:oldmalloc_increase_bytes_limit+: + # When +:oldmalloc_increase_bytes+ crosses this limit, major \GC is triggered. # - # This method is only expected to work on CRuby. def self.stat hash_or_key = nil Primitive.gc_stat hash_or_key end @@ -292,7 +343,7 @@ def self.stat_heap heap_name = nil, hash_or_key = nil # # The single read-only entry for all implementations is: # - # - +implementation+: + # - +:implementation+: # the string name of the implementation; # for the Ruby default implementation, 'default'. # @@ -302,7 +353,7 @@ def self.stat_heap heap_name = nil, hash_or_key = nil # # For Ruby's default implementation the single entry is: # - # - +rgengc_allow_full_mark+: + # - +:rgengc_allow_full_mark+: # Controls whether the \GC is allowed to run a full mark (young & old objects): # # - +true+ (default): \GC interleaves major and minor collections. diff --git a/gems/bundled_gems b/gems/bundled_gems index 4fed6a994d8766..77ace93114a17c 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -18,7 +18,7 @@ net-pop 0.1.2 https://github.com/ruby/net-pop net-smtp 0.5.1 https://github.com/ruby/net-smtp matrix 0.4.3 https://github.com/ruby/matrix prime 0.1.4 https://github.com/ruby/prime -rbs 3.9.4 https://github.com/ruby/rbs +rbs 3.9.4 https://github.com/ruby/rbs fba1f778b7eff01dde5e3d886e850f7eea018f2b typeprof 0.30.1 https://github.com/ruby/typeprof debug 1.11.0 https://github.com/ruby/debug racc 1.8.1 https://github.com/ruby/racc diff --git a/thread_sync.c b/thread_sync.c index 955e5529457dc8..701eb581d1cbc7 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -374,7 +374,6 @@ do_mutex_lock(VALUE self, int interruptible_p) rb_ractor_sleeper_threads_dec(th->ractor); th->status = prev_status; th->locking_mutex = Qfalse; - th->locking_mutex = Qfalse; RUBY_DEBUG_LOG("%p wakeup", mutex); } diff --git a/tool/rbs_skip_tests_windows b/tool/rbs_skip_tests_windows new file mode 100644 index 00000000000000..bdf3dddfd7a594 --- /dev/null +++ b/tool/rbs_skip_tests_windows @@ -0,0 +1,104 @@ +ARGFTest Failing on Windows + +# NotImplementedError: fileno() function is unimplemented on this machine +test_fileno(DirInstanceTest) +test_fchdir(DirSingletonTest) +test_for_fd(DirSingletonTest) + +# ArgumentError: user root doesn't exist +test_home(DirSingletonTest) + +# NameError: uninitialized constant Etc::CS_PATH +test_confstr(EtcSingletonTest) + +# NameError: uninitialized constant Etc::SC_ARG_MAX +test_sysconf(EtcSingletonTest) + +# Errno::EACCES: Permission denied @ apply2files - C:/a/_temp/d20250813-10156-udw6rx/chmod +test_chmod(FileInstanceTest) +test_chmod(FileInstanceTest) +test_truncate(FileInstanceTest) + +# Errno::EISDIR: Is a directory @ rb_sysopen - C:/a/ruby/ruby/src/gems/src/rbs/test/stdlib +test_directory?(FileSingletonTest) + +# NotImplementedError: lutime() function is unimplemented on this machine +test_lutime(FileSingletonTest) + +# NotImplementedError: mkfifo() function is unimplemented on this machine +test_mkfifo(FileSingletonTest) + +# Returns `nil` on Windows +test_getgrgid(EtcSingletonTest) +test_getgrnam(EtcSingletonTest) +test_getpwnam(EtcSingletonTest) +test_getpwuid(EtcSingletonTest) + +# Returns `false` +test_setgid?(FileSingletonTest) +test_setuid?(FileSingletonTest) +test_sticky?(FileSingletonTest) + +test_world_readable?(FileSingletonTest) # Returns `420` +test_world_readable?(FileStatInstanceTest) # Returns `420` +test_world_writable?(FileSingletonTest) # Returns `nil` +test_dev_major(FileStatInstanceTest) # Returns `nil` +test_dev_minor(FileStatInstanceTest) # Returns `nil` +test_rdev_major(FileStatInstanceTest) # Returns `nil` +test_rdev_minor(FileStatInstanceTest) # Returns `nil` + +# ArgumentError: wrong number of arguments (given -403772944, expected 0+) +test_curry(MethodInstanceTest) + +# ArgumentError: no output encoding given +test_tolocale(KconvSingletonTest) + +# Errno::EINVAL: Invalid argument - : +test_system(KernelInstanceTest) + +# OpenSSL::ConfigError: BIO_new_file: no such file +test_load(OpenSSLConfigSingletonTest) + +# Errno::ENOENT: No such file or directory @ rb_sysopen - +test_parse(OpenSSLConfigSingletonTest) +test_parse_config(OpenSSLConfigSingletonTest) + +# OpenSSL::ConfigError: BIO_new_file: no such file +test_each(OpenSSLConfigTest) +test_lookup_and_set(OpenSSLConfigTest) +test_sections(OpenSSLConfigTest) + +# OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 peeraddr=185.199.108.153:443 state=error: certificate verify failed (unable to get local issuer certificate) +test_URI_open(OpenURISingletonTest) + +# ArgumentError: both textmode and binmode specified +test_binwrite(PathnameInstanceTest) + +# Errno::EACCES: Permission denied @ apply2files - C:/a/_temp/rbs-pathname-delete-test20250813-10156-mb3e9i +test_delete(PathnameInstanceTest) +# Errno::EACCES: Permission denied @ apply2files - C:/a/_temp/rbs-pathname-binwrite-test20250813-10156-sh8145 +test_open(PathnameInstanceTest) +# Errno::EACCES: Permission denied @ rb_file_s_truncate - C:/a/_temp/rbs-pathname-truncate-test20250813-10156-dqqiw3 +test_truncate(PathnameInstanceTest) +# Errno::EACCES: Permission denied @ rb_file_s_truncate - C:/a/_temp/rbs-pathname-truncate-test20250813-10156-dqqiw3 +test_unlink(PathnameInstanceTest) + +# Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/resolv.conf +test_parse_resolv_conf(ResolvDNSConfigSingletonTest) +# Resolv::ResolvError: no name for 127.0.0.1 +test_getname(ResolvInstanceTest) +# Resolv::ResolvError: no name for 127.0.0.1 +test_getname(ResolvSingletonTest) + +# ArgumentError: unsupported signal 'SIGUSR2' +test_trap(SignalSingletonTest) + +# Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/README.md20250813-10156-mgr4tx +test_create(TempfileSingletonTest) + +# Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/README.md20250813-10156-hp9nzu +test_initialize(TempfileSingletonTest) +test_new(TempfileSingletonTest) + +# Errno::EACCES: Permission denied @ apply2files - C:/a/_temp/d20250813-10156-f8z9pn/test.gz +test_open(ZlibGzipReaderSingletonTest) diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 221779b130dab3..c44b78d63b4bdf 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -53,7 +53,15 @@ File.unlink(path) if File.exist?(path) end - test_command << " stdlib_test validate RBS_SKIP_TESTS=#{__dir__}/rbs_skip_tests SKIP_RBS_VALIDATION=true" + rbs_skip_tests = [ + File.join(__dir__, "/rbs_skip_tests") + ] + + if /mswin|mingw/ =~ RUBY_PLATFORM + rbs_skip_tests << File.join(__dir__, "/rbs_skip_tests_windows") + end + + test_command << " stdlib_test validate RBS_SKIP_TESTS=#{rbs_skip_tests.join(File::PATH_SEPARATOR)} SKIP_RBS_VALIDATION=true" first_timeout *= 3 when "debug"