- Timestamp:
- 06/07/08 09:09:47 (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
. (modified) (1 prop)
-
README (modified) (2 diffs)
-
install (modified) (1 diff)
-
src/shells.erl (added)
-
src/tester.erl (modified) (2 diffs)
-
src/tester_test.erl (modified) (1 diff)
-
src/tests.erl (modified) (2 diffs)
-
src/tests_test.erl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
forge.log
tester.log
-
Property
svn:ignore
set to
-
trunk/README
r16 r28 7 7 * To provide a complete, self-contained environment fulfilling the 8 8 needs of extreme programming teams. 9 * To provide a complete, self-contained environment fulfilling the 10 needs of Erlang programmers. 9 11 * To explore some of the ideas at the forefront of extreme 10 12 programming. … … 26 28 Download the tarball, unpack to any convenient location. 27 29 Change to the directory to which you unpacked. 28 From the shell, run the 'install' escript:30 From the shell, run the 'install' script: 29 31 30 32 % ./install -
trunk/install
r23 r28 1 #!/usr/bin/env escript2 %% -*- erlang-*-1 #!/usr/bin/env bash 2 # -*- sh -*- 3 3 4 main (_) -> 5 ok = file: set_cwd ("ebin"), 6 up_to_date = make: all (), 7 ok = tests_test: filter_by_attribute (), 8 io: fwrite ("done~n", []). 4 hostname=`hostname -s` 5 erl -kernel error_logger "{file,\"tester.log\"}" -sname forgetester -noinput & 6 cd ebin 7 erl -make 8 erl -kernel error_logger "{file,\"../forge.log\"}" -sname forgeinstaller -noinput -s shells install forgetester@$hostname -s init stop -
trunk/src/tester.erl
r26 r28 4 4 5 5 -module (tester). 6 -export ([init/2, run/2]). 7 %%-import (orddict, [new/0]). 6 -export ([init/2]). 8 7 9 8 init (Notify, Node) -> 9 process_flag (trap_exit, true), 10 loop (Notify, Node). 11 12 loop (Notify, Node) -> 10 13 receive 11 14 {File_name, Binary} -> 12 15 test (File_name, Binary, Notify, Node); 13 16 _ -> 14 init(Notify, Node)17 loop (Notify, Node) 15 18 end. 16 19 17 20 test (File_name, Binary, Notify, Node) -> 18 21 {Module, Tests} = tests: filter_by_attribute (Binary), 19 rpc:call (Node, code, load_binary, [Module, File_name, Binary]),22 {module, Module} = rpc: call (Node, code, load_binary, [Module, File_name, Binary]), 20 23 Total = length (Tests), 21 24 Notify ({Total, 0, 0}), 22 25 test (Total, 0, 0, Tests, Notify, Node). 23 26 24 test (Total, Run, Passed, [ T| Tests], Notify, Node) ->25 spawn_link (Node, tester, run, [T, self ()]),27 test (Total, Run, Passed, [{M, F, A} | Tests], Notify, Node) -> 28 Pid = spawn_link (Node, M, F, A), 26 29 New_passed = 27 30 receive 28 {'EXIT', Reason} -> 31 {'EXIT', Pid, normal} -> 32 Passed + 1; 33 {'EXIT', Pid, Reason} -> 29 34 Notify (Reason), 30 Passed; 31 _ -> 32 Passed + 1 35 Passed 33 36 end, 34 37 New_run = Run + 1, … … 36 39 test (Total, New_run, New_passed, Tests, Notify, Node); 37 40 test (_, _, _, [], _, _) -> 38 %% init (Notify, Node).39 41 bye. 40 41 run (Test, Tester) ->42 Result = (catch Test ()),43 Tester ! Result. -
trunk/src/tester_test.erl
r26 r28 15 15 Tester ! {"../fix/eg_test.erl", Binary}, 16 16 [{2, 0, 0}, {2, 1, 1}, Error, {2, 2, 1}] = tests: receive_all (), 17 {{badmatch, nok}, [{eg_test, nok, 0} ,_]} = Error,17 {{badmatch, nok}, [{eg_test, nok, 0} | _]} = Error, 18 18 false = code: is_loaded (eg_test), 19 19 ok. -
trunk/src/tests.erl
r26 r28 29 29 exports_to_funs (M, Exports, Funs); 30 30 exports_to_funs (M, [{F, 0} | Exports], Funs) -> 31 Fun = fun () -> M: F () end, 32 exports_to_funs (M, Exports, [Fun | Funs]); 31 exports_to_funs (M, Exports, [{M, F, []} | Funs]); 33 32 exports_to_funs (M, [{_, _} | Exports], Funs) -> 34 33 exports_to_funs (M, Exports, Funs); … … 40 39 after 10000 -> lists: reverse (Ms) 41 40 end. 42 -
trunk/src/tests_test.erl
r25 r28 9 9 filter_by_attribute () -> 10 10 filtering_non_tests_returns_empty_list(), 11 filtering_tests_returns_list_of_ funs_from_unloaded_binary (),11 filtering_tests_returns_list_of_MFA_from_unloaded_binary (), 12 12 filtering_fixtured_tests_returns_list_of_fixture_fun_tuples (), 13 13 filtering_understands_mixed_export_and_fixtured_tests (), … … 18 18 {eg_code, []} = tests: filter_by_attribute (Binary). 19 19 20 filtering_tests_returns_list_of_ funs_from_unloaded_binary () ->20 filtering_tests_returns_list_of_MFA_from_unloaded_binary () -> 21 21 File_name = "../fix/eg_test.erl", 22 22 Test = fun ([Ok, Nok]) -> 23 ok = Ok (), 24 {'EXIT', {{badmatch, nok}, _}} = (catch Nok ()) 23 {Ok_m, Ok_f, Ok_a} = Ok, 24 ok = apply (Ok_m, Ok_f, Ok_a), 25 {Nok_m, Nok_f, Nok_a} = Nok, 26 Error = (catch apply (Nok_m, Nok_f, Nok_a)), 27 {'EXIT', {{badmatch, nok}, _}} = Error 25 28 end, 26 29 filtering (File_name, eg_test, Test). … … 36 39 File_name = "../fix/eg_test_fix_nofix.erl", 37 40 Test = fun ([{Module, Fixture, With}, Without]) -> 38 {'EXIT', {Reason, _}} = (catch Without ()), 41 {Wo_m, Wo_f, Wo_a} = Without, 42 {'EXIT', {Reason, _}} = (catch apply (Wo_m, Wo_f, Wo_a)), 39 43 {badmatch, without_fixture_ok} = Reason, 40 44 [ok] = Module: Fixture (With)
Note: See TracChangeset
for help on using the changeset viewer.
