diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-07-29 12:13:54 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-07-29 12:13:54 +0100 |
| commit | 5c725cdc01dfe220e05a8c0861ba6e1620d69cc7 (patch) | |
| tree | f04d0d792625884201bade4694eb20d541b11a6e /quickcheck | |
| parent | b57f57bd212907f6efb0293c3a85c756224b6d20 (diff) | |
| parent | 317b7a3e90c42a7606feaec563308ec0317e1a0a (diff) | |
| download | rabbitmq-server-git-5c725cdc01dfe220e05a8c0861ba6e1620d69cc7.tar.gz | |
Merge bug 24227
Diffstat (limited to 'quickcheck')
| -rwxr-xr-x | quickcheck | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/quickcheck b/quickcheck new file mode 100755 index 0000000000..a36cf3ed86 --- /dev/null +++ b/quickcheck @@ -0,0 +1,36 @@ +#!/usr/bin/env escript +%% -*- erlang -*- +%%! -sname quickcheck +-mode(compile). + +%% A helper to test quickcheck properties on a running broker +%% NodeStr is a local broker node name +%% ModStr is the module containing quickcheck properties +%% The number of trials is optional +main([NodeStr, ModStr | TrialsStr]) -> + {ok, Hostname} = inet:gethostname(), + Node = list_to_atom(NodeStr ++ "@" ++ Hostname), + Mod = list_to_atom(ModStr), + Trials = lists:map(fun erlang:list_to_integer/1, TrialsStr), + case rpc:call(Node, code, ensure_loaded, [proper]) of + {module, proper} -> + case rpc:call(Node, proper, module, [Mod] ++ Trials) of + [] -> ok; + _ -> quit(1) + end; + {badrpc, Reason} -> + io:format("Could not contact node ~p: ~p.~n", [Node, Reason]), + quit(2); + {error,nofile} -> + io:format("Module PropEr was not found on node ~p~n", [Node]), + quit(2) + end; +main([]) -> + io:format("This script requires a node name and a module.~n"). + +quit(Status) -> + case os:type() of + {unix, _} -> halt(Status); + {win32, _} -> init:stop(Status) + end. + |
