diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-08-02 10:48:18 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-08-02 10:48:18 +0100 |
| commit | 0ae1bba1dd2d519a9b50540e76f79ae518b810f7 (patch) | |
| tree | 7a55098c74ec108cdb5d094ed16ccd9eb661e06c /quickcheck | |
| parent | 9b10c994f7bb39dac5de2a43c1a21301a164a930 (diff) | |
| parent | d3509448afcd1f6f0783c13bc877560b43c9b5f5 (diff) | |
| download | rabbitmq-server-git-0ae1bba1dd2d519a9b50540e76f79ae518b810f7.tar.gz | |
merge default into bug23504
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. + |
