Skip to content

Commit

Permalink
Showing 84 changed files with 1,415 additions and 268 deletions.
12 changes: 8 additions & 4 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -411,6 +411,8 @@ private static final class RequireLocks {
// global lock for require must be fair
//private final ReentrantLock globalLock;

public enum LockResult { LOCKED, CIRCULAR }

private RequireLocks() {
this.pool = new ConcurrentHashMap<>(8, 0.75f, 2);
//this.globalLock = new ReentrantLock(true);
@@ -426,7 +428,7 @@ private RequireLocks() {
* @return If the sync object already locked by current thread, it just
* returns false without getting a lock. Otherwise true.
*/
private boolean lock(String requireName) {
private LockResult lock(String requireName) {
ReentrantLock lock = pool.get(requireName);

if (lock == null) {
@@ -435,9 +437,11 @@ private boolean lock(String requireName) {
if (lock == null) lock = newLock;
}

if (lock.isHeldByCurrentThread()) return false;
if (lock.isHeldByCurrentThread()) return LockResult.CIRCULAR;

lock.lock();

return lock.tryLock();
return LockResult.LOCKED;
}

/**
@@ -497,7 +501,7 @@ private RequireState smartLoadInternal(String file, boolean circularRequireWarni
throw runtime.newLoadError("no such file to load -- " + file, file);
}

if (!requireLocks.lock(state.loadName)) {
if (requireLocks.lock(state.loadName) == RequireLocks.LockResult.CIRCULAR) {
if (circularRequireWarning && runtime.isVerbose()) {
warnCircularRequire(state.loadName);
}
18 changes: 13 additions & 5 deletions lib/ruby/stdlib/date.rb
Original file line number Diff line number Diff line change
@@ -1402,14 +1402,22 @@ def - (x)
# two DateTime instances. When comparing a DateTime instance
# with a Date instance, the time of the latter will be
# considered as falling on midnight UTC.
class org::joda::time::DateTime
java_alias :compareDT, :compareTo, [org.joda.time.ReadableInstant]
end
def <=> (other)
case other
when Numeric
ajd <=> other
when Date
if other.kind_of?(Date)
# The method compareTo doesn't compare the sub milliseconds so after compare the two dates
# then we have to compare the sub milliseconds to make sure that both are exactly equal.
@dt.compareTo(other.dt).nonzero? || @sub_millis <=> other.sub_millis
@dt.compareDT(other.dt).nonzero? || @sub_millis <=> other.sub_millis
else
__internal_cmp(other)
end
end

private def __internal_cmp(other)
if other.kind_of? Numeric
ajd <=> other
else
begin
l, r = other.coerce(self)
104 changes: 104 additions & 0 deletions lib/ruby/stdlib/ffi/platform/aarch64-linux/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long
rbx.platform.typedef.__uint64_t = ulong
rbx.platform.typedef.__quad_t = long
rbx.platform.typedef.__u_quad_t = ulong
rbx.platform.typedef.__dev_t = ulong
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = uint
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = long
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = int
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong
rbx.platform.typedef.__fsword_t = long
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__syscall_slong_t = long
rbx.platform.typedef.__syscall_ulong_t = ulong
rbx.platform.typedef.__loff_t = long
rbx.platform.typedef.*__qaddr_t = long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long
rbx.platform.typedef.u_quad_t = ulong
rbx.platform.typedef.loff_t = long
rbx.platform.typedef.ino_t = ulong
rbx.platform.typedef.dev_t = ulong
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = pointer
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.suseconds_t = long
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = int
rbx.platform.typedef.blkcnt_t = long
rbx.platform.typedef.fsblkcnt_t = ulong
rbx.platform.typedef.fsfilcnt_t = ulong
rbx.platform.typedef.pthread_t = ulong
rbx.platform.typedef.pthread_key_t = uint
rbx.platform.typedef.pthread_once_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = ushort
rbx.platform.typedef.rlim_t = ulong
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
2 changes: 2 additions & 0 deletions lib/ruby/stdlib/ffi/platform/arm-linux/types.conf
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ rbx.platform.typedef.__u_quad_t = ulong_long
rbx.platform.typedef.__dev_t = ulong_long
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__in_addr_t = uint
rbx.platform.typedef.__in_port_t = ushort
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong_long
rbx.platform.typedef.__mode_t = uint
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/ffi/platform/i386-cygwin/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rbx.platform.typedef.size_t = uint
rbx.platform.typedef.ptrdiff_t = int
rbx.platform.typedef.ssize_t = int
107 changes: 107 additions & 0 deletions lib/ruby/stdlib/ffi/platform/i386-gnu/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long_long
rbx.platform.typedef.__uint64_t = ulong_long
rbx.platform.typedef.__quad_t = long_long
rbx.platform.typedef.__u_quad_t = ulong_long
rbx.platform.typedef.__dev_t = uint
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong_long
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = uint
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long_long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__fsid_t = ulong_long
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong_long
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = long
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__swblk_t = long
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = int
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long_long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong_long
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong_long
rbx.platform.typedef.__ssize_t = int
rbx.platform.typedef.__loff_t = long_long
rbx.platform.typedef.*__qaddr_t = long_long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = int
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long_long
rbx.platform.typedef.u_quad_t = ulong_long
rbx.platform.typedef.fsid_t = ulong_long
rbx.platform.typedef.loff_t = long_long
rbx.platform.typedef.ino_t = ulong_long
rbx.platform.typedef.dev_t = uint
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long_long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = int
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = int
rbx.platform.typedef.size_t = uint
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.__sigset_t = ulong
rbx.platform.typedef.sigset_t = ulong
rbx.platform.typedef.suseconds_t = long
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.blkcnt_t = long_long
rbx.platform.typedef.fsblkcnt_t = ulong_long
rbx.platform.typedef.fsfilcnt_t = ulong_long
rbx.platform.typedef.__pthread_t = int
rbx.platform.typedef.pthread_t = int
rbx.platform.typedef.__pthread_key = int
rbx.platform.typedef.pthread_key_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = uchar
rbx.platform.typedef.rlim_t = ulong_long
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/ffi/platform/i386-linux/types.conf
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ rbx.platform.typedef.__swblk_t = long
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long_long
@@ -57,6 +58,8 @@ rbx.platform.typedef.loff_t = long_long
rbx.platform.typedef.ino_t = ulong_long
rbx.platform.typedef.dev_t = ulong_long
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.in_addr_t = uint
rbx.platform.typedef.in_port_t = ushort
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.uid_t = uint
126 changes: 126 additions & 0 deletions lib/ruby/stdlib/ffi/platform/i386-netbsd/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long_long
rbx.platform.typedef.__uint64_t = ulong_long
rbx.platform.typedef.__int_least8_t = char
rbx.platform.typedef.__uint_least8_t = uchar
rbx.platform.typedef.__int_least16_t = short
rbx.platform.typedef.__uint_least16_t = ushort
rbx.platform.typedef.__int_least32_t = int
rbx.platform.typedef.__uint_least32_t = uint
rbx.platform.typedef.__int_least64_t = long_long
rbx.platform.typedef.__uint_least64_t = ulong_long
rbx.platform.typedef.__int_fast8_t = int
rbx.platform.typedef.__uint_fast8_t = uint
rbx.platform.typedef.__int_fast16_t = int
rbx.platform.typedef.__uint_fast16_t = uint
rbx.platform.typedef.__int_fast32_t = int
rbx.platform.typedef.__uint_fast32_t = uint
rbx.platform.typedef.__int_fast64_t = long_long
rbx.platform.typedef.__uint_fast64_t = ulong_long
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__uintptr_t = ulong
rbx.platform.typedef.__intmax_t = long_long
rbx.platform.typedef.__uintmax_t = ulong_long
rbx.platform.typedef.__register_t = int
rbx.platform.typedef.__vaddr_t = ulong
rbx.platform.typedef.__paddr_t = ulong
rbx.platform.typedef.__vsize_t = ulong
rbx.platform.typedef.__psize_t = ulong
rbx.platform.typedef.__clock_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__off_t = long_long
rbx.platform.typedef.__ptrdiff_t = long
rbx.platform.typedef.__size_t = ulong
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__time_t = int
rbx.platform.typedef.__timer_t = int
rbx.platform.typedef.__wchar_t = int
rbx.platform.typedef.__wint_t = int
rbx.platform.typedef.__rune_t = int
rbx.platform.typedef.__wctrans_t = pointer
rbx.platform.typedef.__wctype_t = pointer
rbx.platform.typedef.__cpuid_t = ulong
rbx.platform.typedef.__dev_t = int
rbx.platform.typedef.__fixpt_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__in_addr_t = uint
rbx.platform.typedef.__in_port_t = ushort
rbx.platform.typedef.__ino_t = uint
rbx.platform.typedef.__key_t = long
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = uint
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__rlim_t = ulong_long
rbx.platform.typedef.__sa_family_t = uchar
rbx.platform.typedef.__segsz_t = int
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.__swblk_t = int
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = int
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.unchar = uchar
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.cpuid_t = ulong
rbx.platform.typedef.register_t = int
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.uint8_t = uchar
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.uint16_t = ushort
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.quad_t = long_long
rbx.platform.typedef.u_quad_t = ulong_long
rbx.platform.typedef.qaddr_t = pointer
rbx.platform.typedef.vaddr_t = ulong
rbx.platform.typedef.paddr_t = ulong
rbx.platform.typedef.vsize_t = ulong
rbx.platform.typedef.psize_t = ulong
rbx.platform.typedef.caddr_t = string
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.daddr32_t = int
rbx.platform.typedef.daddr64_t = long_long
rbx.platform.typedef.dev_t = int
rbx.platform.typedef.fixpt_t = uint
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ino_t = uint
rbx.platform.typedef.key_t = long
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.rlim_t = ulong_long
rbx.platform.typedef.segsz_t = int
rbx.platform.typedef.swblk_t = int
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.useconds_t = uint
rbx.platform.typedef.suseconds_t = int
rbx.platform.typedef.in_addr_t = uint
rbx.platform.typedef.in_port_t = ushort
rbx.platform.typedef.sa_family_t = uchar
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.clock_t = int
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.time_t = int
rbx.platform.typedef.timer_t = int
rbx.platform.typedef.off_t = long_long
rbx.platform.typedef.__fd_mask = int
2 changes: 2 additions & 0 deletions lib/ruby/stdlib/ffi/platform/i386-openbsd/types.conf
Original file line number Diff line number Diff line change
@@ -82,6 +82,8 @@ rbx.platform.typedef.int32_t = int
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.intptr_t = long
rbx.platform.typedef.uintptr_t = ulong
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
104 changes: 104 additions & 0 deletions lib/ruby/stdlib/ffi/platform/ia64-linux/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long
rbx.platform.typedef.__uint64_t = ulong
rbx.platform.typedef.__quad_t = long
rbx.platform.typedef.__u_quad_t = ulong
rbx.platform.typedef.__dev_t = ulong
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__in_addr_t = uint
rbx.platform.typedef.__in_port_t = ushort
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = ulong
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = long
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__swblk_t = long
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__loff_t = long
rbx.platform.typedef.*__qaddr_t = long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long
rbx.platform.typedef.u_quad_t = ulong
rbx.platform.typedef.loff_t = long
rbx.platform.typedef.ino_t = ulong
rbx.platform.typedef.dev_t = ulong
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = ulong
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = pointer
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.suseconds_t = long
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.blkcnt_t = long
rbx.platform.typedef.fsblkcnt_t = ulong
rbx.platform.typedef.fsfilcnt_t = ulong
rbx.platform.typedef.pthread_t = ulong
rbx.platform.typedef.pthread_key_t = uint
rbx.platform.typedef.pthread_once_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = ushort
rbx.platform.typedef.rlim_t = ulong
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
104 changes: 104 additions & 0 deletions lib/ruby/stdlib/ffi/platform/mips64el-linux/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long
rbx.platform.typedef.__uint64_t = ulong
rbx.platform.typedef.__quad_t = long
rbx.platform.typedef.__u_quad_t = ulong
rbx.platform.typedef.__dev_t = ulong
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = ulong
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = long
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong
rbx.platform.typedef.__fsword_t = long
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__syscall_slong_t = long
rbx.platform.typedef.__syscall_ulong_t = ulong
rbx.platform.typedef.__loff_t = long
rbx.platform.typedef.*__qaddr_t = long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long
rbx.platform.typedef.u_quad_t = ulong
rbx.platform.typedef.loff_t = long
rbx.platform.typedef.ino_t = ulong
rbx.platform.typedef.dev_t = ulong
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = ulong
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = pointer
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.suseconds_t = long
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.blkcnt_t = long
rbx.platform.typedef.fsblkcnt_t = ulong
rbx.platform.typedef.fsfilcnt_t = ulong
rbx.platform.typedef.pthread_t = ulong
rbx.platform.typedef.pthread_key_t = uint
rbx.platform.typedef.pthread_once_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = ushort
rbx.platform.typedef.rlim_t = ulong
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
104 changes: 104 additions & 0 deletions lib/ruby/stdlib/ffi/platform/powerpc64-linux/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long
rbx.platform.typedef.__uint64_t = ulong
rbx.platform.typedef.__quad_t = long
rbx.platform.typedef.__u_quad_t = ulong
rbx.platform.typedef.__dev_t = ulong
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = ulong
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = long
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong
rbx.platform.typedef.__fsword_t = long
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__syscall_slong_t = long
rbx.platform.typedef.__syscall_ulong_t = ulong
rbx.platform.typedef.__loff_t = long
rbx.platform.typedef.*__qaddr_t = long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long
rbx.platform.typedef.u_quad_t = ulong
rbx.platform.typedef.loff_t = long
rbx.platform.typedef.ino_t = ulong
rbx.platform.typedef.dev_t = ulong
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = ulong
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = pointer
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.suseconds_t = long
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.blkcnt_t = long
rbx.platform.typedef.fsblkcnt_t = ulong
rbx.platform.typedef.fsfilcnt_t = ulong
rbx.platform.typedef.pthread_t = ulong
rbx.platform.typedef.pthread_key_t = uint
rbx.platform.typedef.pthread_once_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = ushort
rbx.platform.typedef.rlim_t = ulong
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
102 changes: 102 additions & 0 deletions lib/ruby/stdlib/ffi/platform/sparc-linux/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
rbx.platform.typedef.__u_char = uchar
rbx.platform.typedef.__u_short = ushort
rbx.platform.typedef.__u_int = uint
rbx.platform.typedef.__u_long = ulong
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long_long
rbx.platform.typedef.__uint64_t = ulong_long
rbx.platform.typedef.__quad_t = long_long
rbx.platform.typedef.__u_quad_t = ulong_long
rbx.platform.typedef.__dev_t = ulong_long
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__ino_t = ulong
rbx.platform.typedef.__ino64_t = ulong_long
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = uint
rbx.platform.typedef.__off_t = long
rbx.platform.typedef.__off64_t = long_long
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__clock_t = long
rbx.platform.typedef.__rlim_t = ulong
rbx.platform.typedef.__rlim64_t = ulong_long
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__time_t = long
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = int
rbx.platform.typedef.__daddr_t = int
rbx.platform.typedef.__swblk_t = long
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long_long
rbx.platform.typedef.__fsblkcnt_t = ulong
rbx.platform.typedef.__fsblkcnt64_t = ulong_long
rbx.platform.typedef.__fsfilcnt_t = ulong
rbx.platform.typedef.__fsfilcnt64_t = ulong_long
rbx.platform.typedef.__ssize_t = int
rbx.platform.typedef.__loff_t = long_long
rbx.platform.typedef.*__qaddr_t = long_long
rbx.platform.typedef.*__caddr_t = char
rbx.platform.typedef.__intptr_t = int
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.quad_t = long_long
rbx.platform.typedef.u_quad_t = ulong_long
rbx.platform.typedef.loff_t = long_long
rbx.platform.typedef.ino_t = ulong_long
rbx.platform.typedef.dev_t = ulong_long
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.off_t = long_long
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ssize_t = int
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.key_t = int
rbx.platform.typedef.clock_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.timer_t = pointer
rbx.platform.typedef.size_t = uint
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long
rbx.platform.typedef.__sig_atomic_t = int
rbx.platform.typedef.suseconds_t = int
rbx.platform.typedef.__fd_mask = long
rbx.platform.typedef.fd_mask = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.blkcnt_t = long_long
rbx.platform.typedef.fsblkcnt_t = ulong_long
rbx.platform.typedef.fsfilcnt_t = ulong_long
rbx.platform.typedef.pthread_t = ulong
rbx.platform.typedef.pthread_key_t = uint
rbx.platform.typedef.pthread_once_t = int
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.sa_family_t = ushort
rbx.platform.typedef.rlim_t = ulong_long
rbx.platform.typedef.__rlimit_resource_t = int
rbx.platform.typedef.__rusage_who_t = int
rbx.platform.typedef.__priority_which_t = int
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/ffi/platform/x86_64-cygwin/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rbx.platform.typedef.size_t = uint64
rbx.platform.typedef.ptrdiff_t = int64
rbx.platform.typedef.ssize_t = int64
34 changes: 30 additions & 4 deletions lib/ruby/stdlib/ffi/platform/x86_64-darwin/types.conf
Original file line number Diff line number Diff line change
@@ -19,12 +19,12 @@ rbx.platform.typedef.__darwin_socklen_t = uint
rbx.platform.typedef.__darwin_ssize_t = long
rbx.platform.typedef.__darwin_time_t = long
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.register_t = long_long
rbx.platform.typedef.intptr_t = long
@@ -35,6 +35,7 @@ rbx.platform.typedef.user_ssize_t = long_long
rbx.platform.typedef.user_long_t = long_long
rbx.platform.typedef.user_ulong_t = ulong_long
rbx.platform.typedef.user_time_t = long_long
rbx.platform.typedef.user_off_t = long_long
rbx.platform.typedef.syscall_arg_t = ulong_long
rbx.platform.typedef.__darwin_blkcnt_t = long_long
rbx.platform.typedef.__darwin_blksize_t = int
@@ -50,12 +51,13 @@ rbx.platform.typedef.__darwin_mach_port_t = uint
rbx.platform.typedef.__darwin_mode_t = ushort
rbx.platform.typedef.__darwin_off_t = long_long
rbx.platform.typedef.__darwin_pid_t = int
rbx.platform.typedef.__darwin_pthread_key_t = ulong
rbx.platform.typedef.__darwin_sigset_t = uint
rbx.platform.typedef.__darwin_suseconds_t = int
rbx.platform.typedef.__darwin_uid_t = uint
rbx.platform.typedef.__darwin_useconds_t = uint
rbx.platform.typedef.__darwin_uuid_t[16] = uchar
rbx.platform.typedef.__darwin_uuid_string_t[37] = char
rbx.platform.typedef.__darwin_pthread_key_t = ulong
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
@@ -91,10 +93,34 @@ rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.time_t = long
rbx.platform.typedef.useconds_t = uint
rbx.platform.typedef.suseconds_t = int
rbx.platform.typedef.rsize_t = ulong
rbx.platform.typedef.errno_t = int
rbx.platform.typedef.fd_mask = int
rbx.platform.typedef.pthread_key_t = ulong
rbx.platform.typedef.fsblkcnt_t = uint
rbx.platform.typedef.fsfilcnt_t = uint
rbx.platform.typedef.sa_family_t = uchar
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.uint8_t = uchar
rbx.platform.typedef.uint16_t = ushort
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.int_least8_t = char
rbx.platform.typedef.int_least16_t = short
rbx.platform.typedef.int_least32_t = int
rbx.platform.typedef.int_least64_t = long_long
rbx.platform.typedef.uint_least8_t = uchar
rbx.platform.typedef.uint_least16_t = ushort
rbx.platform.typedef.uint_least32_t = uint
rbx.platform.typedef.uint_least64_t = ulong_long
rbx.platform.typedef.int_fast8_t = char
rbx.platform.typedef.int_fast16_t = short
rbx.platform.typedef.int_fast32_t = int
rbx.platform.typedef.int_fast64_t = long_long
rbx.platform.typedef.uint_fast8_t = uchar
rbx.platform.typedef.uint_fast16_t = ushort
rbx.platform.typedef.uint_fast32_t = uint
rbx.platform.typedef.uint_fast64_t = ulong_long
rbx.platform.typedef.intmax_t = long
rbx.platform.typedef.uintmax_t = ulong
rbx.platform.typedef.rlim_t = ulong_long
2 changes: 2 additions & 0 deletions lib/ruby/stdlib/ffi/platform/x86_64-freebsd/types.conf
Original file line number Diff line number Diff line change
@@ -82,6 +82,8 @@ rbx.platform.typedef.int32_t = int
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.intptr_t = long
rbx.platform.typedef.uintptr_t = ulong
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
4 changes: 3 additions & 1 deletion lib/ruby/stdlib/ffi/platform/x86_64-linux/types.conf
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ rbx.platform.typedef.__swblk_t = long
rbx.platform.typedef.__key_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__timer_t = pointer
rbx.platform.typedef.__blksize_t = long
rbx.platform.typedef.blksize_t = long
rbx.platform.typedef.__blkcnt_t = long
rbx.platform.typedef.__blkcnt64_t = long
rbx.platform.typedef.__fsblkcnt_t = ulong
@@ -57,6 +57,8 @@ rbx.platform.typedef.loff_t = long
rbx.platform.typedef.ino_t = ulong
rbx.platform.typedef.dev_t = ulong
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.in_addr_t = uint
rbx.platform.typedef.in_port_t = ushort
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = ulong
rbx.platform.typedef.uid_t = uint
128 changes: 128 additions & 0 deletions lib/ruby/stdlib/ffi/platform/x86_64-netbsd/types.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
rbx.platform.typedef.__int8_t = char
rbx.platform.typedef.__uint8_t = uchar
rbx.platform.typedef.__int16_t = short
rbx.platform.typedef.__uint16_t = ushort
rbx.platform.typedef.__int32_t = int
rbx.platform.typedef.__uint32_t = uint
rbx.platform.typedef.__int64_t = long_long
rbx.platform.typedef.__uint64_t = ulong_long
rbx.platform.typedef.__int_least8_t = char
rbx.platform.typedef.__uint_least8_t = uchar
rbx.platform.typedef.__int_least16_t = short
rbx.platform.typedef.__uint_least16_t = ushort
rbx.platform.typedef.__int_least32_t = int
rbx.platform.typedef.__uint_least32_t = uint
rbx.platform.typedef.__int_least64_t = long_long
rbx.platform.typedef.__uint_least64_t = ulong_long
rbx.platform.typedef.__int_fast8_t = int
rbx.platform.typedef.__uint_fast8_t = uint
rbx.platform.typedef.__int_fast16_t = int
rbx.platform.typedef.__uint_fast16_t = uint
rbx.platform.typedef.__int_fast32_t = int
rbx.platform.typedef.__uint_fast32_t = uint
rbx.platform.typedef.__int_fast64_t = long_long
rbx.platform.typedef.__uint_fast64_t = ulong_long
rbx.platform.typedef.__intptr_t = long
rbx.platform.typedef.__uintptr_t = ulong
rbx.platform.typedef.__intmax_t = long_long
rbx.platform.typedef.__uintmax_t = ulong_long
rbx.platform.typedef.__register_t = int
rbx.platform.typedef.__vaddr_t = ulong
rbx.platform.typedef.__paddr_t = ulong
rbx.platform.typedef.__vsize_t = ulong
rbx.platform.typedef.__psize_t = ulong
rbx.platform.typedef.__clock_t = int
rbx.platform.typedef.__clockid_t = int
rbx.platform.typedef.__off_t = long_long
rbx.platform.typedef.__ptrdiff_t = long
rbx.platform.typedef.__size_t = ulong
rbx.platform.typedef.__ssize_t = long
rbx.platform.typedef.__time_t = int
rbx.platform.typedef.__timer_t = int
rbx.platform.typedef.__wchar_t = int
rbx.platform.typedef.__wint_t = int
rbx.platform.typedef.__rune_t = int
rbx.platform.typedef.__wctrans_t = pointer
rbx.platform.typedef.__wctype_t = pointer
rbx.platform.typedef.__cpuid_t = ulong
rbx.platform.typedef.__dev_t = int
rbx.platform.typedef.__fixpt_t = uint
rbx.platform.typedef.__gid_t = uint
rbx.platform.typedef.__id_t = uint
rbx.platform.typedef.__in_addr_t = uint
rbx.platform.typedef.__in_port_t = ushort
rbx.platform.typedef.__ino_t = uint
rbx.platform.typedef.__key_t = long
rbx.platform.typedef.__mode_t = uint
rbx.platform.typedef.__nlink_t = uint
rbx.platform.typedef.__pid_t = int
rbx.platform.typedef.__rlim_t = ulong_long
rbx.platform.typedef.__sa_family_t = uchar
rbx.platform.typedef.__segsz_t = int
rbx.platform.typedef.__socklen_t = uint
rbx.platform.typedef.__swblk_t = int
rbx.platform.typedef.__uid_t = uint
rbx.platform.typedef.__useconds_t = uint
rbx.platform.typedef.__suseconds_t = int
rbx.platform.typedef.u_char = uchar
rbx.platform.typedef.u_short = ushort
rbx.platform.typedef.u_int = uint
rbx.platform.typedef.u_long = ulong
rbx.platform.typedef.unchar = uchar
rbx.platform.typedef.ushort = ushort
rbx.platform.typedef.uint = uint
rbx.platform.typedef.ulong = ulong
rbx.platform.typedef.cpuid_t = ulong
rbx.platform.typedef.register_t = int
rbx.platform.typedef.int8_t = char
rbx.platform.typedef.uint8_t = uchar
rbx.platform.typedef.int16_t = short
rbx.platform.typedef.uint16_t = ushort
rbx.platform.typedef.int32_t = int
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.intptr_t = long
rbx.platform.typedef.uintptr_t = ulong
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
rbx.platform.typedef.u_int64_t = ulong_long
rbx.platform.typedef.quad_t = long_long
rbx.platform.typedef.u_quad_t = ulong_long
rbx.platform.typedef.qaddr_t = pointer
rbx.platform.typedef.vaddr_t = ulong
rbx.platform.typedef.paddr_t = ulong
rbx.platform.typedef.vsize_t = ulong
rbx.platform.typedef.psize_t = ulong
rbx.platform.typedef.caddr_t = string
rbx.platform.typedef.daddr_t = int
rbx.platform.typedef.daddr32_t = int
rbx.platform.typedef.daddr64_t = long_long
rbx.platform.typedef.dev_t = int
rbx.platform.typedef.fixpt_t = uint
rbx.platform.typedef.gid_t = uint
rbx.platform.typedef.id_t = uint
rbx.platform.typedef.ino_t = uint
rbx.platform.typedef.key_t = long
rbx.platform.typedef.mode_t = uint
rbx.platform.typedef.nlink_t = uint
rbx.platform.typedef.pid_t = int
rbx.platform.typedef.rlim_t = ulong_long
rbx.platform.typedef.segsz_t = int
rbx.platform.typedef.swblk_t = int
rbx.platform.typedef.uid_t = uint
rbx.platform.typedef.useconds_t = uint
rbx.platform.typedef.suseconds_t = int
rbx.platform.typedef.in_addr_t = uint
rbx.platform.typedef.in_port_t = ushort
rbx.platform.typedef.sa_family_t = uchar
rbx.platform.typedef.socklen_t = uint
rbx.platform.typedef.clock_t = int
rbx.platform.typedef.clockid_t = int
rbx.platform.typedef.size_t = ulong
rbx.platform.typedef.ssize_t = long
rbx.platform.typedef.time_t = int
rbx.platform.typedef.timer_t = int
rbx.platform.typedef.off_t = long_long
rbx.platform.typedef.__fd_mask = int
2 changes: 2 additions & 0 deletions lib/ruby/stdlib/ffi/platform/x86_64-openbsd/types.conf
Original file line number Diff line number Diff line change
@@ -82,6 +82,8 @@ rbx.platform.typedef.int32_t = int
rbx.platform.typedef.uint32_t = uint
rbx.platform.typedef.int64_t = long_long
rbx.platform.typedef.uint64_t = ulong_long
rbx.platform.typedef.intptr_t = long
rbx.platform.typedef.uintptr_t = ulong
rbx.platform.typedef.u_int8_t = uchar
rbx.platform.typedef.u_int16_t = ushort
rbx.platform.typedef.u_int32_t = uint
2 changes: 1 addition & 1 deletion rakelib/rubyspec.rake
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ namespace :spec do
desc "Run fast specs that do not spawn many subprocesses"
task :'ruby:fast' do
mspec :compile_mode => "OFF",
:format => 'd',
:format => 's',
:spec_target => ":fast",
:jruby_opts => "-I. --dev"
end
85 changes: 38 additions & 47 deletions spec/jruby.2.3.mspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Default RubySpec/CI settings for JRuby in 2.1 mode.
# Default RubySpec/CI settings for JRuby.

# detect windows platform:
require 'rbconfig'
require 'java'
require 'jruby'
require 'mspec/runner/formatters'

IKVM = java.lang.System.get_property('java.vm.name') =~ /IKVM\.NET/
WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin/
@@ -13,6 +11,15 @@ SPEC_DIR = File.join(File.dirname(__FILE__), 'ruby') unless defined?(SPEC_DIR)
TAGS_DIR = File.join(File.dirname(__FILE__), 'tags') unless defined?(TAGS_DIR)

class MSpecScript
jruby = RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
jruby = File.expand_path("../../bin/#{jruby}", __FILE__)
set :target, jruby

# Command Line specs
set :command_line, [
SPEC_DIR + '/command_line',
]

# Language features specs
set :language, [
SPEC_DIR + '/language',
@@ -23,9 +30,15 @@ class MSpecScript
SPEC_DIR + '/core',
]

# Standard library specs
set :library, [
SPEC_DIR + '/library',
]

set :fast, [
*get(:language),
*get(:core),
*get(:library),

# These all spawn sub-rubies, making them very slow to run
'^' + SPEC_DIR + '/core/process',
@@ -44,6 +57,14 @@ class MSpecScript
'^' + SPEC_DIR + '/language/predefined/data_spec.rb',
]

# Enable features
MSpec.enable_feature :fiber
MSpec.enable_feature :fiber_library
MSpec.enable_feature :continuation_library
MSpec.disable_feature :fork
MSpec.enable_feature :encoding
MSpec.enable_feature :readline

# Filter out ObjectSpace specs if ObjectSpace is disabled
unless JRuby.objectspace
get(:core) << '^' + SPEC_DIR + '/core/objectspace/_id2ref'
@@ -52,44 +73,19 @@ class MSpecScript

if IKVM
# ftype_spec freezes for some reason under IKVM
set(:core, get(:core) + ['^' + SPEC_DIR + '/core/file'])
get(:core) << '^' + SPEC_DIR + '/core/file'
# Process.kill spec hangs
set(:core, get(:core) + ['^' + SPEC_DIR + '/core/process'])
get(:core) << '^' + SPEC_DIR + '/core/process'
end

# An ordered list of the directories containing specs to run
# as the CI process.
set :library, [
SPEC_DIR + '/library',

# excluded for some reason, see JRUBY-4020
'^' + SPEC_DIR + '/library/drb',
'^' + SPEC_DIR + '/library/net',
'^' + SPEC_DIR + '/library/openssl',

# unstable
'^' + SPEC_DIR + '/library/syslog',

# masked out because of load-time errors that can't be tagged
'^' + SPEC_DIR + '/library/net/http',
# prepare exclusion tags
set(:xtags, get(:xtags) || [])
set(:ci_xtags, get(:ci_xtags) || [])

# Module not available
'^' + SPEC_DIR + '/library/digest/bubblebabble'
]

# Command Line specs
set :command_line, [ SPEC_DIR + '/command_line' ]

# Enable features
MSpec.enable_feature :continuation
MSpec.enable_feature :fiber
MSpec.enable_feature :fiber_library
MSpec.enable_feature :encoding
MSpec.enable_feature :encoding_transition
MSpec.enable_feature :readline
get(:xtags) << 'critical'
get(:ci_xtags) << 'critical'

# prepare additional tags for CI
set(:ci_xtags, ["java#{ENV_JAVA['java.specification.version']}"]) # Java version
get(:ci_xtags) << "java#{ENV_JAVA['java.specification.version']}" # Java version

if WINDOWS
# Some specs on Windows will fail in we launch JRuby via
@@ -102,14 +98,15 @@ class MSpecScript
get(:ci_xtags) << 'windows'
end

# If running specs with jit threshold = 1 or force (AOT) compile, additional tags
if JRuby.runtime.instance_config.compile_mode.to_s == "FORCE" ||
JRuby.runtime.instance_config.jit_threshold == 1
get(:ci_xtags) << 'compiler'
end

# This set of files is run by mspec ci
set :ci_files, get(:language) + get(:core) + get(:command_line) + get(:library)

# A list of _all_ optional library specs
set :optional, [get(:ffi)]

set :target, File.dirname(__FILE__) + '/../bin/' + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']

set :backtrace_filter, /mspec\//

set :tags_patterns, [
@@ -119,10 +116,4 @@ class MSpecScript
[%r(^.*/library/), TAGS_DIR + '/ruby/library/'],
[/_spec.rb$/, '_tags.txt']
]

# If running specs with jit threshold = 1 or force (AOT) compile, additional tags
if JRuby.runtime.instance_config.compile_mode.to_s == "FORCE" ||
JRuby.runtime.instance_config.jit_threshold == 1
set(:ci_xtags, (get(:ci_xtags) || []) + ['compiler'])
end
end
48 changes: 26 additions & 22 deletions spec/mspec/lib/mspec/helpers/ruby_exe.rb
Original file line number Diff line number Diff line change
@@ -3,25 +3,25 @@
require 'mspec/helpers/tmp'

# The ruby_exe helper provides a wrapper for invoking the
# same Ruby interpreter as the one running the specs and
# getting the output from running the code. If +code+ is a
# file that exists, it will be run. Otherwise, +code+ should
# be Ruby code that will be run with the -e command line
# option. For example:
# same Ruby interpreter with the same falgs as the one running
# the specs and getting the output from running the code.
# If +code+ is a file that exists, it will be run.
# Otherwise, +code+ should be Ruby code that will be run with
# the -e command line option. For example:
#
# ruby_exe('path/to/some/file.rb')
#
# will be executed as
#
# `#{RUBY_EXE} #{'path/to/some/file.rb'}`
# `#{RUBY_EXE} 'path/to/some/file.rb'`
#
# while
#
# ruby_exe('puts "hello, world."')
#
# will be executed as
#
# `#{RUBY_EXE} -e #{'puts "hello, world."'}`
# `#{RUBY_EXE} -e 'puts "hello, world."'`
#
# The ruby_exe helper also accepts an options hash with three
# keys: :options, :args and :env. For example:
@@ -39,8 +39,8 @@
# If +nil+ is passed for the first argument, the command line
# will be built only from the options hash.
#
# The RUBY_EXE constant can be set explicitly since the value
# is used each time ruby_exe is invoked. The mspec runner script
# The RUBY_EXE constant is setup by mspec automatically
# and is used by ruby_exe and ruby_cmd. The mspec runner script
# will set ENV['RUBY_EXE'] to the name of the executable used
# to invoke the mspec-run script. The value of RUBY_EXE will be
# constructed as follows:
@@ -51,6 +51,7 @@
# 4. $(bindir)/$(RUBY_INSTALL_NAME)
#
# The value will only be used if the file exists and is executable.
# The flags will then be appended to the resulting value.
#
# These 4 ways correspond to the following scenarios:
#
@@ -69,6 +70,11 @@
# some implementation. (E.g. a local build directory.)
# 4. Running the specs against some installed Ruby
# implementation.
#
# Additionally, the flags passed to mspec
# (with -T on the command line or in the config with set :flags)
# will be appended to RUBY_EXE so that the interpreter
# is always called with those flags.

class Object
def ruby_exe_options(option)
@@ -78,11 +84,7 @@ def ruby_exe_options(option)
when :engine
case RUBY_NAME
when 'rbx'
if SpecGuard.ruby_version < "1.9"
"bin/rbx"
else
"bin/rbx -X19"
end
"bin/rbx"
when 'jruby'
"bin/jruby"
when 'maglev'
@@ -104,16 +106,20 @@ def ruby_exe_options(option)

def resolve_ruby_exe
[:env, :engine, :name, :install_name].each do |option|
next unless cmd = ruby_exe_options(option)
exe, *rest = cmd.split(" ")
next unless exe = ruby_exe_options(option)

if File.file?(exe) and File.executable?(exe)
exe = File.expand_path(exe)
exe = exe.tr('/', '\\') if PlatformGuard.windows?
return [exe, *rest].join(" ")
flags = ENV['RUBY_FLAGS']
if flags and !flags.empty?
return exe + ' ' + flags
else
return exe
end
end
end
nil
raise Exception, "Unable to find a suitable ruby executable."
end

def ruby_exe(code, opts = {})
@@ -160,13 +166,11 @@ def ruby_cmd(code, opts = {})
body = "-e #{code.inspect}"
end

[RUBY_EXE, ENV['RUBY_FLAGS'], opts[:options], body, opts[:args]].compact.join(' ')
[RUBY_EXE, opts[:options], body, opts[:args]].compact.join(' ')
end

unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE
require 'rbconfig'

RUBY_EXE = resolve_ruby_exe or
raise Exception, "Unable to find a suitable ruby executable."
RUBY_EXE = resolve_ruby_exe
end
end
57 changes: 23 additions & 34 deletions spec/mspec/spec/helpers/ruby_exe_spec.rb
Original file line number Diff line number Diff line change
@@ -37,6 +37,11 @@ class RubyExeSpecs
@script.ruby_exe_options(:engine).should == 'bin/jruby'
end

it "returns 'bin/rbx' when passed :engine, RUBY_NAME is 'rbx'" do
Object.const_set :RUBY_NAME, 'rbx'
@script.ruby_exe_options(:engine).should == 'bin/rbx'
end

it "returns 'ir' when passed :engine and RUBY_NAME is 'ironruby'" do
Object.const_set :RUBY_NAME, 'ironruby'
@script.ruby_exe_options(:engine).should == 'ir'
@@ -63,30 +68,6 @@ class RubyExeSpecs
name = File.join RbConfig::CONFIG['bindir'], bin
@script.ruby_exe_options(:install_name).should == name
end

describe "under Rubinius" do
before :each do
@ruby_version = RUBY_VERSION
end

after :each do
Object.const_set :RUBY_VERSION, @ruby_version
end

it "returns 'bin/rbx' when passed :engine, RUBY_NAME is 'rbx' and RUBY_VERSION < 1.9" do
Object.const_set :RUBY_VERSION, "1.8.7"
Object.const_set :RUBY_NAME, 'rbx'

@script.ruby_exe_options(:engine).should == 'bin/rbx'
end

it "returns 'bin/rbx -X19' when passed :engine, RUBY_NAME is 'rbx' and RUBY_VERSION >= 1.9" do
Object.const_set :RUBY_VERSION, "1.9.2"
Object.const_set :RUBY_NAME, 'rbx'

@script.ruby_exe_options(:engine).should == 'bin/rbx -X19'
end
end
end

describe "#resolve_ruby_exe" do
@@ -114,16 +95,29 @@ class RubyExeSpecs
end

it "expands the path portion of the result of #ruby_exe_options" do
@script.should_receive(:ruby_exe_options).and_return("#{@name} -Xfoo")
@script.should_receive(:ruby_exe_options).and_return("#{@name}")
File.should_receive(:file?).with(@name).and_return(true)
File.should_receive(:executable?).with(@name).and_return(true)
File.should_receive(:expand_path).with(@name).and_return("/usr/bin/#{@name}")
@script.resolve_ruby_exe.should == "/usr/bin/#{@name} -Xfoo"
@script.resolve_ruby_exe.should == "/usr/bin/#{@name}"
end

it "adds the flags after the executable" do
@name = 'bin/rbx'
@script.should_receive(:ruby_exe_options).and_return(@name)
File.should_receive(:file?).with(@name).and_return(true)
File.should_receive(:executable?).with(@name).and_return(true)
File.should_receive(:expand_path).with(@name).and_return(@name)

ENV.should_receive(:[]).with("RUBY_FLAGS").and_return('-X19')
@script.resolve_ruby_exe.should == 'bin/rbx -X19'
end

it "returns nil if no exe is found" do
it "raises an exception if no exe is found" do
File.should_receive(:file?).at_least(:once).and_return(false)
@script.resolve_ruby_exe.should be_nil
lambda {
@script.resolve_ruby_exe
}.should raise_error(Exception)
end
end

@@ -132,11 +126,8 @@ class RubyExeSpecs
@verbose = $VERBOSE
$VERBOSE = nil

@ruby_flags = ENV["RUBY_FLAGS"]
ENV["RUBY_FLAGS"] = "-w -Q"

@ruby_exe = Object.const_get :RUBY_EXE
Object.const_set :RUBY_EXE, 'ruby_spec_exe'
Object.const_set :RUBY_EXE, 'ruby_spec_exe -w -Q'

@file = "some/ruby/file.rb"
@code = %(some "real" 'ruby' code)
@@ -146,7 +137,6 @@ class RubyExeSpecs

after :all do
Object.const_set :RUBY_EXE, @ruby_exe
ENV["RUBY_FLAGS"] = @ruby_flags
$VERBOSE = @verbose
end

@@ -201,7 +191,6 @@ class RubyExeSpecs
it "preserves the values of existing ENV keys" do
ENV["ABC"] = "123"
ENV.stub(:[])
ENV.should_receive(:[]).with("RUBY_FLAGS")
ENV.should_receive(:[]).with("ABC")
@script.ruby_exe nil, :env => { :ABC => "xyz" }
end
4 changes: 0 additions & 4 deletions spec/ruby/appveyor.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,3 @@ build: off
test_script:
- SET CHECK_LEAKS=true
- ../mspec/bin/mspec -ff command_line language core library
branches:
only:
- master
- /^try/
2 changes: 1 addition & 1 deletion spec/ruby/command_line/dash_x_spec.rb
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
end

it "runs code after the first /\#!.*ruby.*/-ish line in target file" do
result = `#{RUBY_EXE} -x #{@file}`
result = ruby_exe(@file, options: '-x')
result.should == "success\n"
end

34 changes: 24 additions & 10 deletions spec/ruby/core/argf/read_nonblock_spec.rb
Original file line number Diff line number Diff line change
@@ -49,19 +49,33 @@
stdin.should == @chunk1
end

it 'raises IO::EAGAINWaitReadable when STDIN is empty' do
input = 'ARGF.read_nonblock(4) rescue print $!.class'
stdin = IO.popen([RUBY_EXE, '-e', input], "r+", &:read)
context "with STDIN" do
before do
@r, @w = IO.pipe
@stdin = $stdin
$stdin = @r
end

stdin.should == 'IO::EAGAINWaitReadable'
end
after do
$stdin = @stdin
@w.close
@r.close unless @r.closed?
end

ruby_version_is "2.3" do
it 'returns :wait_readable when the :exception is set to false' do
input = 'p ARGF.read_nonblock(4, nil, exception: false)'
stdin = IO.popen([RUBY_EXE, '-e', input], "r+", &:read)
it 'raises IO::EAGAINWaitReadable when empty' do
argf ['-'] do
lambda {
@argf.read_nonblock(4)
}.should raise_error(IO::EAGAINWaitReadable)
end
end

stdin.strip.should == ':wait_readable'
ruby_version_is "2.3" do
it 'returns :wait_readable when the :exception is set to false' do
argf ['-'] do
@argf.read_nonblock(4, nil, exception: false).should == :wait_readable
end
end
end
end
end
8 changes: 4 additions & 4 deletions spec/ruby/core/io/close_spec.rb
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@
describe "IO#close on an IO.popen stream" do

it "clears #pid" do
io = IO.popen "#{RUBY_EXE} -e 'r = loop{puts \"y\"; 0} rescue 1; exit r'", 'r'
io = IO.popen ruby_cmd('r = loop{puts "y"; 0} rescue 1; exit r'), 'r'

io.pid.should_not == 0

@@ -60,19 +60,19 @@
end

it "sets $?" do
io = IO.popen "#{RUBY_EXE} -e 'exit 0'", 'r'
io = IO.popen ruby_cmd('exit 0'), 'r'
io.close

$?.exitstatus.should == 0

io = IO.popen "#{RUBY_EXE} -e 'exit 1'", 'r'
io = IO.popen ruby_cmd('exit 1'), 'r'
io.close

$?.exitstatus.should == 1
end

it "waits for the child to exit" do
io = IO.popen "#{RUBY_EXE} -e 'r = loop{puts \"y\"; 0} rescue 1; exit r'", 'r'
io = IO.popen ruby_cmd('r = loop{puts "y"; 0} rescue 1; exit r'), 'r'
io.close

$?.exitstatus.should_not == 0
2 changes: 1 addition & 1 deletion spec/ruby/core/io/pid_spec.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@

describe "IO#pid" do
before :each do
@io = IO.popen RUBY_EXE, "r+"
@io = IO.popen ruby_cmd('STDIN.read'), "r+"
end

after :each do
46 changes: 23 additions & 23 deletions spec/ruby/core/io/popen_spec.rb
Original file line number Diff line number Diff line change
@@ -13,17 +13,17 @@
end

it "returns an open IO" do
@io = IO.popen("#{RUBY_EXE} -e exit", "r")
@io = IO.popen(ruby_cmd('exit'), "r")
@io.closed?.should be_false
end

it "reads a read-only pipe" do
@io = IO.popen("#{RUBY_EXE} -e 'puts \"foo\"'", "r")
@io = IO.popen(ruby_cmd('puts "foo"'), "r")
@io.read.should == "foo\n"
end

it "raises IOError when writing a read-only pipe" do
@io = IO.popen("#{RUBY_EXE} -e 'puts \"foo\"'", "r")
@io = IO.popen(ruby_cmd('puts "foo"'), "r")
lambda { @io.write('foo') }.should raise_error(IOError)
end
end
@@ -40,33 +40,33 @@
end

it "sees an infinitely looping subprocess exit when read pipe is closed" do
io = IO.popen "#{RUBY_EXE} -e 'r = loop{puts \"y\"; 0} rescue 1; exit r'", 'r'
io = IO.popen ruby_cmd('r = loop{puts "y"; 0} rescue 1; exit r'), 'r'
io.close

$?.exitstatus.should_not == 0
end

it "writes to a write-only pipe" do
@io = IO.popen("#{RUBY_EXE} -e 'IO.copy_stream(STDIN,STDOUT)' > #{@fname}", "w")
@io = IO.popen(ruby_cmd('IO.copy_stream(STDIN,STDOUT)', args: "> #{@fname}"), "w")
@io.write("bar")
@io.close

@fname.should have_data("bar")
end

it "raises IOError when reading a write-only pipe" do
@io = IO.popen("#{RUBY_EXE} -e 'IO.copy_stream(STDIN,STDOUT)'", "w")
@io = IO.popen(ruby_cmd('IO.copy_stream(STDIN,STDOUT)'), "w")
lambda { @io.read }.should raise_error(IOError)
end

it "reads and writes a read/write pipe" do
@io = IO.popen("#{RUBY_EXE} -e 'IO.copy_stream(STDIN,STDOUT)'", "r+")
@io = IO.popen(ruby_cmd('IO.copy_stream(STDIN,STDOUT)'), "r+")
@io.write("bar")
@io.read(3).should == "bar"
end

it "waits for the child to finish" do
@io = IO.popen("#{RUBY_EXE} -e 'IO.copy_stream(STDIN,STDOUT)' > #{@fname}", "w")
@io = IO.popen(ruby_cmd('IO.copy_stream(STDIN,STDOUT)', args: "> #{@fname}"), "w")
@io.write("bar")
@io.close

@@ -76,7 +76,7 @@
end

it "does not throw an exception if child exited and has been waited for" do
@io = IO.popen("#{RUBY_EXE} -e sleep")
@io = IO.popen(ruby_cmd('sleep'))
Process.kill "KILL", @io.pid
@io.close
platform_is_not :windows do
@@ -88,14 +88,14 @@
end

it "returns an instance of a subclass when called on a subclass" do
@io = IOSpecs::SubIO.popen("#{RUBY_EXE} -e exit", "r")
@io = IOSpecs::SubIO.popen(ruby_cmd('exit'), "r")
@io.should be_an_instance_of(IOSpecs::SubIO)
end

it "coerces mode argument with #to_str" do
mode = mock("mode")
mode.should_receive(:to_str).and_return("r")
@io = IO.popen("#{RUBY_EXE} -e 'exit 0'", mode)
@io = IO.popen(ruby_cmd('exit 0'), mode)
end
end

@@ -110,29 +110,29 @@

describe "with a block" do
it "yields an open IO to the block" do
IO.popen("#{RUBY_EXE} -e exit", "r") do |io|
IO.popen(ruby_cmd('exit'), "r") do |io|
io.closed?.should be_false
end
end

it "yields an instance of a subclass when called on a subclass" do
IOSpecs::SubIO.popen("#{RUBY_EXE} -e exit", "r") do |io|
IOSpecs::SubIO.popen(ruby_cmd('exit'), "r") do |io|
io.should be_an_instance_of(IOSpecs::SubIO)
end
end

it "closes the IO after yielding" do
io = IO.popen("#{RUBY_EXE} -e exit", "r") { |io| io }
io = IO.popen(ruby_cmd('exit'), "r") { |io| io }
io.closed?.should be_true
end

it "allows the IO to be closed inside the block" do
io = IO.popen("#{RUBY_EXE} -e exit", 'r') { |io| io.close; io }
io = IO.popen(ruby_cmd('exit'), 'r') { |io| io.close; io }
io.closed?.should be_true
end

it "returns the value of the block" do
IO.popen("#{RUBY_EXE} -e exit", "r") { :hello }.should == :hello
IO.popen(ruby_cmd('exit'), "r") { :hello }.should == :hello
end
end

@@ -155,44 +155,44 @@

with_feature :encoding do
it "has the given external encoding" do
@io = IO.popen("#{RUBY_EXE} -e exit", external_encoding: Encoding::EUC_JP)
@io = IO.popen(ruby_cmd('exit'), external_encoding: Encoding::EUC_JP)
@io.external_encoding.should == Encoding::EUC_JP
end

it "has the given internal encoding" do
@io = IO.popen("#{RUBY_EXE} -e exit", internal_encoding: Encoding::EUC_JP)
@io = IO.popen(ruby_cmd('exit'), internal_encoding: Encoding::EUC_JP)
@io.internal_encoding.should == Encoding::EUC_JP
end

it "sets the internal encoding to nil if it's the same as the external encoding" do
@io = IO.popen("#{RUBY_EXE} -e exit", external_encoding: Encoding::EUC_JP,
@io = IO.popen(ruby_cmd('exit'), external_encoding: Encoding::EUC_JP,
internal_encoding: Encoding::EUC_JP)
@io.internal_encoding.should be_nil
end
end

context "with a leading ENV Hash" do
it "accepts a single String command" do
IO.popen({"FOO" => "bar"}, "#{RUBY_EXE} -e 'puts ENV[\"FOO\"]'") do |io|
IO.popen({"FOO" => "bar"}, ruby_cmd('puts ENV["FOO"]')) do |io|
io.read.should == "bar\n"
end
end

it "accepts a single String command, and an IO mode" do
IO.popen({"FOO" => "bar"}, "#{RUBY_EXE} -e 'puts ENV[\"FOO\"]'", "r") do |io|
IO.popen({"FOO" => "bar"}, ruby_cmd('puts ENV["FOO"]'), "r") do |io|
io.read.should == "bar\n"
end
end

it "accepts a single String command with a trailing Hash of Process.exec options" do
IO.popen({"FOO" => "bar"}, "#{RUBY_EXE} -e 'STDERR.puts ENV[\"FOO\"]'",
IO.popen({"FOO" => "bar"}, ruby_cmd('STDERR.puts ENV["FOO"]'),
err: [:child, :out]) do |io|
io.read.should == "bar\n"
end
end

it "accepts a single String command with a trailing Hash of Process.exec options, and an IO mode" do
IO.popen({"FOO" => "bar"}, "#{RUBY_EXE} -e 'STDERR.puts ENV[\"FOO\"]'", "r",
IO.popen({"FOO" => "bar"}, ruby_cmd('STDERR.puts ENV["FOO"]'), "r",
err: [:child, :out]) do |io|
io.read.should == "bar\n"
end
2 changes: 1 addition & 1 deletion spec/ruby/core/kernel/chop_spec.rb
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
it_behaves_like :kernel_chop, "Kernel.chop"
end

describe "#chop" do
describe "Kernel#chop" do
it_behaves_like :kernel_chop_private, :chop

it_behaves_like :kernel_chop, "chop"
8 changes: 4 additions & 4 deletions spec/ruby/core/kernel/system_spec.rb
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@
end

it "returns true when the command exits with a zero exit status" do
@object.system("#{RUBY_EXE} -e 'exit 0'").should == true
@object.system(ruby_cmd('exit 0')).should == true
end

it "returns false when the command exits with a non-zero exit status" do
@object.system("#{RUBY_EXE} -e 'exit 1'").should == false
@object.system(ruby_cmd('exit 1')).should == false
end

it "returns nil when command execution fails" do
@@ -63,9 +63,9 @@

platform_is :windows do
it "runs commands starting with any number of @ using shell" do
`#{RUBY_EXE} -e "p system 'does_not_exist'" 2>NUL`.chomp.should == "nil"
`#{ruby_cmd("p system 'does_not_exist'")} 2>NUL`.chomp.should == "nil"
@object.system('@does_not_exist').should == false
@object.system("@@@#{RUBY_EXE} -e 'exit 0'").should == true
@object.system("@@@#{ruby_cmd('exit 0')}").should == true
end
end
end
6 changes: 4 additions & 2 deletions spec/ruby/core/math/lgamma_spec.rb
Original file line number Diff line number Diff line change
@@ -5,8 +5,10 @@
Math.lgamma(0).should == [infinity_value, 1]
end

it "returns [Infinity, 1] when passed -1" do
Math.lgamma(-1).should == [infinity_value, 1]
platform_is_not :windows do
it "returns [Infinity, 1] when passed -1" do
Math.lgamma(-1).should == [infinity_value, 1]
end
end

ruby_version_is "2.4" do
1 change: 1 addition & 0 deletions spec/ruby/core/objectspace/each_object_spec.rb
Original file line number Diff line number Diff line change
@@ -133,6 +133,7 @@ class ObjectSpaceSpecEachOtherObject; end
thread = Thread.new {}
thread.thread_variable_set(:object_space_thread_local, ObjectSpaceFixtures::ObjectToBeFound.new(:thread_local))
ObjectSpaceFixtures.to_be_found_symbols.should include(:thread_local)
thread.join
end

it "finds an object stored in a fiber local" do
4 changes: 3 additions & 1 deletion spec/ruby/core/process/fixtures/common.rb
Original file line number Diff line number Diff line change
@@ -43,7 +43,9 @@ def initialize(scenario=nil, ruby_exe=nil)

@thread = Thread.new do
Thread.current.abort_on_exception = true
args = [@pid_file, scenario, ruby_exe]
args = [@pid_file]
args << scenario if scenario
args << ruby_exe.inspect if scenario and ruby_exe
@result = ruby_exe @script, args: args
end
Thread.pass while @thread.status and !File.exist?(@pid_file)
2 changes: 2 additions & 0 deletions spec/ruby/core/process/fixtures/kill.rb
Original file line number Diff line number Diff line change
@@ -38,6 +38,8 @@
signal = %["-TERM"]
when "group_full_string"
signal = %["-SIGTERM"]
else
raise "unknown scenario: #{scenario.inspect}"
end

cmd = %[#{ruby_exe} -e 'Process.kill(#{signal}, #{process})']
2 changes: 1 addition & 1 deletion spec/ruby/language/predefined_spec.rb
Original file line number Diff line number Diff line change
@@ -839,7 +839,7 @@ def obj.foo2; yield; end
end

it "is thread-local" do
system("#{RUBY_EXE} -e 'exit 0'")
system(ruby_cmd('exit 0'))
Thread.new { $?.should be_nil }.join
end
end
7 changes: 5 additions & 2 deletions spec/ruby/library/socket/addrinfo/canonname_spec.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,10 @@

it "returns the canonical name for a host" do
canonname = @addrinfos.map { |a| a.canonname }.find { |name| name and name.include?("localhost") }
canonname.should include("localhost")
if canonname
canonname.should include("localhost")
else
canonname.should == nil
end
end

end
25 changes: 25 additions & 0 deletions spec/ruby/library/socket/addrinfo/inspect_sockaddr_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require File.expand_path('../../../../spec_helper', __FILE__)

require 'socket'

describe 'Addrinfo#inspect_sockaddr' do
it 'IPv4' do
Addrinfo.tcp('127.0.0.1', 80).inspect_sockaddr.should == '127.0.0.1:80'
Addrinfo.tcp('127.0.0.1', 0).inspect_sockaddr.should == '127.0.0.1'
end

it 'IPv6' do
Addrinfo.tcp('::1', 80).inspect_sockaddr.should == '[::1]:80'
Addrinfo.tcp('::1', 0).inspect_sockaddr.should == '::1'
ip = '2001:0db8:85a3:0000:0000:8a2e:0370:7334'
Addrinfo.tcp(ip, 80).inspect_sockaddr.should == '[2001:db8:85a3::8a2e:370:7334]:80'
Addrinfo.tcp(ip, 0).inspect_sockaddr.should == '2001:db8:85a3::8a2e:370:7334'
end

platform_is_not :windows do
it 'UNIX' do
Addrinfo.unix('/tmp/sock').inspect_sockaddr.should == '/tmp/sock'
Addrinfo.unix('rel').inspect_sockaddr.should == 'UNIX rel'
end
end
end
48 changes: 25 additions & 23 deletions spec/ruby/library/socket/addrinfo/unix_path_spec.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
require File.expand_path('../../../../spec_helper', __FILE__)
require 'socket'

describe "Addrinfo#unix_path" do
describe "for an ipv4 socket" do
platform_is_not :windows do
describe "Addrinfo#unix_path" do
describe "for an ipv4 socket" do

before :each do
@addrinfo = Addrinfo.tcp("127.0.0.1", 80)
end

it "raises an exception" do
lambda { @addrinfo.unix_path }.should raise_error(SocketError)
end

end
before :each do
@addrinfo = Addrinfo.tcp("127.0.0.1", 80)
end

describe "for an ipv6 socket" do
before :each do
@addrinfo = Addrinfo.tcp("::1", 80)
end
it "raises an exception" do
lambda { @addrinfo.unix_path }.should raise_error(SocketError)
end

it "raises an exception" do
lambda { @addrinfo.unix_path }.should raise_error(SocketError)
end
end

platform_is_not :windows do
describe "for a unix socket" do
describe "for an ipv6 socket" do
before :each do
@addrinfo = Addrinfo.unix("/tmp/sock")
@addrinfo = Addrinfo.tcp("::1", 80)
end

it "returns the socket path" do
@addrinfo.unix_path.should == "/tmp/sock"
it "raises an exception" do
lambda { @addrinfo.unix_path }.should raise_error(SocketError)
end
end

platform_is_not :windows do
describe "for a unix socket" do
before :each do
@addrinfo = Addrinfo.unix("/tmp/sock")
end

it "returns the socket path" do
@addrinfo.unix_path.should == "/tmp/sock"
end
end
end
end
6 changes: 1 addition & 5 deletions spec/ruby/library/socket/fixtures/classes.rb
Original file line number Diff line number Diff line change
@@ -43,11 +43,7 @@ def self.str_port
end

def self.local_port
@base ||= $$
@base += 1
local_port = (@base % (0xffff-1024)) + 1024
local_port += 1 if local_port == port
local_port
find_available_port
end

def self.sockaddr_in(port, host)
19 changes: 13 additions & 6 deletions spec/ruby/library/socket/option/linger_spec.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)

option_pack = 'i*'
platform_is :windows do
option_pack = 's*'
end

describe "Socket::Option.linger" do
it "creates a new Socket::Option for SO_LINGER" do
so = Socket::Option.linger(1, 10)
so.should be_an_instance_of(Socket::Option)
so.family.should == Socket::Constants::AF_UNSPEC
so.level.should == Socket::Constants::SOL_SOCKET
so.optname.should == Socket::Constants::SO_LINGER
so.data.should == [1, 10].pack('i*')
so.data.should == [1, 10].pack(option_pack)
end

it "accepts boolean as onoff argument" do
so = Socket::Option.linger(false, 0)
so.data.should == [0, 0].pack('i*')
so.data.should == [0, 0].pack(option_pack)

so = Socket::Option.linger(true, 1)
so.data.should == [1, 1].pack('i*')
so.data.should == [1, 1].pack(option_pack)
end
end

@@ -48,8 +53,10 @@
lambda { so.linger }.should raise_error(TypeError)
end

it "raises TypeError if option has not good size" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)
lambda { so.linger }.should raise_error(TypeError)
platform_is_not :windows do
it "raises TypeError if option has not good size" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)
lambda { so.linger }.should raise_error(TypeError)
end
end
end
2 changes: 1 addition & 1 deletion spec/ruby/shared/process/exec.rb
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@
f = File.open("#{@name}", "w+")
child_fd = f.fileno + 1
File.open("#{@child_fd_file}", "w") { |io| io.print child_fd }
exec "#{RUBY_EXE}", "#{map_fd_fixture}", child_fd.to_s, { child_fd => f }
exec "#{ruby_cmd(map_fd_fixture)} \#{child_fd}", { child_fd => f }
EOC

ruby_exe(cmd, escape: true)
109 changes: 51 additions & 58 deletions spec/ruby/shared/process/spawn.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
newline = "\n"
platform_is :windows do
newline = "\r\n"
end

describe :process_spawn_does_not_close_std_streams, shared: true do
platform_is_not :windows do
it "does not close STDIN" do
code = "STDOUT.puts STDIN.read(0).inspect"
cmd = "Process.wait spawn(#{ruby_cmd(code).inspect}, #{@options.inspect})"
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data(%[""#{newline}])
end

it "does not close STDOUT" do
code = "STDOUT.puts 'hello'"
cmd = "Process.wait spawn(#{ruby_cmd(code).inspect}, #{@options.inspect})"
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data("hello#{newline}")
end

it "does not close STDERR" do
code = "STDERR.puts 'hello'"
cmd = "Process.wait spawn(#{ruby_cmd(code).inspect}, #{@options.inspect})"
ruby_exe(cmd, args: "2> #{@output}")
@output.should have_data("hello#{newline}")
end
end
end

describe :process_spawn, shared: true do
before :each do
@name = tmp("kernel_spawn.txt")
@@ -7,11 +37,6 @@
rm_r @name
end

newline = "\n"
platform_is :windows do
newline = "\r\n"
end

it "executes the given command" do
lambda { Process.wait @object.spawn("echo spawn") }.should output_to_fd("spawn\n")
end
@@ -225,20 +250,20 @@

# :unsetenv_others

# Use the system ruby when the environment is empty as it could easily break launchers.

it "unsets other environment variables when given a true :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('ruby', fixture(__FILE__, "env.rb"), unsetenv_others: true)
end.should output_to_fd("")
end
platform_is_not :windows do
it "unsets other environment variables when given a true :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn(ruby_cmd(fixture(__FILE__, "env.rb")), unsetenv_others: true)
end.should output_to_fd("")
end

it "unsets other environment variables when given a non-false :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('ruby', fixture(__FILE__, "env.rb"), unsetenv_others: :true)
end.should output_to_fd("")
it "unsets other environment variables when given a non-false :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn(ruby_cmd(fixture(__FILE__, "env.rb")), unsetenv_others: :true)
end.should output_to_fd("")
end
end

it "does not unset other environment variables when given a false :unsetenv_others option" do
@@ -255,10 +280,12 @@
end.should output_to_fd("BAR")
end

it "does not unset environment variables included in the environment hash" do
lambda do
Process.wait @object.spawn({"FOO" => "BAR"}, 'ruby', fixture(__FILE__, "env.rb"), unsetenv_others: true)
end.should output_to_fd("BAR")
platform_is_not :windows do
it "does not unset environment variables included in the environment hash" do
lambda do
Process.wait @object.spawn({"FOO" => "BAR"}, ruby_cmd(fixture(__FILE__, "env.rb")), unsetenv_others: true)
end.should output_to_fd("BAR")
end
end

# :pgroup
@@ -463,7 +490,6 @@
before :each do
@output = tmp("spawn_close_others_true")
@options = { close_others: true }
@command = %[Process.wait spawn("#{RUBY_EXE}", "-e", "%s", #{@options.inspect})]
end

after :each do
@@ -483,30 +509,13 @@
end
end

it "does not close STDIN" do
cmd = @command % ["STDOUT.puts STDIN.read(0).inspect"]
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data(%[""#{newline}])
end

it "does not close STDOUT" do
cmd = @command % ["STDOUT.puts 'hello'"]
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data("hello#{newline}")
end

it "does not close STDERR" do
cmd = @command % ["STDERR.puts 'hello'"]
ruby_exe(cmd, args: "2> #{@output}")
@output.should have_data("hello#{newline}")
end
it_should_behave_like :process_spawn_does_not_close_std_streams
end

context "when passed close_others: false" do
before :each do
@output = tmp("spawn_close_others_false")
@options = { close_others: false }
@command = %[Process.wait spawn("#{RUBY_EXE}", "-e", "%s", #{@options.inspect})]
end

after :each do
@@ -543,23 +552,7 @@
end
end

it "does not close STDIN" do
cmd = @command % ["STDOUT.puts STDIN.read(0).inspect"]
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data(%[""#{newline}])
end

it "does not close STDOUT" do
cmd = @command % ["STDOUT.puts 'hello'"]
ruby_exe(cmd, args: "> #{@output}")
@output.should have_data("hello#{newline}")
end

it "does not close STDERR" do
cmd = @command % ["STDERR.puts 'hello'"]
ruby_exe(cmd, args: "2> #{@output}")
@output.should have_data("hello#{newline}")
end
it_should_behave_like :process_spawn_does_not_close_std_streams
end

# error handling
1 change: 1 addition & 0 deletions spec/tags/ruby/command_line/dash_x_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
windows:The -x command line option runs code after the first /#!.*ruby.*/-ish line in target file
fails:The -x command line option runs code after the first /#!.*ruby.*/-ish line in target file
1 change: 1 addition & 0 deletions spec/tags/ruby/core/argf/read_nonblock_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fails:ARGF.read_nonblock treats second nil argument as no output buffer
fails:ARGF.read_nonblock returns :wait_readable when the :exception is set to false
fails:ARGF.read_nonblock with STDIN returns :wait_readable when the :exception is set to false
2 changes: 2 additions & 0 deletions spec/tags/ruby/core/process/spawn_tags.txt
Original file line number Diff line number Diff line change
@@ -71,3 +71,5 @@ windows:Process.spawn when passed close_others: false does not close STDIN
windows:Process.spawn when passed close_others: false does not close STDOUT
windows:Process.spawn when passed close_others: false does not close STDERR
windows:Process.spawn with Integer option keys maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value
fails:Process.spawn unsets other environment variables when given a true :unsetenv_others option
fails:Process.spawn unsets other environment variables when given a non-false :unsetenv_others option
6 changes: 6 additions & 0 deletions spec/tags/ruby/library/continuation/call_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fails:Continuation#call using #call transfers execution to right after the Kernel.callcc block
fails:Continuation#call arguments given to #call (or nil) are returned by the Kernel.callcc block (as Array unless only one object)
fails:Continuation#call #[] is an alias for #call
fails:Continuation#call closes over lexical environments
fails:Continuation#call escapes an inner ensure block
fails:Continuation#call executes an outer ensure block
17 changes: 17 additions & 0 deletions spec/tags/ruby/library/continuation/kernel/callcc_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
fails:Kernel#callcc is a private method
fails:Kernel#callcc is possible to exit a loop like a break
fails:Kernel#callcc is possible to call a continuation multiple times
fails:Kernel#callcc returns the results of a block if continuation is not called
fails:Kernel#callcc returns the results of continuation once called
fails:Kernel#callcc returns the arguments to call
fails:Kernel#callcc preserves changes to block-local scope
fails:Kernel#callcc preserves changes to method-local scope
fails:Kernel#callcc raises a LocalJumpError if callcc is not given a block
fails:Kernel.callcc is possible to exit a loop like a break
fails:Kernel.callcc is possible to call a continuation multiple times
fails:Kernel.callcc returns the results of a block if continuation is not called
fails:Kernel.callcc returns the results of continuation once called
fails:Kernel.callcc returns the arguments to call
fails:Kernel.callcc preserves changes to block-local scope
fails:Kernel.callcc preserves changes to method-local scope
fails:Kernel.callcc raises a LocalJumpError if callcc is not given a block
1 change: 1 addition & 0 deletions spec/tags/ruby/library/etc/getgrgid_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
windows:Etc.getgrgid returns nil
critical:Etc.getgrgid can be called safely by multiple threads
1 change: 1 addition & 0 deletions spec/tags/ruby/library/net/http/http/started_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Net::HTTP#started? returns false when self has been stopped again
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/afamily_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#afamily for a unix socket returns Socket::AF_UNIX
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/canonname_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#canonname returns the canonical name for a host
48 changes: 48 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/initialize_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
fails:Addrinfo#initialize with a sockaddr string without a family stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr string without a family stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr string without a family returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr string without a family returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr string without a family returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr string without a family returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr string with a family given stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family given stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family given returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr string with a family given returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr string with a family given returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr string with a family given returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr string with a family and socket type stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family and socket type stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr string with a family and socket type returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the specified socket type
fails:Addrinfo#initialize with a sockaddr string with a family, socket type and protocol returns the specified protocol
fails:Addrinfo#initialize with a sockaddr array without a family stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr array without a family stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr array without a family returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr array without a family returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr array without a family returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr array without a family returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr array with a family given stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family given stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family given returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr array with a family given returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr array with a family given returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr array with a family given returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr array with a family and socket type stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family and socket type stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr array with a family and socket type returns the 0 protocol
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol stores the ip address from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol stores the port number from the sockaddr
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the Socket::UNSPEC pfamily
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the INET6 afamily
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the 0 socket type
fails:Addrinfo#initialize with a sockaddr array with a family, socket type and protocol returns the specified protocol
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo#inspect_sockaddr IPv6
fails:Addrinfo#inspect_sockaddr UNIX
2 changes: 2 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/ip_address_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo#ip_address for an ipv6 socket returns the ip address
fails:Addrinfo#ip_address for a unix socket raises an exception
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/ip_port_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ip_port for a unix socket raises an exception
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/ip_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ip? for a unix socket returns Socket::AF_INET6
2 changes: 2 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/ip_unpack_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo#ip_unpack for an ipv6 socket returns the ip address and port pair
fails:Addrinfo#ip_unpack for a unix socket raises an exception
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ipv4_loopback? for a unix socket returns false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo#ipv4_multicast? for an ipv6 socket returns false for the loopback address
fails:Addrinfo#ipv4_multicast? for a unix socket returns false
4 changes: 4 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/ipv4_private_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fails:Addrinfo#ipv4_private? for an ipv4 socket returns true for a private address
fails:Addrinfo#ipv4_private? for an ipv4 socket returns false for a public address
fails:Addrinfo#ipv4_private? for an ipv6 socket returns false
fails:Addrinfo#ipv4_private? for a unix socket returns false
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/ipv4_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ipv4? for a unix socket returns false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ipv6_loopback? for a unix socket returns false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo#ipv6_multicast? for an ipv4 socket returns true for the loopback address
fails:Addrinfo#ipv6_multicast? for a unix socket returns false
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/ipv6_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#ipv6? for a unix socket returns false
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/pfamily_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#pfamily for a unix socket returns Socket::PF_UNIX
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/protocol_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#protocol for a unix socket returns 0
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/socktype_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#socktype for a unix socket returns Socket::SOCK_STREAM
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/tcp_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo.tcp creates a addrinfo for a tcp socket
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/to_s_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#to_s for a unix socket returns a sockaddr packed structure
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo#to_sockaddr for a unix socket returns a sockaddr packed structure
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/addrinfo/udp_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Addrinfo.udp creates a addrinfo for a tcp socket
3 changes: 3 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/unix_path_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:Addrinfo#unix_path for an ipv4 socket raises an exception
fails:Addrinfo#unix_path for an ipv6 socket raises an exception
fails:Addrinfo#unix_path for a unix socket returns the socket path
2 changes: 2 additions & 0 deletions spec/tags/ruby/library/socket/addrinfo/unix_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Addrinfo.unix creates a addrinfo for a unix socket
fails:Addrinfo#unix? for a unix socket returns true
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/option/bool_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Socket::Option#bool raises TypeError if option has not good size
1 change: 1 addition & 0 deletions spec/tags/ruby/library/socket/option/inspect_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Socket::Option#inspect correctly returns SO_LINGER value
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
fails:Socket::TCPServer.accept_nonblock accepts non blocking connections
fails:Socket::TCPServer.accept_nonblock without a connected client raises error
fails:Socket::TCPServer.accept_nonblock without a connected client returns :wait_readable in exceptionless mode
2 changes: 2 additions & 0 deletions spec/tags/ruby/library/socket/tcpserver/sysaccept_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:TCPServer#sysaccept blocks if no connections
fails:TCPServer#sysaccept returns file descriptor of an accepted connection
1 change: 1 addition & 0 deletions spec/tags/ruby/library/time/to_date_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#to_date yields date with default Calendar reform day
4 changes: 3 additions & 1 deletion spec/truffle/tags/core/argf/read_nonblock_tags.txt
Original file line number Diff line number Diff line change
@@ -14,4 +14,6 @@ fails:ARGF.read_nonblock reads up to the given bytes from a file when a file and
fails:ARGF.read_nonblock returns :wait_readable when the :exception is set to false
fails:ARGF.read_nonblock when using multiple files reads up to the given amount of bytes from the first file
fails:ARGF.read_nonblock when using multiple files returns an empty String when reading after having read the first file in its entirety
graalvm:ARGF.read_nonblock raises IO::EAGAINWaitReadable when STDIN is empty
fails:ARGF.read_nonblock raises IO::EAGAINWaitReadable when STDIN is empty
fails:ARGF.read_nonblock with STDIN raises IO::EAGAINWaitReadable when empty
fails:ARGF.read_nonblock with STDIN returns :wait_readable when the :exception is set to false
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/io/close_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
fails:IO#close does not raise anything when self was already closed
fails:IO#close does nothing if already closed
slow:IO#close on an IO.popen stream clears #pid
slow:IO#close on an IO.popen stream sets $?
slow:IO#close on an IO.popen stream waits for the child to exit
10 changes: 10 additions & 0 deletions spec/truffle/tags/core/kernel/chop_tags.txt
Original file line number Diff line number Diff line change
@@ -5,3 +5,13 @@ slow:#chop removes the final character of $_
slow:#chop removes the final carriage return, newline of $_
slow:Kernel.chop removes the final multi-byte character from $_
slow:Kernel#chop removes the final multi-byte character from $_
slow:Kernel#chop is a private method
slow:Kernel#chop removes the final character of $_
slow:Kernel#chop removes the final carriage return, newline of $_
fails:Kernel.chop removes the final character of $_
fails:Kernel.chop removes the final carriage return, newline of $_
fails:Kernel#chop is a private method
fails:Kernel#chop removes the final character of $_
fails:Kernel#chop removes the final carriage return, newline of $_
fails:Kernel.chop removes the final multi-byte character from $_
fails:Kernel#chop removes the final multi-byte character from $_
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:Addrinfo#inspect_sockaddr IPv4
fails:Addrinfo#inspect_sockaddr IPv6
fails:Addrinfo#inspect_sockaddr UNIX
52 changes: 50 additions & 2 deletions test/jruby/test_require_once.rb → test/jruby/test_require.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'test/unit'

class TestRequireOnce < Test::Unit::TestCase
class TestRequire < Test::Unit::TestCase

# This test repeatedly requires the same file across several threads, reverting $" each time.
# It passes when requires are only firing once, regardless of concurrency.
# See JRUBY-3078.
def test_require_fires_once_across_threads
$foo = 0
100.times do
[1,2,3,4,5].map do |x|
[1,2,3,4,5].map do
Thread.new {require "test/foo_for_test_require_once"}
end.each {|t| t.join}
raise "Concurrent requires caused double-loading" if $foo != 1
@@ -25,6 +25,54 @@ def test_feature_has_full_name
assert_equal 1, $jruby_3234
end

def test_concurrent_loading # GH-4091
filename = File.join(File.dirname(__FILE__), 'gh4091-sample.rb')
assert ! defined?(GH4091)
File.open(filename, 'w') do |f|
f.write <<OUT
module GH4091
class Sample
sleep 0.1
1 + 2 + 3 # some boilerplate
sleep 0.2
end
end
OUT
end

current_dir = File.expand_path(File.dirname(__FILE__))
if $LOAD_PATH.include?(current_dir)
current_dir = false
else
$LOAD_PATH << current_dir
end

$gh4091_error = nil; threads = []
(ENV['THREAD_COUNT'] || 5).to_i.times do
threads << Thread.start {
begin
require 'gh4091-sample'
GH4091::Sample.new # failed in GH-4091
rescue Exception => e
unless $gh4091_error
$gh4091_error = e
end
end
}
end
threads.each(&:join)

e = $gh4091_error
fail "concurrent loading failed: #{e.inspect}" if e

ensure
File.unlink(filename) rescue nil
$gh4091_error = nil
$LOAD_PATH.delete current_dir if current_dir
Object.send(:remove_const, GH4091) rescue nil
$LOADED_FEATURES.delete 'gh4091-sample.rb'
end

# module ::Zlib; end
#
# def test_define_class_type_mismatch

0 comments on commit a2821f6

Please sign in to comment.