auser-poolparty 0.2.16 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +72 -7
- data/PostInstall.txt +1 -1
- data/Rakefile +11 -0
- data/bin/cloud-provision +6 -10
- data/bin/server-build-messenger +20 -0
- data/bin/server-fire-cmd +0 -2
- data/bin/server-list-responding +24 -0
- data/bin/server-start-master +4 -9
- data/bin/server-start-node +7 -6
- data/lib/erlang/messenger/Emakefile +1 -0
- data/lib/erlang/messenger/Rakefile +29 -20
- data/lib/erlang/messenger/ebin/master_app.beam +0 -0
- data/lib/erlang/messenger/ebin/node_app.beam +0 -0
- data/lib/erlang/messenger/ebin/packager.app +19 -0
- data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_event_handler.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +1 -7
- data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +1 -7
- data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
- data/lib/erlang/messenger/ebin/utils.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/AUTHORS +2 -0
- data/lib/erlang/messenger/lib/eunit/CHANGELOG +14 -0
- data/lib/erlang/messenger/lib/eunit/COPYING +504 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
- data/lib/erlang/messenger/lib/eunit/NOTES +276 -0
- data/lib/erlang/messenger/lib/eunit/README +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/edoc-info +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/erlang.png +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/eunit.html +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/index.html +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/modules-frame.html +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview-summary.html +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview.edoc +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/packages-frame.html +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/stylesheet.css +55 -0
- data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.app +21 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.appup +1 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/examples/eunit_examples.erl +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/fib.erl +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/tests.txt +1 -0
- data/lib/erlang/messenger/lib/eunit/include/eunit.hrl +313 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
- data/lib/erlang/messenger/lib/eunit/src/autoload.erl +388 -0
- data/lib/erlang/messenger/lib/eunit/src/code_monitor.erl +243 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.app.src +21 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.appup.src +1 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.erl +196 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl +102 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_data.erl +798 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl +48 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_lib.erl +682 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_proc.erl +552 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_serial.erl +157 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_server.erl +340 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl +64 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_test.erl +334 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tests.erl +45 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tty.erl +272 -0
- data/lib/erlang/messenger/lib/eunit/src/file_monitor.erl +409 -0
- data/lib/erlang/messenger/lib/eunit/sys.config +9 -0
- data/lib/erlang/messenger/lib/eunit/vsn.mk +1 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +75 -2
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +75 -2
- data/lib/erlang/messenger/src/pm_client.erl +8 -3
- data/lib/erlang/messenger/src/pm_cluster.erl +32 -9
- data/lib/erlang/messenger/src/pm_master.erl +10 -11
- data/lib/erlang/messenger/src/pm_node.erl +2 -3
- data/lib/erlang/messenger/src/pm_packager.erl +73 -0
- data/lib/erlang/messenger/src/utils.erl +3 -10
- data/lib/poolparty/base_packages/heartbeat.rb +9 -9
- data/lib/poolparty/base_packages/poolparty.rb +16 -10
- data/lib/poolparty/config/allowed_commands.yml +1 -0
- data/lib/poolparty/core/object.rb +8 -0
- data/lib/poolparty/exceptions/UnacceptableCommand.rb +5 -0
- data/lib/poolparty/helpers/messenger.rb +29 -0
- data/lib/poolparty/helpers/provisioner_base.rb +7 -7
- data/lib/poolparty/helpers/provisioners/master.rb +3 -7
- data/lib/poolparty/helpers/provisioners/slave.rb +1 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +7 -5
- data/lib/poolparty/modules/configurable.rb +1 -1
- data/lib/poolparty/modules/method_missing_sugar.rb +6 -1
- data/lib/poolparty/modules/pretty_printer.rb +1 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +2 -1
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
- data/lib/poolparty/net/remoter.rb +3 -1
- data/lib/poolparty/plugins/git.rb +3 -3
- data/lib/poolparty/pool/base.rb +7 -2
- data/lib/poolparty/pool/cloud.rb +3 -3
- data/lib/poolparty/pool/resource.rb +38 -24
- data/lib/poolparty/pool/resources/class_package.rb +2 -2
- data/lib/poolparty/pool/resources/conditional.rb +8 -4
- data/lib/poolparty/pool/resources/{gem.rb → gem_package.rb} +0 -0
- data/lib/poolparty/pool/resources/package.rb +8 -1
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +1 -1
- data/poolparty.gemspec +476 -61
- data/spec/poolparty/core/object_spec.rb +20 -0
- data/spec/poolparty/helpers/messenger_spec.rb +14 -0
- data/spec/poolparty/helpers/provisioners/master_spec.rb +2 -2
- data/spec/poolparty/net/remoter_spec.rb +1 -1
- data/spec/poolparty/plugins/git_spec.rb +26 -19
- data/spec/poolparty/pool/base_spec.rb +20 -2
- data/spec/poolparty/pool/cloud_spec.rb +256 -249
- data/spec/poolparty/pool/custom_resource_spec.rb +6 -1
- data/spec/poolparty/pool/plugin_spec.rb +71 -65
- data/spec/poolparty/pool/resource_spec.rb +314 -237
- data/spec/poolparty/pool/resources/class_package_spec.rb +71 -66
- data/spec/poolparty/pool/resources/conditional_spec.rb +30 -26
- data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
- data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
- data/spec/poolparty/pool/script_spec.rb +46 -37
- data/spec/poolparty/spec_helper.rb +4 -0
- data/tasks/cloud.rake +0 -54
- data/tasks/development.rake +11 -14
- data/tasks/ec2.rake +10 -17
- data/tasks/instance.rake +0 -61
- data/website/index.html +1 -1
- metadata +83 -10
@@ -0,0 +1,313 @@
|
|
1
|
+
%% This library is free software; you can redistribute it and/or modify
|
2
|
+
%% it under the terms of the GNU Lesser General Public License as
|
3
|
+
%% published by the Free Software Foundation; either version 2 of the
|
4
|
+
%% License, or (at your option) any later version.
|
5
|
+
%%
|
6
|
+
%% This library is distributed in the hope that it will be useful, but
|
7
|
+
%% WITHOUT ANY WARRANTY; without even the implied warranty of
|
8
|
+
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
9
|
+
%% Lesser General Public License for more details.
|
10
|
+
%%
|
11
|
+
%% You should have received a copy of the GNU Lesser General Public
|
12
|
+
%% License along with this library; if not, write to the Free Software
|
13
|
+
%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
14
|
+
%% USA
|
15
|
+
%%
|
16
|
+
%% $Id: eunit.hrl 261 2008-10-12 11:33:16Z rcarlsson $
|
17
|
+
%%
|
18
|
+
%% Copyright (C) 2004-2006 Micka�l R�mond, Richard Carlsson
|
19
|
+
|
20
|
+
%% Including this file turns on testing and defines TEST, unless NOTEST
|
21
|
+
%% is defined before the file is included. If both NOTEST and TEST are
|
22
|
+
%% already defined, then TEST takes precedence, and NOTEST will become
|
23
|
+
%% undefined.
|
24
|
+
%%
|
25
|
+
%% If including this file causes TEST to be defined, then NOASSERT will
|
26
|
+
%% be undefined, even if it was previously defined. If both ASSERT and
|
27
|
+
%% NOASSERT are defined before the file is included, then ASSERT takes
|
28
|
+
%% precedence, and NOASSERT will become undefined regardless of TEST.
|
29
|
+
%%
|
30
|
+
%% After including this file, EUNIT will be defined if and only if TEST
|
31
|
+
%% is defined.
|
32
|
+
|
33
|
+
-ifndef(EUNIT_HRL).
|
34
|
+
-define(EUNIT_HRL, true).
|
35
|
+
|
36
|
+
%% allow defining TEST to override NOTEST
|
37
|
+
-ifdef(TEST).
|
38
|
+
-undef(NOTEST).
|
39
|
+
-endif.
|
40
|
+
|
41
|
+
%% allow NODEBUG to imply NOASSERT, unless overridden below
|
42
|
+
-ifdef(NODEBUG).
|
43
|
+
-ifndef(NOASSERT).
|
44
|
+
-define(NOASSERT, true).
|
45
|
+
-endif.
|
46
|
+
-endif.
|
47
|
+
|
48
|
+
%% note that the main switch used within this file is NOTEST; however,
|
49
|
+
%% both TEST and EUNIT may be used to check whether testing is enabled
|
50
|
+
-ifndef(NOTEST).
|
51
|
+
-undef(NOASSERT). % testing requires that assertions are enabled
|
52
|
+
-ifndef(TEST).
|
53
|
+
-define(TEST, true).
|
54
|
+
-endif.
|
55
|
+
-ifndef(EUNIT).
|
56
|
+
-define(EUNIT, true).
|
57
|
+
-endif.
|
58
|
+
-else.
|
59
|
+
-undef(EUNIT).
|
60
|
+
-endif.
|
61
|
+
|
62
|
+
%% allow ASSERT to override NOASSERT (regardless of TEST/NOTEST)
|
63
|
+
-ifdef(ASSERT).
|
64
|
+
-undef(NOASSERT).
|
65
|
+
-endif.
|
66
|
+
|
67
|
+
%% Parse transforms for automatic exporting/stripping of test functions.
|
68
|
+
%% (Note that although automatic stripping is convenient, it will make
|
69
|
+
%% the code dependent on this header file and the eunit_striptests
|
70
|
+
%% module for compilation, even when testing is switched off! Using
|
71
|
+
%% -ifdef(EUNIT) around all test code makes the program more portable.)
|
72
|
+
|
73
|
+
-ifndef(EUNIT_NOAUTO).
|
74
|
+
-ifndef(NOTEST).
|
75
|
+
-compile({parse_transform, eunit_autoexport}).
|
76
|
+
-else.
|
77
|
+
-compile({parse_transform, eunit_striptests}).
|
78
|
+
-endif.
|
79
|
+
-endif.
|
80
|
+
|
81
|
+
%% All macros should be available even if testing is turned off, and
|
82
|
+
%% should preferably not require EUnit to be present at runtime.
|
83
|
+
%%
|
84
|
+
%% We must use fun-call wrappers ((fun () -> ... end)()) to avoid
|
85
|
+
%% exporting local variables, and furthermore we only use variable names
|
86
|
+
%% prefixed with "__", that hopefully will not be bound outside the fun.
|
87
|
+
|
88
|
+
%% A generic let-macro is particularly useful when writing test cases.
|
89
|
+
%% It is more compact than 'begin X = Y, Z end', and guarantees that
|
90
|
+
%% X gets a new, local binding.
|
91
|
+
%% (Note that lowercase 'let' is a reserved word.)
|
92
|
+
-ifndef(LET).
|
93
|
+
-define(LET(X,Y,Z), ((fun(X)->(Z)end)(Y))).
|
94
|
+
-endif.
|
95
|
+
|
96
|
+
%% It is important that testing code is short and readable.
|
97
|
+
%% An if-then-else macro can make some code much more compact.
|
98
|
+
%% Compare: case f(X) of true->g(X); false->h(X) end
|
99
|
+
%% and: ?IF(f(X), g(Y), h(Z))
|
100
|
+
-ifndef(IF).
|
101
|
+
-define(IF(B,T,F), (case (B) of true->(T); false->(F) end)).
|
102
|
+
-endif.
|
103
|
+
|
104
|
+
-ifdef(NOASSERT).
|
105
|
+
%% The plain assert macro should be defined to do nothing if this file
|
106
|
+
%% is included when debugging/testing is turned off.
|
107
|
+
-ifndef(assert).
|
108
|
+
-define(assert(BoolExpr),ok).
|
109
|
+
-endif.
|
110
|
+
-else.
|
111
|
+
%% The assert macro is written the way it is so as not to cause warnings
|
112
|
+
%% for clauses that cannot match, even if the expression is a constant.
|
113
|
+
-undef(assert).
|
114
|
+
-define(assert(BoolExpr),
|
115
|
+
((fun () ->
|
116
|
+
case (BoolExpr) of
|
117
|
+
true -> ok;
|
118
|
+
__V -> .erlang:error({assertion_failed,
|
119
|
+
[{module, ?MODULE},
|
120
|
+
{line, ?LINE},
|
121
|
+
{expression, (??BoolExpr)},
|
122
|
+
{expected, true},
|
123
|
+
{value, case __V of false -> __V;
|
124
|
+
_ -> {not_a_boolean,__V}
|
125
|
+
end}]})
|
126
|
+
end
|
127
|
+
end)())).
|
128
|
+
-endif.
|
129
|
+
-define(assertNot(BoolExpr), ?assert(not (BoolExpr))).
|
130
|
+
|
131
|
+
-define(_test(Expr), {?LINE, fun () -> (Expr) end}).
|
132
|
+
|
133
|
+
-define(_assert(BoolExpr), ?_test(?assert(BoolExpr))).
|
134
|
+
|
135
|
+
-define(_assertNot(BoolExpr), ?_assert(not (BoolExpr))).
|
136
|
+
|
137
|
+
%% This is mostly a convenience which gives more detailed reports.
|
138
|
+
%% Note: Guard is a guarded pattern, and can not be used for value.
|
139
|
+
-ifdef(NOASSERT).
|
140
|
+
-define(assertMatch(Guard,Expr),ok).
|
141
|
+
-else.
|
142
|
+
-define(assertMatch(Guard, Expr),
|
143
|
+
((fun () ->
|
144
|
+
case (Expr) of
|
145
|
+
Guard -> ok;
|
146
|
+
__V -> .erlang:error({assertMatch_failed,
|
147
|
+
[{module, ?MODULE},
|
148
|
+
{line, ?LINE},
|
149
|
+
{expression, (??Expr)},
|
150
|
+
{expected, (??Guard)},
|
151
|
+
{value, __V}]})
|
152
|
+
end
|
153
|
+
end)())).
|
154
|
+
-endif.
|
155
|
+
-define(_assertMatch(Guard, Expr), ?_test(?assertMatch(Guard, Expr))).
|
156
|
+
|
157
|
+
%% This is a convenience macro which gives more detailed reports when
|
158
|
+
%% the expected LHS value is not a pattern, but a computed value
|
159
|
+
-ifdef(NOASSERT).
|
160
|
+
-define(assertEqual(Expect,Expr),ok).
|
161
|
+
-else.
|
162
|
+
-define(assertEqual(Expect, Expr),
|
163
|
+
((fun (__X) ->
|
164
|
+
case (Expr) of
|
165
|
+
__X -> ok;
|
166
|
+
__V -> .erlang:error({assertEqual_failed,
|
167
|
+
[{module, ?MODULE},
|
168
|
+
{line, ?LINE},
|
169
|
+
{expression, (??Expr)},
|
170
|
+
{expected, __X},
|
171
|
+
{value, __V}]})
|
172
|
+
end
|
173
|
+
end)(Expect))).
|
174
|
+
-endif.
|
175
|
+
-define(_assertEqual(Expect, Expr), ?_test(?assertEqual(Expect, Expr))).
|
176
|
+
|
177
|
+
%% Note: Class and Term are patterns, and can not be used for value.
|
178
|
+
-ifdef(NOASSERT).
|
179
|
+
-define(assertException(Class, Term, Expr),ok).
|
180
|
+
-else.
|
181
|
+
-define(assertException(Class, Term, Expr),
|
182
|
+
((fun () ->
|
183
|
+
try (Expr) of
|
184
|
+
__V -> .erlang:error({assertException_failed,
|
185
|
+
[{module, ?MODULE},
|
186
|
+
{line, ?LINE},
|
187
|
+
{expression, (??Expr)},
|
188
|
+
{expected,
|
189
|
+
"{ "++(??Class)++" , "++(??Term)
|
190
|
+
++" , [...] }"},
|
191
|
+
{unexpected_success, __V}]})
|
192
|
+
catch
|
193
|
+
Class:Term -> ok;
|
194
|
+
__C:__T ->
|
195
|
+
.erlang:error({assertException_failed,
|
196
|
+
[{module, ?MODULE},
|
197
|
+
{line, ?LINE},
|
198
|
+
{expression, (??Expr)},
|
199
|
+
{expected,
|
200
|
+
"{ "++(??Class)++" , "++(??Term)
|
201
|
+
++" , [...] }"},
|
202
|
+
{unexpected_exception,
|
203
|
+
{__C, __T, erlang:get_stacktrace()}}]})
|
204
|
+
end
|
205
|
+
end)())).
|
206
|
+
-endif.
|
207
|
+
|
208
|
+
-define(assertError(Term, Expr), ?assertException(error, Term, Expr)).
|
209
|
+
-define(assertExit(Term, Expr), ?assertException(exit, Term, Expr)).
|
210
|
+
-define(assertThrow(Term, Expr), ?assertException(throw, Term, Expr)).
|
211
|
+
|
212
|
+
-define(_assertException(Class, Term, Expr),
|
213
|
+
?_test(?assertException(Class, Term, Expr))).
|
214
|
+
-define(_assertError(Term, Expr), ?_assertException(error, Term, Expr)).
|
215
|
+
-define(_assertExit(Term, Expr), ?_assertException(exit, Term, Expr)).
|
216
|
+
-define(_assertThrow(Term, Expr), ?_assertException(throw, Term, Expr)).
|
217
|
+
|
218
|
+
%% Macros for running operating system commands. (Note that these
|
219
|
+
%% require EUnit to be present at runtime, or at least eunit_lib.)
|
220
|
+
|
221
|
+
%% these can be used for simply running commands in a controlled way
|
222
|
+
-define(_cmd_(Cmd), (.eunit_lib:command(Cmd))).
|
223
|
+
-define(cmdStatus(N, Cmd),
|
224
|
+
((fun () ->
|
225
|
+
case ?_cmd_(Cmd) of
|
226
|
+
{(N), __Out} -> __Out;
|
227
|
+
{__N, _} -> .erlang:error({command_failed,
|
228
|
+
[{module, ?MODULE},
|
229
|
+
{line, ?LINE},
|
230
|
+
{command, (Cmd)},
|
231
|
+
{expected_status,(N)},
|
232
|
+
{status,__N}]})
|
233
|
+
end
|
234
|
+
end)())).
|
235
|
+
-define(_cmdStatus(N, Cmd), ?_test(?cmdStatus(N, Cmd))).
|
236
|
+
-define(cmd(Cmd), ?cmdStatus(0, Cmd)).
|
237
|
+
-define(_cmd(Cmd), ?_test(?cmd(Cmd))).
|
238
|
+
|
239
|
+
%% these are only used for testing; they always return 'ok' on success,
|
240
|
+
%% and have no effect if debugging/testing is turned off
|
241
|
+
-ifdef(NOASSERT).
|
242
|
+
-define(assertCmdStatus(N, Cmd),ok).
|
243
|
+
-else.
|
244
|
+
-define(assertCmdStatus(N, Cmd),
|
245
|
+
((fun () ->
|
246
|
+
case ?_cmd_(Cmd) of
|
247
|
+
{(N), _} -> ok;
|
248
|
+
{__N, _} -> .erlang:error({assertCmd_failed,
|
249
|
+
[{module, ?MODULE},
|
250
|
+
{line, ?LINE},
|
251
|
+
{command, (Cmd)},
|
252
|
+
{expected_status,(N)},
|
253
|
+
{status,__N}]})
|
254
|
+
end
|
255
|
+
end)())).
|
256
|
+
-endif.
|
257
|
+
-define(assertCmd(Cmd), ?assertCmdStatus(0, Cmd)).
|
258
|
+
|
259
|
+
-ifdef(NOASSERT).
|
260
|
+
-define(assertCmdOutput(T, Cmd),ok).
|
261
|
+
-else.
|
262
|
+
-define(assertCmdOutput(T, Cmd),
|
263
|
+
((fun () ->
|
264
|
+
case ?_cmd_(Cmd) of
|
265
|
+
{_, (T)} -> ok;
|
266
|
+
{_, __T} -> .erlang:error({assertCmdOutput_failed,
|
267
|
+
[{module, ?MODULE},
|
268
|
+
{line, ?LINE},
|
269
|
+
{command,(Cmd)},
|
270
|
+
{expected_output,(T)},
|
271
|
+
{output,__T}]})
|
272
|
+
end
|
273
|
+
end)())).
|
274
|
+
-endif.
|
275
|
+
|
276
|
+
-define(_assertCmdStatus(N, Cmd), ?_test(?assertCmdStatus(N, Cmd))).
|
277
|
+
-define(_assertCmd(Cmd), ?_test(?assertCmd(Cmd))).
|
278
|
+
-define(_assertCmdOutput(T, Cmd), ?_test(?assertCmdOutput(T, Cmd))).
|
279
|
+
|
280
|
+
%% Macros to simplify debugging (in particular, they work even when the
|
281
|
+
%% standard output is being redirected by EUnit while running tests)
|
282
|
+
|
283
|
+
-ifdef(NODEBUG).
|
284
|
+
-define(debugMsg(S), ok).
|
285
|
+
-define(debugHere, ok).
|
286
|
+
-define(debugFmt(S, As), ok).
|
287
|
+
-define(debugVal(E), (E)).
|
288
|
+
-define(debugTime(S,E), (E)).
|
289
|
+
-else.
|
290
|
+
-define(debugMsg(S),
|
291
|
+
(begin
|
292
|
+
io:fwrite(user, <<"~s:~w: ~s\n">>,
|
293
|
+
[?FILE, ?LINE, S]),
|
294
|
+
ok
|
295
|
+
end)).
|
296
|
+
-define(debugHere, (?debugMsg("<-"))).
|
297
|
+
-define(debugFmt(S, As), (?debugMsg(io_lib:format((S), (As))))).
|
298
|
+
-define(debugVal(E),
|
299
|
+
((fun (__V) ->
|
300
|
+
?debugFmt(<<"~s = ~P">>, [(??E), __V, 15]),
|
301
|
+
__V
|
302
|
+
end)(E))).
|
303
|
+
-define(debugTime(S,E),
|
304
|
+
((fun () ->
|
305
|
+
{__T0, _} = statistics(wall_clock),
|
306
|
+
__V = (E),
|
307
|
+
{__T1, _} = statistics(wall_clock),
|
308
|
+
?debugFmt(<<"~s: ~.3f s">>, [(S), (__T1-__T0)/1000]),
|
309
|
+
__V
|
310
|
+
end)())).
|
311
|
+
-endif.
|
312
|
+
|
313
|
+
-endif. % EUNIT_HRL
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
include ../vsn.mk
|
3
|
+
|
4
|
+
EMULATOR=beam
|
5
|
+
EBIN=../ebin
|
6
|
+
INCLUDE=../include
|
7
|
+
|
8
|
+
APP_TARGET=$(EBIN)/eunit.app
|
9
|
+
APPUP_TARGET=$(EBIN)/eunit.appup
|
10
|
+
|
11
|
+
ERL_COMPILE_FLAGS += -I$(INCLUDE) +warn_unused_vars +nowarn_shadow_vars +warn_unused_import
|
12
|
+
|
13
|
+
SOURCES= \
|
14
|
+
eunit_autoexport.erl \
|
15
|
+
eunit_striptests.erl \
|
16
|
+
eunit.erl \
|
17
|
+
eunit_tests.erl \
|
18
|
+
eunit_server.erl \
|
19
|
+
eunit_proc.erl \
|
20
|
+
eunit_serial.erl \
|
21
|
+
eunit_test.erl \
|
22
|
+
eunit_lib.erl \
|
23
|
+
eunit_data.erl \
|
24
|
+
eunit_tty.erl \
|
25
|
+
code_monitor.erl \
|
26
|
+
file_monitor.erl \
|
27
|
+
autoload.erl
|
28
|
+
|
29
|
+
OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
|
30
|
+
|
31
|
+
all: $(OBJECTS)
|
32
|
+
|
33
|
+
$(OBJECTS): eunit_internal.hrl \
|
34
|
+
$(INCLUDE)/eunit.hrl
|
35
|
+
|
36
|
+
clean:
|
37
|
+
rm -f $(OBJECTS)
|
38
|
+
|
39
|
+
$(EBIN)/%.$(EMULATOR):%.erl
|
40
|
+
erlc -pa $(EBIN) -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
|
41
|
+
|
42
|
+
$(APP_TARGET): eunit.app.src ../vsn.mk
|
43
|
+
sed -e 's;%VSN%;$(EUNIT_VSN);' $< > $@
|
44
|
+
|
45
|
+
$(APPUP_TARGET): eunit.appup.src ../vsn.mk
|
46
|
+
sed -e 's;%VSN%;$(EUNIT_VSN);' $< > $@
|