Skip to content
Merged
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ cache:

env:
global:
# The tests skipped in `make test-all`.
- TEST_ALL_SKIPPED_TESTS=
# The tests executed separately by `make test-all`.
- TEST_ALL_SEPARATED_TESTS=
# Reset timestamps early
- _=$(touch NEWS && find . -type f -exec touch -r NEWS {} +)
- CONFIGURE_TTY=no
Expand All @@ -38,12 +42,6 @@ env:
- SETARCH=
- RUBY_PREFIX=/tmp/ruby-prefix
- GEMS_FOR_TEST='timezone tzinfo'
# The tests skipped in `make test-all`.
- TEST_ALL_SKIPPED_TESTS=
# Run the separated tests with allowing failures.
- RUN_SEPARATED_TESTS=true
# The tests executed separately by `make test-all`.
- TEST_ALL_SEPARATED_TESTS=
# 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"
Expand Down Expand Up @@ -97,6 +95,9 @@ env:
compiler: arm-linux-gnueabihf-gcc
env:
- SETARCH='setarch linux32 --verbose --32bit'
# The "TestReadline#test_interrupt_in_other_thread" started failing on arm32
# from https://www.travis-ci.com/github/ruby/ruby/jobs/529005145
- TEST_ALL_SKIPPED_TESTS=test_interrupt_in_other_thread
before_install:
- sudo dpkg --add-architecture armhf
- tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
Expand All @@ -123,9 +124,7 @@ matrix:
- <<: *ppc64le-linux
- <<: *s390x-linux
allow_failures:
# The "TestReadline#test_interrupt_in_other_thread" started failing on arm32
# from https://www.travis-ci.com/github/ruby/ruby/jobs/529005145
- name: arm32-linux
# - name: arm32-linux
# - name: arm64-linux
# We see "Some worker was crashed." in about 40% of recent ppc64le-linux jobs
# e.g. https://app.travis-ci.com/github/ruby/ruby/jobs/530959548
Expand Down Expand Up @@ -199,7 +198,7 @@ script:
# Run the failing tests separately returning ok status to check if it works,
# visualize them.
- |
if [ "${RUN_SEPARATED_TESTS}" = true -a -n "${TEST_ALL_OPTS_SEPARATED}" ]; then
if [ -n "${TEST_ALL_OPTS_SEPARATED}" ]; then
$SETARCH make -s test-all -o exts TESTOPTS="$JOBS -v --tty=no ${TEST_ALL_OPTS_SEPARATED}" RUBYOPT="-w" || :
fi
- $SETARCH make -s test-spec MSPECOPT=-ff # not using `-j` because sometimes `mspec -j` silently dies
Expand Down
2 changes: 1 addition & 1 deletion gems/bundled_gems
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rss 0.2.9 https://github.com/ruby/rss 0.2.9
net-ftp 0.1.3 https://github.com/ruby/net-ftp
net-imap 0.2.2 https://github.com/ruby/net-imap
net-pop 0.1.1 https://github.com/ruby/net-pop
net-smtp 0.2.1 https://github.com/ruby/net-smtp
net-smtp 0.2.2 https://github.com/ruby/net-smtp
matrix 0.4.2 https://github.com/ruby/matrix
prime 0.1.2 https://github.com/ruby/prime
rbs 1.6.2 https://github.com/ruby/rbs
Expand Down
2 changes: 2 additions & 0 deletions lib/rubygems/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ def self.verify_certificate_message(error_number, cert)
return unless cert
case error_number
when OpenSSL::X509::V_ERR_CERT_HAS_EXPIRED then
require 'time'
"Certificate #{cert.subject} expired at #{cert.not_after.iso8601}"
when OpenSSL::X509::V_ERR_CERT_NOT_YET_VALID then
require 'time'
"Certificate #{cert.subject} not valid until #{cert.not_before.iso8601}"
when OpenSSL::X509::V_ERR_CERT_REJECTED then
"Certificate #{cert.subject} is rejected"
Expand Down
20 changes: 11 additions & 9 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,13 +1876,19 @@ rb_float_floor(VALUE num, int ndigits)
* (0.3 / 0.1).floor #=> 2 (!)
*/

static VALUE
flo_floor(int argc, VALUE *argv, VALUE num)
static int
flo_ndigits(int argc, VALUE *argv)
{
int ndigits = 0;
if (rb_check_arity(argc, 0, 1)) {
ndigits = NUM2INT(argv[0]);
return NUM2INT(argv[0]);
}
return 0;
}

static VALUE
flo_floor(int argc, VALUE *argv, VALUE num)
{
int ndigits = flo_ndigits(argc, argv);
return rb_float_floor(num, ndigits);
}

Expand Down Expand Up @@ -1928,11 +1934,7 @@ flo_floor(int argc, VALUE *argv, VALUE num)
static VALUE
flo_ceil(int argc, VALUE *argv, VALUE num)
{
int ndigits = 0;

if (rb_check_arity(argc, 0, 1)) {
ndigits = NUM2INT(argv[0]);
}
int ndigits = flo_ndigits(argc, argv);
return rb_float_ceil(num, ndigits);
}

Expand Down
10 changes: 1 addition & 9 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,15 +990,7 @@ rb_proc_call_kw(VALUE self, VALUE args, int kw_splat)
VALUE
rb_proc_call(VALUE self, VALUE args)
{
VALUE vret;
rb_proc_t *proc;
GetProcPtr(self, proc);
vret = rb_vm_invoke_proc(GET_EC(), proc,
check_argc(RARRAY_LEN(args)), RARRAY_CONST_PTR(args),
RB_NO_KEYWORDS, VM_BLOCK_HANDLER_NONE);
RB_GC_GUARD(self);
RB_GC_GUARD(args);
return vret;
return rb_proc_call_kw(self, args, RB_NO_KEYWORDS);
}

static VALUE
Expand Down
42 changes: 14 additions & 28 deletions range.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ range_each_func(VALUE range, int (*func)(VALUE, VALUE), VALUE arg)
}
}

static int
sym_step_i(VALUE i, VALUE arg)
static bool
step_i_iter(VALUE arg)
{
VALUE *iter = (VALUE *)arg;

Expand All @@ -319,27 +319,25 @@ sym_step_i(VALUE i, VALUE arg)
else {
iter[0] = rb_funcall(iter[0], '-', 1, INT2FIX(1));
}
if (iter[0] == INT2FIX(0)) {
if (iter[0] != INT2FIX(0)) return false;
iter[0] = iter[1];
return true;
}

static int
sym_step_i(VALUE i, VALUE arg)
{
if (step_i_iter(arg)) {
rb_yield(rb_str_intern(i));
iter[0] = iter[1];
}
return 0;
}

static int
step_i(VALUE i, VALUE arg)
{
VALUE *iter = (VALUE *)arg;

if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
}
else {
iter[0] = rb_funcall(iter[0], '-', 1, INT2FIX(1));
}
if (iter[0] == INT2FIX(0)) {
if (step_i_iter(arg)) {
rb_yield(i);
iter[0] = iter[1];
}
return 0;
}
Expand Down Expand Up @@ -465,6 +463,7 @@ range_step(int argc, VALUE *argv, VALUE range)
}

step = check_step_domain(step);
VALUE iter[2] = {INT2FIX(1), step};

if (FIXNUM_P(b) && NIL_P(e) && FIXNUM_P(step)) {
long i = FIX2LONG(b), unit = FIX2LONG(step);
Expand Down Expand Up @@ -492,10 +491,6 @@ range_step(int argc, VALUE *argv, VALUE range)

}
else if (SYMBOL_P(b) && (NIL_P(e) || SYMBOL_P(e))) { /* symbols are special */
VALUE iter[2];
iter[0] = INT2FIX(1);
iter[1] = step;

b = rb_sym2str(b);
if (NIL_P(e)) {
rb_str_upto_endless_each(b, sym_step_i, (VALUE)iter);
Expand Down Expand Up @@ -524,12 +519,7 @@ range_step(int argc, VALUE *argv, VALUE range)
tmp = rb_check_string_type(b);

if (!NIL_P(tmp)) {
VALUE iter[2];

b = tmp;
iter[0] = INT2FIX(1);
iter[1] = step;

if (NIL_P(e)) {
rb_str_upto_endless_each(b, step_i, (VALUE)iter);
}
Expand All @@ -538,15 +528,11 @@ range_step(int argc, VALUE *argv, VALUE range)
}
}
else {
VALUE args[2];

if (!discrete_object_p(b)) {
rb_raise(rb_eTypeError, "can't iterate from %s",
rb_obj_classname(b));
}
args[0] = INT2FIX(1);
args[1] = step;
range_each_func(range, step_i, (VALUE)args);
range_each_func(range, step_i, (VALUE)iter);
}
}
return range;
Expand Down
16 changes: 11 additions & 5 deletions tool/lib/test/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def sort_by_name(list)

alias sort_by_string sort_by_name

def group(list)
list
end
end

module JITFirst
def group(list)
# JIT first
jit, others = list.partition {|e| /test_jit/ =~ e}
Expand All @@ -77,6 +83,8 @@ def group(list)
end

class Alpha < NoSort
include JITFirst

def sort_by_name(list)
list.sort_by(&:name)
end
Expand All @@ -89,6 +97,8 @@ def sort_by_string(list)

# shuffle test suites based on CRC32 of their names
Shuffle = Struct.new(:seed, :salt) do
include JITFirst

def initialize(seed)
self.class::CRC_TBL ||= (0..255).map {|i|
(0..7).inject(i) {|c,| (c & 1 == 1) ? (0xEDB88320 ^ (c >> 1)) : (c >> 1) }
Expand All @@ -106,10 +116,6 @@ def sort_by_string(list)
list.sort_by {|e| randomize_key(e)}
end

def group(list)
list
end

private

def crc32(str, crc32 = 0xffffffff)
Expand Down Expand Up @@ -182,7 +188,7 @@ def process_args(args = [])
order = options[:test_order]
if seed = options[:seed]
order ||= :random
elsif order == :random
elsif (order ||= :random) == :random
seed = options[:seed] = rand(0x10000)
orig_args.unshift "--seed=#{seed}"
end
Expand Down