summaryrefslogtreecommitdiff
path: root/quickcheck
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-08-05 10:03:12 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-08-05 10:03:12 +0100
commitf72086292bc13dcd5cbb9aa2e5aa9eacc6602d42 (patch)
tree2e15724d608a1d9733ba8d9c3dc2fed3676944b3 /quickcheck
parent625f9b72b3f8469f5e9935f3347b13e3ae1ae419 (diff)
parent36d6750b0f984a105c448609cb29f9037193d8b0 (diff)
downloadrabbitmq-server-git-f72086292bc13dcd5cbb9aa2e5aa9eacc6602d42.tar.gz
merge default into bug23056
Diffstat (limited to 'quickcheck')
-rwxr-xr-xquickcheck36
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.
+