summaryrefslogtreecommitdiff
path: root/quickcheck
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-08-17 16:20:32 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-08-17 16:20:32 +0100
commit2dc3eb753112511241c6cc68396351cf8851d899 (patch)
tree07507fbb0550f4b5d396a59c6da52b87640b854e /quickcheck
parent80e4fe0ecf1e354e56ebf787de0125bb335f5f8a (diff)
parent6819ee5650d7c66acc21767bdcf80be66b280dce (diff)
downloadrabbitmq-server-git-2dc3eb753112511241c6cc68396351cf8851d899.tar.gz
Merging bug24230 to 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.
+