1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2017. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20 21-module(prim_eval_SUITE). 22-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 23 init_per_testcase/2, end_per_testcase/2, 24 init_per_group/2, end_per_group/2]). 25 26-export(['ERL-365'/1]). 27 28init_per_testcase(_Case, Config) -> 29 Config. 30 31end_per_testcase(_Case, _Config) -> 32 ok. 33 34suite() -> 35 [{ct_hooks,[ts_install_cth]}, 36 {timetrap,{minutes,1}}]. 37 38groups() -> 39 []. 40 41init_per_suite(Config) -> 42 Config. 43 44end_per_suite(_Config) -> 45 ok. 46 47init_per_group(_GroupName, Config) -> 48 Config. 49 50end_per_group(_GroupName, Config) -> 51 Config. 52 53all() -> 54 ['ERL-365']. 55 56'ERL-365'(Config) when is_list(Config) -> 57 %% def_arg_reg[0] is used for storage of timeout instruction 58 %% when a 'receive after' is executed. When a process was 59 %% scheduled out inside prim_eval:'receive'/0 due to a function 60 %% call, def_arg_reg[0] was overwritten due to storage of live 61 %% registers. 62 P = spawn_link(fun () -> 63 prim_eval:'receive'(fun (_M) -> 64 erlang:bump_reductions((1 bsl 27)-1), 65 id(true), 66 nomatch 67 end, 68 200) 69 end), 70 receive after 100 -> ok end, 71 P ! {wont, match}, 72 receive after 200 -> ok end, 73 ok. 74 75 76 77id(X) -> 78 X. 79