aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common_test/src')
-rwxr-xr-xlib/common_test/src/ct_config.erl43
-rw-r--r--lib/common_test/src/ct_testspec.erl2
2 files changed, 28 insertions, 17 deletions
diff --git a/lib/common_test/src/ct_config.erl b/lib/common_test/src/ct_config.erl
index 6fd89c5617..312dc8782f 100755
--- a/lib/common_test/src/ct_config.erl
+++ b/lib/common_test/src/ct_config.erl
@@ -208,7 +208,9 @@ get_config_file_list(Opts)->
read_config_files(Opts) ->
AddCallback = fun(CallBack, [])->
[{CallBack, []}];
- (CallBack, Files)->
+ (CallBack, [F|_]=Files) when is_integer(F)->
+ [{CallBack, Files}];
+ (CallBack, [F|_]=Files) when is_list(F)->
lists:map(fun(X)-> {CallBack, X} end, Files)
end,
ConfigFiles = case lists:keyfind(config, 1, Opts) of
@@ -697,20 +699,31 @@ check_callback_load(Callback)->
end.
check_config_files(Configs)->
- lists:keysearch(error, 1,
- lists:flatten(
- lists:map(fun({Callback, Files})->
- case check_callback_load(Callback) of
- {ok, Callback}->
- lists:map(fun(File)->
- Callback:check_parameter(File)
- end,
- Files);
- {error, _}->
- {error, {callback, Callback}}
- end
- end,
- Configs))).
+ ConfigChecker = fun
+ ({Callback, [F|_R]=Files})->
+ case check_callback_load(Callback) of
+ {ok, Callback}->
+ if
+ is_integer(F)->
+ Callback:check_parameter(Files);
+ is_list(F)->
+ lists:map(fun(File)->
+ Callback:check_parameter(File)
+ end,
+ Files)
+ end;
+ {error, _}->
+ {error, {callback, Callback}}
+ end;
+ ({Callback, []})->
+ case check_callback_load(Callback) of
+ {ok, Callback}->
+ Callback:check_parameter([]);
+ {error, _}->
+ {error, {callback, Callback}}
+ end
+ end,
+ lists:keysearch(error, 1, lists:flatten(lists:map(ConfigChecker, Configs))).
prepare_user_configs([ConfigString|UserConfigs], Acc, new)->
prepare_user_configs(UserConfigs,
diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl
index c07de370b0..028c614991 100644
--- a/lib/common_test/src/ct_testspec.erl
+++ b/lib/common_test/src/ct_testspec.erl
@@ -306,8 +306,6 @@ get_global([{node,Ref,Node}|Ts],Spec=#testspec{nodes=Refs}) ->
get_global([_|Ts],Spec) -> get_global(Ts,Spec);
get_global([],Spec) -> Spec.
-% TODO probably we can terminate here, if any problem with the filename
-% anyway, later ct_run will do it for us :-)
get_absfile(Callback, FullName,#testspec{spec_dir=SpecDir}) ->
% we need to temporary switch to new cwd here, because
% otherwise config files cannot be found