aboutsummaryrefslogtreecommitdiff
path: root/tests/hangtest.lua
blob: 0e44451dadba3daeddac3f4193bbd33f2ea2302a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--
-- Test case for hang on [1]s and :join()s.
--

local lanes = require "lanes"

local function ret(b)
    return b
end
local lgen = lanes.gen("*", {}, ret)

for i=1,10000 do
    local ln = lgen(i)

    print( "getting result for "..i )

    -- Hangs here forever every few hundred runs or so,
    -- can be illustrated by putting another print() statement
    -- after, which will never be called.
    --
    local result = ln[1];

    assert (result == i);
end

print "Finished!"