Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/proper_erlang_abstract_code.erl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
%%% '''
-module(proper_erlang_abstract_code).

-compile({no_auto_import, [is_record/1]}).

-export([module/0, module/1, guard/0, guard/1, expr/0, expr/1]).

-export([term/0, term/1]).
Expand Down
13 changes: 12 additions & 1 deletion src/proper_statem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,18 @@ pmap(F, L) ->
[command_list()]) -> [pid()].
spawn_jobs(F, L) ->
Parent = self(),
[spawn_link_cp(fun() -> Parent ! {self(),catch {ok,F(X)}} end) || X <- L].
[spawn_link_cp(fun() ->
Msg = try {ok, F(X)} of
V -> V
catch
throw:T -> T;
exit:Reason -> {'EXIT', Reason};
error:Reason:Stacktrace ->
{'EXIT', {Reason, Stacktrace}}
end,
Parent ! {self(), Msg}
end)
|| X <- L].

-spec await([pid()]) -> [parallel_history()].
await([]) -> [];
Expand Down
2 changes: 1 addition & 1 deletion test/ets_counter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ set_up() ->
ok.

clean_up() ->
catch ets:delete(counter).
try ets:delete(counter) catch _:_ -> ok end.

key() ->
elements(?KEYS).
Expand Down
6 changes: 3 additions & 3 deletions test/ets_statem_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ prop_ets() ->
?FORALL(Type, noshrink(table_type()),
?FORALL(Cmds, commands(?MODULE, initial_state(Type)),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [Type, public, named_table]),
{H,S,Res} = run_commands(?MODULE, Cmds),
clean_up(),
Expand All @@ -241,7 +241,7 @@ prop_parallel_ets() ->
?FORALL(Type, noshrink(table_type()),
?FORALL(Cmds, parallel_commands(?MODULE, initial_state(Type)),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [Type, public, named_table]),
{Seq,P,Res} = run_parallel_commands(?MODULE, Cmds),
?WHENFAIL(
Expand All @@ -254,7 +254,7 @@ prop_parallel_ets() ->
%%% Utility Functions

set_up() ->
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
Type = lists:nth(proper_arith:rand_int(1, 4),
[set, ordered_set, bag, duplicate_bag]),
?TAB = ets:new(?TAB, [Type, public, named_table]).
Expand Down
9 changes: 8 additions & 1 deletion test/proper_exported_types_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ not_handled() ->
R = [{M,T,A,proper_typeserver:demo_translate_type(M, stringify(T, A))}
|| {M,T,A} <- MTs],
{OKs,Errors} = lists:partition(fun type_translation_is_ok/1, R),
{[Inst || TGen <- OKs, (Inst = pick_instance(TGen)) =/= ok], length(Errors)}.
BadInsts = lists:filtermap(
fun(TGen) ->
case pick_instance(TGen) of
ok -> false;
Inst -> {true, Inst}
end
end, OKs),
{BadInsts, length(Errors)}.

pick_instance({M,T,A,{ok,Gen}}) ->
{ok,Inst} = proper_gen:pick(Gen),
Expand Down
6 changes: 3 additions & 3 deletions test/targeted_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ non_empty_ets(S) ->
prop_random() ->
?FORALL(Cmds, proper_fsm:commands(?MODULE),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{H, _S, Res} = proper_fsm:run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand All @@ -103,7 +103,7 @@ prop_targeted() ->
?FORALL_TARGETED(
Cmds, proper_fsm:commands(?MODULE),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{H, {_, S}, Res} = proper_fsm:run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand All @@ -116,7 +116,7 @@ prop_targeted_init() ->
?FORALL_TARGETED(
Cmds, proper_fsm:commands(?MODULE, {empty_ets, []}),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{H, {_, S}, Res} = proper_fsm:run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand Down
6 changes: 3 additions & 3 deletions test/targeted_statem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ postcondition(_S, _C, _R) -> true.
prop_random() ->
?FORALL(Cmds, commands(?MODULE),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{_H, _S, Res} = run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand All @@ -96,7 +96,7 @@ prop_random() ->
prop_targeted() ->
?FORALL_TARGETED(Cmds, commands(?MODULE),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{_H, S, Res} = run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand All @@ -107,7 +107,7 @@ prop_targeted() ->
prop_targeted_init() ->
?FORALL_TARGETED(Cmds, commands(?MODULE, []),
begin
catch ets:delete(?TAB),
try ets:delete(?TAB) catch _:_ -> ok end,
?TAB = ets:new(?TAB, [set, public, named_table]),
{_H, S, Res} = run_commands(?MODULE, Cmds),
ets:delete(?TAB),
Expand Down
Loading