Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keywordargs testset breaks precompile testset #34921

Closed
twhitehead opened this issue Feb 28, 2020 · 1 comment · Fixed by #35000
Closed

keywordargs testset breaks precompile testset #34921

twhitehead opened this issue Feb 28, 2020 · 1 comment · Fixed by #35000
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior test This change adds or pertains to unit tests

Comments

@twhitehead
Copy link
Contributor

twhitehead commented Feb 28, 2020

If you run the test set in a isolated build environment (i.e., no external network) then they run sequentially in the same process and several fail due to bad interactions between them.

One of these failures is that the keywordargs.jl declaration

struct T20804{T}
    y::T
end
(f::T20804)(;x=10) = f.y + x

causes the following in precompile.jl to not throw the expected exception

@test_throws ErrorException Core.kwfunc(Base.nothing)

You can test these two are incompatible by just putting them back-to-back in a test.jl file and running them

using Test

struct T20804{T}
    y::T
end
(f::T20804)(;x=10) = f.y + x

@test_throws ErrorException Core.kwfunc(Base.nothing)
$ julia test.jl
Test Failed at /build/test.jl:8
  Expression: Core.kwfunc(Base.nothing)
    Expected: ErrorException
  No exception thrown
ERROR: LoadError: There was an error during testing
in expression starting at /build/test.jl:8

If you want to see it with the build system, and you don't have an isolated environment to build things in, I expect you can force tests to run sequentially by manually hacking test/runtests.jl

cd(@__DIR__) do
    n = 1
    if net_on
        n = min(Sys.CPU_THREADS, length(tests))
        n > 1 && addprocs_with_testenv(n)
        LinearAlgebra.BLAS.set_num_threads(1)
    end
    skipped = 0

to not set n>1 (e.g., change net_on to false).

@Keno Keno added bug Indicates an unexpected problem or unintended behavior test This change adds or pertains to unit tests labels Feb 28, 2020
@JeffBezanson
Copy link
Member

The test has been changed to

    @test !isdefined(Base.Nothing.name.mt, :kwsorter)

which has the same problem. Instead of using the shared method table for non-Functions this could be changed to use some function in Base that we're pretty sure won't have keyword arguments.

@JeffBezanson JeffBezanson self-assigned this Mar 4, 2020
Keno added a commit that referenced this issue Mar 4, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants