-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdebug.mk
More file actions
77 lines (74 loc) · 1.85 KB
/
Copy pathdebug.mk
File metadata and controls
77 lines (74 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
define debug-ct.erl
ModuleSource = fun(Module) ->
ModuleInfo = Module:module_info(),
case lists:keyfind(compile, 1, ModuleInfo) of
{compile, Compile} ->
case lists:keyfind(source, 1, Compile) of
{source, Source} ->
Source;
_ ->
unavailable
end;
_ ->
unavailable
end
end,
BreakOn = fun(Flags) ->
i:iaa(Flags)
end,
GetIaa = fun() ->
case int:auto_attach() of
false -> [];
{Flags, _} -> Flags
end
end,
AddBreakpoint = fun
(Module) when is_atom(Module) ->
io:format("Adding breakpoint: modude ~s~n", [Module]),
i:im(),
Src = ModuleSource(Module),
case i:ii(Src) of
{module, _} ->
BreakOn(GetIaa() ++ [init]),
ok;
error -> error
end;
({Module, LineOrLines}) when is_atom(Module) ->
io:format("Adding breakpoint: modude ~s, lines ~p~n", [Module, LineOrLines]),
i:im(),
Src = ModuleSource(Module),
case i:ii(Src) of
{module, _} ->
case LineOrLines of
Line when is_integer(Line) -> i:ib(Module, Line);
Lines when is_list(Lines) -> [i:ib(Module, Line) || Line <- Lines]
end,
BreakOn(GetIaa() ++ [break]),
ok;
error ->
error
end
end,
Breakpoints = [ecucumber_ct_context],
[AddBreakpoint(Breakpoint) || Breakpoint <- Breakpoints],
CTOpts = [
{auto_compile, false},
{dir, "test"},
{logdir, "logs"},
{suite, ecucumber_ct_context_SUITE},
{testcase, add_value_appends_value}
],
case ct:run_test(CTOpts) of
{Ok, Failed, {UserSkipped, AutoSkipped}} ->
io:format("~p ok, ~p failed, ~p user skipped, ~p auto skipped~n", [Ok, Failed, UserSkipped, AutoSkipped]);
{error, Reason} ->
io:format("error: ~p~n", [Reason])
end,
halt()
endef
CT_ERL_OPTS = -noinput \
-pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(APPS_DIR)/*/ebin $(TEST_DIR) \
$(CT_EXTRA) \
$(CT_OPTS)
debug-ct: test-build
$(gen_verbose) $(call erlang,$(call debug-ct.erl,['$(t)']),$(CT_ERL_OPTS))