1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2015-2018. 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-module(beam_reorder_SUITE). 21 22-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1, 23 init_per_group/2,end_per_group/2, 24 alloc/1,confused_beam_validator/1]). 25 26suite() -> [{ct_hooks,[ts_install_cth]}]. 27 28all() -> 29 [{group,p}]. 30 31groups() -> 32 [{p,[parallel], 33 [alloc, 34 confused_beam_validator 35 ]}]. 36 37init_per_suite(Config) -> 38 test_lib:recompile(?MODULE), 39 Config. 40 41end_per_suite(_Config) -> 42 ok. 43 44init_per_group(_GroupName, Config) -> 45 Config. 46 47end_per_group(_GroupName, Config) -> 48 Config. 49 50-record(alloc, {version}). 51 52alloc(_Config) -> 53 {ok,42} = alloc_a(1, 2, #alloc{version=42}), 54 {a,b,c} = alloc_b(1, 2, #alloc{version={a,b,c}}), 55 ok. 56 57alloc_a(_U1, _U2, R) -> 58 V = R#alloc.version, 59 Res = id({ok,V}), 60 _ = id(0), 61 Res. 62 63alloc_b(_U1, _U2, R) -> 64 V = R#alloc.version, 65 Res = id(V), 66 _ = id(0), 67 Res. 68 69confused_beam_validator(_Config) -> 70 {'EXIT',{{badmap,{any}},_}} = (catch efficient({any})), 71 ok. 72 73efficient({Var}=God) -> 74 id(God#{}), 75 catch 76 receive _ -> 77 Var 78 end. 79 80id(I) -> 81 I. 82