aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_testspec.erl
diff options
context:
space:
mode:
authorAndrey Pampukha <[email protected]>2010-03-22 15:28:11 +0100
committerRaimo Niskanen <[email protected]>2010-06-09 16:19:14 +0200
commitb8b5b0d60b90f22db3bcdbb15012636a67ed470a (patch)
tree3280a78c8bd1d8db7c09387f0eda8509df723cee /lib/common_test/src/ct_testspec.erl
parent485a982ef7e7d2ffcdfb2606b6e2f4b66d000bac (diff)
downloadotp-b8b5b0d60b90f22db3bcdbb15012636a67ed470a.tar.gz
otp-b8b5b0d60b90f22db3bcdbb15012636a67ed470a.tar.bz2
otp-b8b5b0d60b90f22db3bcdbb15012636a67ed470a.zip
Update test specifications
Diffstat (limited to 'lib/common_test/src/ct_testspec.erl')
-rw-r--r--lib/common_test/src/ct_testspec.erl36
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl
index 5248a6e319..c07de370b0 100644
--- a/lib/common_test/src/ct_testspec.erl
+++ b/lib/common_test/src/ct_testspec.erl
@@ -22,6 +22,7 @@
%%% <p>This module exports functions that are used within CT to
%%% scan and parse test specifikations.</p>
-module(ct_testspec).
+-compile(export_all).
-export([prepare_tests/1, prepare_tests/2,
collect_tests_from_list/2, collect_tests_from_list/3,
@@ -438,37 +439,44 @@ add_tests([{cover,File}|Ts],Spec) ->
add_tests([{cover,all_nodes,File}|Ts],Spec);
%% --- config ---
-% TODO finish that!
add_tests([{config,all_nodes,Files}|Ts],Spec) ->
- %io:format("1: add_tests([{config,all_nodes,~p}|~p],~p~n", [Files, Ts, Spec]),
- Tests = lists:map(fun(N) -> {config,N,{?ct_config_txt,Files}} end, list_nodes(Spec)),
+ Tests = lists:map(fun(N) -> {config,N,Files} end, list_nodes(Spec)),
add_tests(Tests++Ts,Spec);
add_tests([{config,Nodes,Files}|Ts],Spec) when is_list(Nodes) ->
- %io:format("2: add_tests([{config,~p,~p}|~p],~p) when is_list(Nodes)~n", [Nodes,Files,Spec,Nodes]),
Ts1 = separate(Nodes,config,[Files],Ts,Spec#testspec.nodes),
add_tests(Ts1,Spec);
-add_tests([{config,Node,[{Callback,F}|Fs]}|Ts],Spec) when is_list(F) ->
- %io:format("3: add_tests([{config,~p,[~p|~p]}|~p],~p) when is_list(~p)~n", [Node, F, Fs, Ts, Spec, F]),
+add_tests([{config,Node,[F|Fs]}|Ts],Spec) when is_list(F) ->
Cfgs = Spec#testspec.config,
Node1 = ref2node(Node,Spec#testspec.nodes),
add_tests([{config,Node,Fs}|Ts],
- Spec#testspec{config=[{Node1,{Callback, [get_absfile(Callback, F,Spec)]}}|Cfgs]});
+ Spec#testspec{config=[{Node1,{?ct_config_txt,
+ get_absfile(?ct_config_txt, F,Spec)}}|Cfgs]});
add_tests([{config,_Node,[]}|Ts],Spec) ->
- %io:format("4: add_tests([{config,_,[]}|~p],~p)~n", [Ts, Spec]),
add_tests(Ts,Spec);
add_tests([{config,Node,F}|Ts],Spec) ->
- %io:format("5: add_tests([{config,~p,~p}|~p],~p)~n", [Node, F, Ts, Spec]),
add_tests([{config,Node,[F]}|Ts],Spec);
add_tests([{config,Files}|Ts],Spec) ->
- %io:format("6: add_tests([{config,~p}|~p],~p)~n", [Files, Ts, Spec]),
add_tests([{config,all_nodes,Files}|Ts],Spec);
-% TODO add support for {userconfig, Nodes, {Callback, Files}}
%% --- userconfig ---
-add_tests([{userconfig, {Callback, Files}}|Ts], Spec)->
- %io:format("add_tests([{userconfig, {~p, ~p}}|~p], ~p)~n", [Callback, Files, Ts, Spec]),
- Tests = lists:map(fun(N) -> {config,N,{Callback,Files}} end, list_nodes(Spec)),
+add_tests([{userconfig,all_nodes,CBF}|Ts],Spec) ->
+ Tests = lists:map(fun(N) -> {userconfig,N,CBF} end, list_nodes(Spec)),
add_tests(Tests++Ts,Spec);
+add_tests([{userconfig,Nodes,CBF}|Ts],Spec) when is_list(Nodes) ->
+ Ts1 = separate(Nodes,userconfig,[CBF],Ts,Spec#testspec.nodes),
+ add_tests(Ts1,Spec);
+add_tests([{userconfig,Node,[{Callback, Config}|CBF]}|Ts],Spec) ->
+ Cfgs = Spec#testspec.config,
+ Node1 = ref2node(Node,Spec#testspec.nodes),
+ add_tests([{userconfig,Node,CBF}|Ts],
+ Spec#testspec{config=[{Node1,{Callback,
+ get_absfile(Callback, Config ,Spec)}}|Cfgs]});
+add_tests([{userconfig,_Node,[]}|Ts],Spec) ->
+ add_tests(Ts,Spec);
+add_tests([{userconfig,Node,CBF}|Ts],Spec) ->
+ add_tests([{userconfig,Node,[CBF]}|Ts],Spec);
+add_tests([{userconfig,CBF}|Ts],Spec) ->
+ add_tests([{userconfig,all_nodes,CBF}|Ts],Spec);
%% --- event_handler ---
add_tests([{event_handler,all_nodes,Hs}|Ts],Spec) ->