Skip to content

Commit

Permalink
compiler tests: Correct bad timetrap limit
Browse files Browse the repository at this point in the history
The compiler's random_code test suite always fails when running with a
debug emulator due to a `timeout_value` exit. A `timeout_value` exit
appears to be triggered when a timer is given a timeout that is either
miss-formed or out of range. Checking the relevant part of
`random_code_SUITE`, it appears that the timeout is calculated in
milliseconds, but it is given to `ct:timetrap/1` as a timeout in
seconds.

Although not sure about the exact failure mechanism, changing the
calculation to produce a timeout in seconds, allows the test-suite to
successfully complete both with an `opt` and `debug` build of the
emulator.
  • Loading branch information
frej committed Jul 22, 2024
1 parent 9ff030b commit 9a6084d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/compiler/test/random_code_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ compile(_Config) ->
list_to_integer(NumTests0)
end,

%% Conservatively assume that we can run 10 tests each second.
TimeTrap = {seconds,60_000 + (NumTests+99) div 100},
%% Conservatively assume that we can run 10 tests each
%% second.
TimeTrap = {seconds, (60 + (NumTests+9) div 10)},
ct:timetrap(TimeTrap),
io:format("~p tests\n", [NumTests]),
true = proper:quickcheck(compile_prop:compile(),
Expand Down

0 comments on commit 9a6084d

Please sign in to comment.