aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_config.erl
diff options
context:
space:
mode:
authorAndrey Pampukha <[email protected]>2010-03-05 08:48:06 +0100
committerRaimo Niskanen <[email protected]>2010-06-09 16:19:09 +0200
commit2dc962eead182ca5c79c5ac8d9d31a08f22c97af (patch)
tree69e6f58f3eaa1ebf9a83f8a696b7a645212e0f58 /lib/common_test/src/ct_config.erl
parent3237b512933560ea43173847c44d8d8dab93fd3a (diff)
downloadotp-2dc962eead182ca5c79c5ac8d9d31a08f22c97af.tar.gz
otp-2dc962eead182ca5c79c5ac8d9d31a08f22c97af.tar.bz2
otp-2dc962eead182ca5c79c5ac8d9d31a08f22c97af.zip
Fix problems with test specifications
Work in progress...
Diffstat (limited to 'lib/common_test/src/ct_config.erl')
-rwxr-xr-xlib/common_test/src/ct_config.erl22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/common_test/src/ct_config.erl b/lib/common_test/src/ct_config.erl
index 63e44b6301..8e2f71647f 100755
--- a/lib/common_test/src/ct_config.erl
+++ b/lib/common_test/src/ct_config.erl
@@ -188,9 +188,7 @@ process_user_configs(Opts, Acc)->
process_user_configs(NewOpts, [{Callback, Files} | Acc]);
{value, {userconfig, {Callback, File=[C|_]}}, NewOpts} when
is_integer(C)->
- process_user_configs(NewOpts, [{Callback, [File]} | Acc]);
- {value, {userconfig, {_Callback, []}}, NewOpts}->
- process_user_configs(NewOpts, Acc)
+ process_user_configs(NewOpts, [{Callback, [File]} | Acc])
end.
get_config_file_list(Opts)->
@@ -675,12 +673,26 @@ random_bytes(N) ->
random_bytes_1(0, Acc) -> Acc;
random_bytes_1(N, Acc) -> random_bytes_1(N-1, [random:uniform(255)|Acc]).
+check_callback_load(Callback)->
+ case code:is_loaded(Callback) of
+ {file, _Filename}->
+ {ok, Callback};
+ false->
+ case code:load_file(Callback) of
+ {module, Callback}->
+ {ok, Callback};
+ {error, Error}->
+ {error, Error}
+ end
+ end.
+
check_config_files(Configs)->
+ ct:pal("ct_config:check_config_files(~p)", [Configs]),
lists:keysearch(nok, 1,
lists:flatten(
lists:map(fun({Callback, Files})->
- case code:load_file(Callback) of
- {module, Callback}->
+ case check_callback_load(Callback) of
+ {ok, Callback}->
lists:map(fun(File)->
Callback:check_parameter(File)
end,