summaryrefslogtreecommitdiff
path: root/quickcheck
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-07-26 16:53:25 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2011-07-26 16:53:25 +0100
commit39fd0c69972d53f0ca3fb07a56e95e2d1f8a573f (patch)
treed0e104fc30c33f27af07f8bbe5e79b9b380c17fd /quickcheck
parentff8a4b4b9f5594cdf1172b9b9b83e23cd21df0d7 (diff)
parente9e50efaea3eb2cbe27a37f09e31c35aad2d7834 (diff)
downloadrabbitmq-server-git-39fd0c69972d53f0ca3fb07a56e95e2d1f8a573f.tar.gz
merge bug24296 into default
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.
+