Skip to content

MWE for Channel failure #153

Open
Open
@macd

Description

@macd

It looks like take! is not getting all that was put! into the Channel

julia (v1.2)> include("chantest.jl")
Test Failed at /home/macd/jlang/dev/JuliaInterpreter.jl/test/chantest.jl:15
  Expression: pvals == tvals
   Evaluated: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  999991, 999992, 999993, 999994, 999995, 999996, 999997, 999998, 999999, 1000000] == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  999735, 999736, 999737, 999738, 999739, 999740, 999741, 999742, 999743, 999744]
ERROR: Error while loading expression starting at /home/macd/jlang/dev/JuliaInterpreter.jl/test/chantest.jl:21
caused by [exception 1]
There was an error during testing

Here is the MWE

include("utils.jl")

module ChanTest
using Random
using Test
end

m = ChanTest

ex = quote
    c = Channel{Int}(Inf)
    pvals = map(i->put!(c,i), 1:10^6)
    tvals = Int[take!(c) for i in 1:10^6]
    @test pvals == tvals
end

nstmts = 100000

modexs, _ = JuliaInterpreter.split_expressions(m, ex)
for modex in modexs
    frame = JuliaInterpreter.prepare_thunk(modex)
    nstmtsleft = nstmts
    while true
        ret, nstmtsleft = evaluate_limited!(frame, nstmtsleft, true)
        if isa(ret, Aborted)
            JuliaInterpreter.finish_stack!(Compiled(), frame, true)
            break
        elseif isa(ret, Some)
            break
        end
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions