Revision a311f4d8327a5051b11a6bcd1c44ed931d4ab261 authored by Jacob Quinn on 20 October 2022, 02:44:43 UTC, committed by GitHub on 20 October 2022, 02:44:43 UTC
As reported [here](https://discourse.julialang.org/t/test-failures-for-sockets-base-runtests-sockets/88898). My guess on the original issue reported is that, for some reason, the host where the tests are run is unable to listen on any ports, so we end up cycling through the entire UInt16 range (the test starts at port 11011), but when we fail on port 65535, we do `addr.port + 1` and instead of wrapping around as I believe this function intends to happen (as noted by the `addr.port == default_port` check before we error), it gets promoted to `Int(65536)` which then throws an (unexpected) error in the `InetAddr` constructor. I'm not quite sure how to test this exactly though, because we'd need to simulate not being able to listen on any ports? If anyone has any ideas, I'm all ears.
1 parent 0d52506
llvmcall2.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license
using InteractiveUtils: code_llvm
function declared_floor(x::Float64)
return ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x)
end
@test declared_floor(4.2) == 4.0
ir = sprint(code_llvm, declared_floor, Tuple{Float64})
@test occursin("call double @llvm.floor.f64", ir) # should be inlined
function doubly_declared_floor(x::Float64)
a = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x)
b = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x + 1) - 1
return a + b
end
@test doubly_declared_floor(4.2) == 8.0
function doubly_declared2_trunc(x::Float64)
a = ccall("llvm.trunc.f64", llvmcall, Float64, (Float64,), x)
b = ccall("llvm.trunc.f64", llvmcall, Float64, (Float64,), x + 1) - 1
return a + b
end
@test doubly_declared2_trunc(4.2) == 8.0
# Test for single line
function declared_ceil(x::Float64)
return ccall("llvm.ceil.f64", llvmcall, Float64, (Float64,), x)
end
@test declared_ceil(4.2) == 5.0
# Test for multiple lines
function ceilfloor(x::Float64)
a = ccall("llvm.ceil.f64", llvmcall, Float64, (Float64,), x)
b = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), a)
return b
end
@test ceilfloor(7.4) == 8.0
let err = ErrorException("llvmcall only supports intrinsic calls")
# support for calling external functions
@test_throws err @eval ccall("time", llvmcall, Cvoid, (Ptr{Cvoid},), C_NULL)
g() = ccall("extern time", llvmcall, Cvoid, (Ptr{Cvoid},), C_NULL)
g()
@test_throws err @eval ccall("extern llvm.floor", llvmcall, Float64, (Float64,), 0.0)
# support for mangling
@test (@eval ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), 0.0)) === 0.0
@test (@eval ccall("llvm.floor", llvmcall, Float64, (Float64,), 0.0),
ccall("llvm.floor", llvmcall, Float32, (Float32,), 0.0)) === (0.0, 0.0f0)
@test_throws err @eval ccall("llvm.floor.f64", llvmcall, Float32, (Float64,), 0.0)
@test_throws err @eval ccall("llvm.floor.f64", llvmcall, Float32, (Float32,), 0.0f0)
@test_throws err @eval ccall("llvm.floor.f64", llvmcall, Float64, (Float32,), 0.0f0)
@test_throws err @eval ccall("llvm.floor.f64", llvmcall, Float64, (Int,), 0)
@test_throws err @eval ccall("llvm.floor.f64", llvmcall, Int, (Int,), 0)
@test_throws err @eval ccall("llvm.floor", llvmcall, Float64, (Float32,), 0.0f0)
@test_throws err @eval ccall("llvm.floor", llvmcall, Float64, (Int,), 0)
@test_throws err @eval ccall("llvm.floor", llvmcall, Int, (Int,), 0)
@test_throws err (@eval ccall("llvm.floor.f64", llvmcall, Float64, (Float64, Float64...,), 0.0)) === 0.0
@test_throws err (@eval ccall("llvm.floor", llvmcall, Float64, (Float64, Float64...,), 0.0)) === 0.0
end
Computing file changes ...