diff options
Diffstat (limited to 'lib/kernel')
76 files changed, 1889 insertions, 880 deletions
diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index b8db509fa8..4b8f934df1 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/disk_log.xml b/lib/kernel/doc/src/disk_log.xml index 07c1844485..324d4264cf 100644 --- a/lib/kernel/doc/src/disk_log.xml +++ b/lib/kernel/doc/src/disk_log.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1997</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/error_handler.xml b/lib/kernel/doc/src/error_handler.xml index 94824688d1..7f78322472 100644 --- a/lib/kernel/doc/src/error_handler.xml +++ b/lib/kernel/doc/src/error_handler.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1996</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 8e7192a496..aa171c77c2 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -74,6 +74,7 @@ posix() socket() as returned by accept/1,2 and connect/3,4</code> + <marker id="connect"></marker> </section> <funcs> <func> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index a22c0a8346..f05a224f33 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -432,7 +432,7 @@ fe80::204:acff:fe17:bf38 </desc> </func> <func> - <name>port(Socket) -> {ok, Port}</name> + <name>port(Socket) -> {ok, Port} | {error, any()}</name> <fsummary>Return the local port number for a socket</fsummary> <type> <v>Socket = socket()</v> diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index 29580a4cd1..065b24c53d 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -30,6 +30,65 @@ </header> <p>This document describes the changes made to the Kernel application.</p> +<section><title>Kernel 2.14.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + <c>os:find_executable/{1,2}</c> will no longer return the + path of a directory that happens to be in the PATH.</p> + <p> + Own Id: OTP-8983 Aux Id: seq11749 </p> + </item> + <item> + <p> + Fix -spec for file:write_file/3</p> + <p> + Change type for second parameter from binary() to + iodata(), since the function explicitly takes steps to + accept lists as well as binaries. (thanks to Magnus + Henoch).</p> + <p> + Own Id: OTP-9067</p> + </item> + <item> + <p> + Sanitize the specs of the code module</p> + <p> + After the addition of unicode_binary() to the + file:filename() type, dialyzer started complaining about + erroneous or incomplete specs in some functions of the + 'code' module. The culprit was hard-coded information in + erl_bif_types for functions of this module, which were + not updated. Since these functions have proper specs + these days and code duplication (pun intended) is never a + good idea, their type information was removed from + erl_bif_types.</p> + <p> + While doing this, some erroneous comments were fixed in + the code module and also made sure that the code now runs + without dialyzer warnings even when the + -Wunmatched_returns option is used.</p> + <p> + Some cleanups were applied to erl_bif_types too.</p> + <p> + Own Id: OTP-9100</p> + </item> + <item> + <p> + - Add spec for function that does not return - Strenghen + spec - Introduce types to avoid duplication in specs - + Add specs for functions that do not return - Add specs + for behaviour callbacks - Simplify two specs</p> + <p> + Own Id: OTP-9127</p> + </item> + </list> + </section> + +</section> + <section><title>Kernel 2.14.2</title> <section><title>Improvements and New Features</title> diff --git a/lib/kernel/doc/src/part_notes_history.xml b/lib/kernel/doc/src/part_notes_history.xml index 07c7e4abea..a73cc911b8 100644 --- a/lib/kernel/doc/src/part_notes_history.xml +++ b/lib/kernel/doc/src/part_notes_history.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2006</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/rpc.xml b/lib/kernel/doc/src/rpc.xml index 86c6ea9178..2b81de170d 100644 --- a/lib/kernel/doc/src/rpc.xml +++ b/lib/kernel/doc/src/rpc.xml @@ -454,7 +454,7 @@ </desc> </func> <func> - <name>pmap({Module, Function}, ExtraArgs, List2) -> List1</name> + <name>pmap({Module, Function}, ExtraArgs, List1) -> List2</name> <fsummary>Parallell evaluation of mapping a function over a list </fsummary> <type> <v>Module = Function = atom()</v> diff --git a/lib/kernel/doc/src/user.xml b/lib/kernel/doc/src/user.xml index d9de2f4b04..4d0f044321 100644 --- a/lib/kernel/doc/src/user.xml +++ b/lib/kernel/doc/src/user.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1996</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl index d9db23d652..2a193affd4 100644 --- a/lib/kernel/src/application.erl +++ b/lib/kernel/src/application.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -204,12 +204,12 @@ get_env(Key) -> get_env(Application, Key) -> application_controller:get_env(Application, Key). --spec get_all_env() -> [] | [{atom(), any()}]. +-spec get_all_env() -> [{atom(), any()}]. get_all_env() -> application_controller:get_pid_all_env(group_leader()). --spec get_all_env(atom()) -> [] | [{atom(), any()}]. +-spec get_all_env(atom()) -> [{atom(), any()}]. get_all_env(Application) -> application_controller:get_all_env(Application). diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl index feb5131aad..b0f99305f2 100644 --- a/lib/kernel/src/code.erl +++ b/lib/kernel/src/code.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -72,39 +72,42 @@ %% User interface. %% -%% objfile_extension() -> ".beam" -%% set_path(Dir*) -> true -%% get_path() -> Dir* -%% add_path(Dir) -> true | {error, What} -%% add_patha(Dir) -> true | {error, What} -%% add_pathz(Dir) -> true | {error, What} -%% add_paths(DirList) -> true | {error, What} -%% add_pathsa(DirList) -> true | {error, What} -%% add_pathsz(DirList) -> true | {error, What} -%% del_path(Dir) -> true | {error, What} -%% replace_path(Name,Dir) -> true | {error, What} -%% load_file(File) -> {error,What} | {module, Mod} -%% load_abs(File) -> {error,What} | {module, Mod} -%% load_abs(File,Mod) -> {error,What} | {module, Mod} -%% load_binary(Mod,File,Bin) -> {error,What} | {module,Mod} -%% ensure_loaded(Module) -> {error,What} | {module, Mod} -%% delete(Module) -%% purge(Module) kills all procs running old code -%% soft_purge(Module) -> true | false -%% is_loaded(Module) -> {file, File} | false -%% all_loaded() -> {Module, File}* -%% get_object_code(Mod) -> error | {Mod, Bin, Filename} -%% stop() -> true -%% root_dir() -%% compiler_dir() -%% lib_dir() -%% priv_dir(Name) -%% stick_dir(Dir) -> ok | error -%% unstick_dir(Dir) -> ok | error -%% is_sticky(Module) -> true | false -%% which(Module) -> Filename -%% set_primary_archive((FileName, Bin, FileInfo) -> ok | {error, Reason} -%% clash() -> -> print out +%% objfile_extension() -> ".beam" +%% get_path() -> [Dir] +%% set_path([Dir]) -> true | {error, bad_directory | bad_path} +%% add_path(Dir) -> true | {error, bad_directory} +%% add_patha(Dir) -> true | {error, bad_directory} +%% add_pathz(Dir) -> true | {error, bad_directory} +%% add_paths([Dir]) -> ok +%% add_pathsa([Dir]) -> ok +%% add_pathsz([Dir]) -> ok +%% del_path(Dir) -> boolean() | {error, bad_name} +%% replace_path(Name, Dir) -> true | replace_path_error() +%% load_file(Module) -> {module, Module} | {error, What :: atom()} +%% load_abs(File) -> {module, Module} | {error, What :: atom()} +%% load_abs(File, Module) -> {module, Module} | {error, What :: atom()} +%% load_binary(Module, File, Bin)-> {module, Module} | {error, What :: atom()} +%% ensure_loaded(Module) -> {module, Module} | {error, What :: atom()} +%% delete(Module) -> boolean() +%% purge(Module) -> boolean() kills all procs running old code +%% soft_purge(Module) -> boolean() +%% is_loaded(Module) -> {file, loaded_filename()} | false +%% all_loaded() -> [{Module, loaded_filename()}] +%% get_object_code(Module) -> {Module, Bin, Filename} | error +%% stop() -> no_return() +%% root_dir() -> Dir +%% compiler_dir() -> Dir +%% lib_dir() -> Dir +%% lib_dir(Application) -> Dir | {error, bad_name} +%% priv_dir(Application) -> Dir | {error, bad_name} +%% stick_dir(Dir) -> ok | error +%% unstick_dir(Dir) -> ok | error +%% stick_mod(Module) -> true +%% unstick_mod(Module) -> true +%% is_sticky(Module) -> boolean() +%% which(Module) -> Filename | loaded_ret_atoms() | non_existing +%% set_primary_archive((FileName, Bin, FileInfo) -> ok | {error, Reason} +%% clash() -> ok prints out number of clashes %%---------------------------------------------------------------------------- %% Some types for basic exported functions of this module @@ -120,7 +123,7 @@ %% User interface %%---------------------------------------------------------------------------- --spec objfile_extension() -> file:filename(). +-spec objfile_extension() -> nonempty_string(). objfile_extension() -> init:objfile_extension(). @@ -138,21 +141,21 @@ load_abs(File) when is_list(File); is_atom(File) -> call({load_abs,File,[]}). %% XXX Filename is also an atom(), e.g. 'cover_compiled' -spec load_abs(Filename :: loaded_filename(), Module :: atom()) -> load_ret(). -load_abs(File,M) when (is_list(File) orelse is_atom(File)), is_atom(M) -> +load_abs(File, M) when (is_list(File) orelse is_atom(File)), is_atom(M) -> call({load_abs,File,M}). %% XXX Filename is also an atom(), e.g. 'cover_compiled' -spec load_binary(Module :: atom(), Filename :: loaded_filename(), Binary :: binary()) -> load_ret(). -load_binary(Mod,File,Bin) +load_binary(Mod, File, Bin) when is_atom(Mod), (is_list(File) orelse is_atom(File)), is_binary(Bin) -> call({load_binary,Mod,File,Bin}). -spec load_native_partial(Module :: atom(), Binary :: binary()) -> load_ret(). -load_native_partial(Mod,Bin) when is_atom(Mod), is_binary(Bin) -> +load_native_partial(Mod, Bin) when is_atom(Mod), is_binary(Bin) -> call({load_native_partial,Mod,Bin}). -spec load_native_sticky(Module :: atom(), Binary :: binary(), WholeModule :: 'false' | binary()) -> load_ret(). -load_native_sticky(Mod,Bin,WholeModule) +load_native_sticky(Mod, Bin, WholeModule) when is_atom(Mod), is_binary(Bin), (is_binary(WholeModule) orelse WholeModule =:= false) -> call({load_native_sticky,Mod,Bin,WholeModule}). @@ -160,7 +163,7 @@ load_native_sticky(Mod,Bin,WholeModule) -spec delete(Module :: atom()) -> boolean(). delete(Mod) when is_atom(Mod) -> call({delete,Mod}). --spec purge/1 :: (Module :: atom()) -> boolean(). +-spec purge(Module :: atom()) -> boolean(). purge(Mod) when is_atom(Mod) -> call({purge,Mod}). -spec soft_purge(Module :: atom()) -> boolean(). @@ -195,7 +198,7 @@ lib_dir(App, SubDir) when is_atom(App), is_atom(SubDir) -> call({dir,{lib_dir,Ap compiler_dir() -> call({dir,compiler_dir}). %% XXX is_list() is for backwards compatibility -- take out in future version --spec priv_dir(Appl :: atom()) -> file:filename() | {'error', 'bad_name'}. +-spec priv_dir(App :: atom()) -> file:filename() | {'error', 'bad_name'}. priv_dir(App) when is_atom(App) ; is_list(App) -> call({dir,{priv_dir,App}}). -spec stick_dir(Directory :: file:filename()) -> 'ok' | 'error'. @@ -220,13 +223,14 @@ set_path(PathList) when is_list(PathList) -> call({set_path,PathList}). -spec get_path() -> [file:filename()]. get_path() -> call(get_path). --spec add_path(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-type add_path_ret() :: 'true' | {'error', 'bad_directory'}. +-spec add_path(Directory :: file:filename()) -> add_path_ret(). add_path(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_pathz(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-spec add_pathz(Directory :: file:filename()) -> add_path_ret(). add_pathz(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_patha(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-spec add_patha(Directory :: file:filename()) -> add_path_ret(). add_patha(Dir) when is_list(Dir) -> call({add_path,first,Dir}). -spec add_paths(Directories :: [file:filename()]) -> 'ok'. @@ -243,8 +247,8 @@ del_path(Name) when is_list(Name) ; is_atom(Name) -> call({del_path,Name}). -type replace_path_error() :: {'error', 'bad_directory' | 'bad_name' | {'badarg',_}}. -spec replace_path(Name:: atom(), Dir :: file:filename()) -> 'true' | replace_path_error(). -replace_path(Name, Dir) when (is_atom(Name) or is_list(Name)) and - (is_atom(Dir) or is_list(Dir)) -> +replace_path(Name, Dir) when (is_atom(Name) orelse is_list(Name)), + (is_atom(Dir) orelse is_list(Dir)) -> call({replace_path,Name,Dir}). -spec rehash() -> 'ok'. @@ -275,21 +279,14 @@ start_link(Flags) -> do_start(Flags) -> %% The following module_info/1 calls are here to ensure - %% that the modules are loaded prior to their use elsewhere in + %% that these modules are loaded prior to their use elsewhere in %% the code_server. %% Otherwise a deadlock may occur when the code_server is starting. - code_server:module_info(module), - packages:module_info(module), + code_server = code_server:module_info(module), + packages = packages:module_info(module), catch hipe_unified_loader:load_hipe_modules(), - gb_sets:module_info(module), - gb_trees:module_info(module), - - ets:module_info(module), - os:module_info(module), - binary:module_info(module), - unicode:module_info(module), - filename:module_info(module), - lists:module_info(module), + Modules2 = [gb_sets, gb_trees, ets, os, binary, unicode, filename, lists], + lists:foreach(fun (M) -> M = M:module_info(module) end, Modules2), Mode = get_mode(Flags), case init:get_argument(root) of @@ -297,7 +294,7 @@ do_start(Flags) -> Root = filename:join([Root0]), % Normalize. Use filename case code_server:start_link([Root,Mode]) of {ok,_Pid} = Ok2 -> - if + if Mode =:= interactive -> case lists:member(stick, Flags) of true -> do_stick_dirs(); @@ -306,14 +303,14 @@ do_start(Flags) -> true -> ok end, - % Quietly load the native code for all modules loaded so far. + %% Quietly load native code for all modules loaded so far catch load_native_code_for_all_loaded(), Ok2; Other -> Other end; Other -> - error_logger:error_msg("Can not start code server ~w ~n",[Other]), + error_logger:error_msg("Can not start code server ~w ~n", [Other]), {error, crash} end. @@ -330,7 +327,7 @@ do_s(Lib) -> %% The return value is intentionally ignored. Missing %% directories is not a fatal error. (In embedded systems, %% there is usually no compiler directory.) - stick_dir(filename:append(Dir, "ebin")), + _ = stick_dir(filename:append(Dir, "ebin")), ok end. @@ -428,7 +425,7 @@ where_is_file(Path, File) when is_list(Path), is_list(File) -> -spec set_primary_archive(ArchiveFile :: file:filename(), ArchiveBin :: binary(), - FileInfo :: #file_info{}) + FileInfo :: file:file_info()) -> 'ok' | {'error', atom()}. set_primary_archive(ArchiveFile0, ArchiveBin, #file_info{} = FileInfo) @@ -485,13 +482,13 @@ filter(Ext, _, {ok,Files}) -> filter2(Ext, length(Ext), Files). filter2(_Ext, _Extlen, []) -> []; -filter2(Ext, Extlen,[File|Tail]) -> - case has_ext(Ext,Extlen, File) of +filter2(Ext, Extlen, [File|Tail]) -> + case has_ext(Ext, Extlen, File) of true -> [File | filter2(Ext, Extlen, Tail)]; false -> filter2(Ext, Extlen, Tail) end. -has_ext(Ext, Extlen,File) -> +has_ext(Ext, Extlen, File) -> L = length(File), case catch lists:nthtail(L - Extlen, File) of Ext -> true; diff --git a/lib/kernel/src/disk_log_1.erl b/lib/kernel/src/disk_log_1.erl index 8ccdb88d12..266df84a03 100644 --- a/lib/kernel/src/disk_log_1.erl +++ b/lib/kernel/src/disk_log_1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -581,11 +581,13 @@ done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) -> file:delete(OutName), throw(Error) end. - + +-spec repair_err(file:io_device(), #cache{}, file:filename(), + file:filename(), {'error', file:posix()}) -> no_return(). repair_err(In, Out, OutName, ErrFileName, Error) -> file:close(In), catch fclose(Out, OutName), - % OutName is often the culprit, try to remove it anyway... + %% OutName is often the culprit, try to remove it anyway... file:delete(OutName), file_error(ErrFileName, Error). diff --git a/lib/kernel/src/erl_ddll.erl b/lib/kernel/src/erl_ddll.erl index 88f91de24f..ce64589a29 100644 --- a/lib/kernel/src/erl_ddll.erl +++ b/lib/kernel/src/erl_ddll.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% Dynamic Driver Loader and Linker @@ -29,6 +29,11 @@ %%---------------------------------------------------------------------------- +-type path() :: string() | atom(). +-type driver() :: string() | atom(). + +%%---------------------------------------------------------------------------- + -spec start() -> {'error', {'already_started', 'undefined'}}. start() -> @@ -39,13 +44,13 @@ start() -> stop() -> ok. --spec load_driver(Path :: string() | atom(), Driver :: string() | atom()) -> +-spec load_driver(Path :: path(), Driver :: driver()) -> 'ok' | {'error', any()}. load_driver(Path, Driver) -> do_load_driver(Path, Driver, [{driver_options,[kill_ports]}]). --spec load(Path :: string() | atom(), Driver :: string() | atom()) -> +-spec load(Path :: path(), Driver :: driver()) -> 'ok' | {'error', any()}. load(Path, Driver) -> @@ -95,23 +100,23 @@ do_unload_driver(Driver,Flags) -> end end. --spec unload_driver(Driver :: string() | atom()) -> 'ok' | {'error', any()}. +-spec unload_driver(Driver :: driver()) -> 'ok' | {'error', any()}. unload_driver(Driver) -> do_unload_driver(Driver,[{monitor,pending_driver},kill_ports]). --spec unload(Driver :: string() | atom()) -> 'ok' | {'error', any()}. +-spec unload(Driver :: driver()) -> 'ok' | {'error', any()}. unload(Driver) -> do_unload_driver(Driver,[]). --spec reload(Path :: string() | atom(), Driver :: string() | atom()) -> +-spec reload(Path :: path(), Driver :: driver()) -> 'ok' | {'error', any()}. reload(Path,Driver) -> do_load_driver(Path, Driver, [{reload,pending_driver}]). --spec reload_driver(Path :: string() | atom(), Driver :: string() | atom()) -> +-spec reload_driver(Path :: path(), Driver :: driver()) -> 'ok' | {'error', any()}. reload_driver(Path,Driver) -> @@ -122,15 +127,15 @@ reload_driver(Path,Driver) -> format_error(Code) -> case Code of - % This is the only error code returned only from erlang code... - % 'permanent' has a translation in the emulator, even though the erlang code uses it to... + %% This is the only error code returned only from erlang code... + %% 'permanent' has a translation in the emulator, even though the erlang code uses it to... load_cancelled -> "Loading was cancelled from other process"; _ -> erl_ddll:format_error_int(Code) end. --spec info(Driver :: string() | atom()) -> [{atom(), any()}]. +-spec info(Driver :: driver()) -> [{atom(), any()}, ...]. info(Driver) -> [{processes, erl_ddll:info(Driver,processes)}, diff --git a/lib/kernel/src/error_handler.erl b/lib/kernel/src/error_handler.erl index 885eeb2b0f..6f69f4ccb9 100644 --- a/lib/kernel/src/error_handler.erl +++ b/lib/kernel/src/error_handler.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -80,9 +80,13 @@ int() -> int. %% %% Crash providing a beautiful stack backtrace. %% +-spec crash(atom(), [term()]) -> no_return(). + crash(Fun, Args) -> crash({Fun,Args}). +-spec crash(atom(), atom(), arity()) -> no_return(). + crash(M, F, A) -> crash({M,F,A}). diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index bc95359986..88bcf9a9cc 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -240,7 +240,7 @@ write_file(Name, Bin) -> %% when it is time to change file server protocol again. %% Meanwhile, it is implemented here, slightly less efficient. --spec write_file(Name :: name(), Bin :: binary(), Modes :: [mode()]) -> +-spec write_file(Name :: name(), Bin :: iodata(), Modes :: [mode()]) -> 'ok' | {'error', posix()}. write_file(Name, Bin, ModeList) when is_list(ModeList) -> diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl index 081e7e2f93..6343acd000 100644 --- a/lib/kernel/src/global.erl +++ b/lib/kernel/src/global.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -113,8 +113,9 @@ syncers = [] :: [pid()], node_name = node() :: node(), the_locker, the_registrar, trace, - global_lock_down = false + global_lock_down = false :: boolean() }). +-type state() :: #state{}. %%% There are also ETS tables used for bookkeeping of locks and names %%% (the first position is the key): @@ -399,6 +400,9 @@ info() -> %%%----------------------------------------------------------------- %%% Call-back functions from gen_server %%%----------------------------------------------------------------- + +-spec init([]) -> {'ok', state()}. + init([]) -> process_flag(trap_exit, true), _ = ets:new(global_locks, [set, named_table, protected]), @@ -542,6 +546,11 @@ init([]) -> %% sent by each node to all new nodes (Node becomes known to them) %%----------------------------------------------------------------- +-spec handle_call(term(), {pid(), term()}, state()) -> + {'noreply', state()} | + {'reply', term(), state()} | + {'stop', 'normal', 'stopped', state()}. + handle_call({whereis, Name}, From, S) -> do_whereis(Name, From), {noreply, S}; @@ -621,6 +630,9 @@ handle_call(Request, From, S) -> %% init_connect %% %%======================================================================== + +-spec handle_cast(term(), state()) -> {'noreply', state()}. + handle_cast({init_connect, Vsn, Node, InitMsg}, S) -> %% Sent from global_name_server at Node. ?trace({'####', init_connect, {vsn, Vsn}, {node,Node},{initmsg,InitMsg}}), @@ -782,6 +794,11 @@ handle_cast(Request, S) -> "handle_cast(~p, _)\n", [Request]), {noreply, S}. +%%======================================================================== + +-spec handle_info(term(), state()) -> + {'noreply', state()} | {'stop', term(), state()}. + handle_info({'EXIT', Locker, _Reason}=Exit, #state{the_locker=Locker}=S) -> {stop, {locker_died,Exit}, S#state{the_locker=undefined}}; handle_info({'EXIT', Registrar, _}=Exit, #state{the_registrar=Registrar}=S) -> @@ -1122,12 +1139,17 @@ do_whereis(Name, From) -> send_again({whereis, Name, From}) end. +-spec terminate(term(), state()) -> 'ok'. + terminate(_Reason, _S) -> true = ets:delete(global_names), true = ets:delete(global_names_ext), true = ets:delete(global_locks), true = ets:delete(global_pid_names), - true = ets:delete(global_pid_ids). + true = ets:delete(global_pid_ids), + ok. + +-spec code_change(term(), state(), term()) -> {'ok', state()}. code_change(_OldVsn, S, _Extra) -> {ok, S}. @@ -1955,7 +1977,7 @@ delete_lock(Ref, S0) -> Locks = pid_locks(Ref), F = fun({ResourceId, LockRequesterId, PidRefs}, S) -> {Pid, _RPid, Ref} = lists:keyfind(Ref, 3, PidRefs), - remove_lock(ResourceId, LockRequesterId, Pid, PidRefs, true,S) + remove_lock(ResourceId, LockRequesterId, Pid, PidRefs, true, S) end, lists:foldl(F, S0, Locks). diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index fab00bbb9f..b9c4fa607c 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -162,8 +162,8 @@ do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) -> inet:getll(S) end, f_address = fun get_remote_id/2, - mf_tick = {?MODULE, tick}, - mf_getstat = {?MODULE,getstat} + mf_tick = fun ?MODULE:tick/1, + mf_getstat = fun ?MODULE:getstat/1 }, dist_util:handshake_other_started(HSData); {false,IP} -> diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl index f5e2820bbe..49a02359b0 100644 --- a/lib/kernel/src/net_kernel.erl +++ b/lib/kernel/src/net_kernel.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -322,24 +322,19 @@ init({Name, LongOrShortNames, TickT}) -> process_flag(priority, max), Ticktime = to_integer(TickT), Ticker = spawn_link(net_kernel, ticker, [self(), Ticktime]), - case auth:get_cookie(Node) of - Cookie when is_atom(Cookie) -> - {ok, #state{name = Name, - node = Node, - type = LongOrShortNames, - tick = #tick{ticker = Ticker, time = Ticktime}, - connecttime = connecttime(), - connections = - ets:new(sys_dist,[named_table, - protected, - {keypos, 2}]), - listen = Listeners, - allowed = [], - verbose = 0 - }}; - _ELSE -> - {stop, {error,{bad_cookie, Node}}} - end; + {ok, #state{name = Name, + node = Node, + type = LongOrShortNames, + tick = #tick{ticker = Ticker, time = Ticktime}, + connecttime = connecttime(), + connections = + ets:new(sys_dist,[named_table, + protected, + {keypos, 2}]), + listen = Listeners, + allowed = [], + verbose = 0 + }}; Error -> {stop, Error} end. diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index 75a11a8afd..d1feae771d 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -82,8 +82,9 @@ verify_executable(Name0, [Ext|Rest], OrigExtensions) -> end; _ -> case file:read_file_info(Name1) of - {ok, #file_info{mode=Mode}} when Mode band 8#111 =/= 0 -> - %% XXX This test for execution permission is not full-proof + {ok, #file_info{type=regular,mode=Mode}} + when Mode band 8#111 =/= 0 -> + %% XXX This test for execution permission is not fool-proof %% on Unix, since we test if any execution bit is set. {ok, Name1}; _ -> @@ -136,7 +137,7 @@ reverse_element([$"|T]) -> %" reverse_element(List) -> lists:reverse(List). --spec extensions() -> [string()]. +-spec extensions() -> [string(),...]. %% Extensions in lower case extensions() -> case type() of @@ -230,9 +231,13 @@ start_port_srv(Request) -> catch error:_ -> false end, - start_port_srv_loop(Request, StayAlive). + start_port_srv_handle(Request), + case StayAlive of + true -> start_port_srv_loop(); + false -> exiting + end. -start_port_srv_loop({Ref,Client}, StayAlive) -> +start_port_srv_handle({Ref,Client}) -> Reply = try open_port({spawn, ?SHELL},[stream]) of Port when is_port(Port) -> (catch port_connect(Port, Client)), @@ -242,20 +247,18 @@ start_port_srv_loop({Ref,Client}, StayAlive) -> error:Reason -> {Reason,erlang:get_stacktrace()} end, - Client ! {Ref,Reply}, - case StayAlive of - true -> start_port_srv_loop(get_open_port_request(), true); - false -> exiting - end. + Client ! {Ref,Reply}. -get_open_port_request() -> + +start_port_srv_loop() -> receive {Ref, Client} = Request when is_reference(Ref), is_pid(Client) -> - Request; + start_port_srv_handle(Request); _Junk -> - get_open_port_request() - end. + ignore + end, + start_port_srv_loop(). %% %% unix_get_data(Port) -> Result diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile index f84b343de8..95517ffd6a 100644 --- a/lib/kernel/test/Makefile +++ b/lib/kernel/test/Makefile @@ -142,9 +142,9 @@ release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(ERL_FILES) $(RELSYSDIR) $(INSTALL_DATA) $(APP_FILES) $(RELSYSDIR) - $(INSTALL_DATA) kernel.dynspec $(EMAKEFILE)\ + $(INSTALL_DATA) kernel.spec $(EMAKEFILE)\ $(COVERFILE) $(RELSYSDIR) - chmod -f -R u+w $(RELSYSDIR) + chmod -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) release_docs_spec: diff --git a/lib/kernel/test/appinc1.erl b/lib/kernel/test/appinc1.erl index 8456b0eac2..343fefb25c 100644 --- a/lib/kernel/test/appinc1.erl +++ b/lib/kernel/test/appinc1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/appinc1x.erl b/lib/kernel/test/appinc1x.erl index 2e177727f2..8c144676ac 100644 --- a/lib/kernel/test/appinc1x.erl +++ b/lib/kernel/test/appinc1x.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/appinc2.erl b/lib/kernel/test/appinc2.erl index e41d58bb71..d2e0305109 100644 --- a/lib/kernel/test/appinc2.erl +++ b/lib/kernel/test/appinc2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/appinc2A.erl b/lib/kernel/test/appinc2A.erl index b51a1f5035..604e31e3d3 100644 --- a/lib/kernel/test/appinc2A.erl +++ b/lib/kernel/test/appinc2A.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/appinc2B.erl b/lib/kernel/test/appinc2B.erl index cafb061ae3..abb60010aa 100644 --- a/lib/kernel/test/appinc2B.erl +++ b/lib/kernel/test/appinc2B.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/appinc2top.erl b/lib/kernel/test/appinc2top.erl index 5bd19a59e7..5a8d0d6687 100644 --- a/lib/kernel/test/appinc2top.erl +++ b/lib/kernel/test/appinc2top.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl index 313b50f976..4ae4151004 100644 --- a/lib/kernel/test/application_SUITE.erl +++ b/lib/kernel/test/application_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,9 +18,11 @@ %% -module(application_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, failover/1, failover_comp/1, permissions/1, load/1, reported_bugs/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + failover/1, failover_comp/1, permissions/1, load/1, load_use_cache/1, otp_1586/1, otp_2078/1, otp_2012/1, otp_2718/1, otp_2973/1, otp_3002/1, otp_3184/1, otp_4066/1, otp_4227/1, otp_5363/1, @@ -30,23 +32,46 @@ nodedown_start/1, init2973/0, loop2973/0, loop5606/1]). -export([config_change/1, - distr_changed/1, distr_changed_tc1/1, distr_changed_tc2/1, + distr_changed_tc1/1, distr_changed_tc2/1, shutdown_func/1, do_shutdown/1]). -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). --export([init_per_testcase/2, fin_per_testcase/2, start_type/0, +-export([init_per_testcase/2, end_per_testcase/2, start_type/0, start_phase/0, conf_change/0]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(2)). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [failover, failover_comp, permissions, load, - load_use_cache, reported_bugs, - start_phases, script_start, nodedown_start, - permit_false_start_local, permit_false_start_dist, - get_key, distr_changed, config_change, shutdown_func]. + load_use_cache, {group, reported_bugs}, start_phases, + script_start, nodedown_start, permit_false_start_local, + permit_false_start_dist, get_key, + {group, distr_changed}, config_change, shutdown_func]. + +groups() -> + [{reported_bugs, [], + [otp_1586, otp_2078, otp_2012, otp_2718, otp_2973, + otp_3002, otp_3184, otp_4066, otp_4227, otp_5363, + otp_5606]}, + {distr_changed, [], + [distr_changed_tc1, distr_changed_tc2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(otp_2973=Case, Config) -> @@ -57,12 +82,12 @@ init_per_testcase(Case, Config) -> ?line Dog = test_server:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog}|Config]. -fin_per_testcase(otp_2973, Config) -> +end_per_testcase(otp_2973, Config) -> code:del_path(?config(data_dir,Config)), Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok; -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -932,9 +957,6 @@ nodedown_start(Conf) when is_list(Conf) -> %%%----------------------------------------------------------------- %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> [otp_1586, otp_2078, otp_2012, otp_2718, - otp_2973, otp_3002, otp_3184, otp_4066, - otp_4227, otp_5363, otp_5606]. %%----------------------------------------------------------------- %% Ticket: OTP-1586 @@ -1589,7 +1611,6 @@ get_key(Conf) when is_list(Conf) -> %%%----------------------------------------------------------------- %%% Testing of change of distributed parameter. %%%----------------------------------------------------------------- -distr_changed(suite) -> [distr_changed_tc1, distr_changed_tc2]. distr_changed_tc1(suite) -> []; distr_changed_tc1(doc) -> ["Test change of distributed parameter."]; diff --git a/lib/kernel/test/bif_SUITE.erl b/lib/kernel/test/bif_SUITE.erl index ae2a3a08ff..6276270d20 100644 --- a/lib/kernel/test/bif_SUITE.erl +++ b/lib/kernel/test/bif_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -17,15 +17,16 @@ %% %CopyrightEnd% %% -module(bif_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([spawn_tests/1, +-export([ spawn1/1, spawn2/1, spawn3/1, spawn4/1, - spawn_link_tests/1, + spawn_link1/1, spawn_link2/1, spawn_link3/1, spawn_link4/1, - spawn_opt_tests/1, + spawn_opt2/1, spawn_opt3/1, spawn_opt4/1, spawn_opt5/1, spawn_failures/1, @@ -33,9 +34,9 @@ run_fun/1, wilderness/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -43,25 +44,36 @@ init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [spawn_tests, spawn_link_tests, spawn_opt_tests, spawn_failures, wilderness]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -spawn_tests(doc) -> ["Test spawn"]; -spawn_tests(suite) -> - [spawn1, spawn2, spawn3, spawn4]. +all() -> + [{group, spawn_tests}, {group, spawn_link_tests}, + {group, spawn_opt_tests}, spawn_failures, wilderness]. -spawn_link_tests(doc) -> ["Test spawn_link"]; -spawn_link_tests(suite) -> - [spawn_link1, spawn_link2, spawn_link3, spawn_link4]. +groups() -> + [{spawn_tests, [], [spawn1, spawn2, spawn3, spawn4]}, + {spawn_link_tests, [], + [spawn_link1, spawn_link2, spawn_link3, spawn_link4]}, + {spawn_opt_tests, [], + [spawn_opt2, spawn_opt3, spawn_opt4, spawn_opt5]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -spawn_opt_tests(doc) -> ["Test spawn_opt"]; -spawn_opt_tests(suite) -> - [spawn_opt2, spawn_opt3, spawn_opt4, spawn_opt5]. spawn1(doc) -> ["Test spawn/1"]; spawn1(suite) -> diff --git a/lib/kernel/test/ch.erl b/lib/kernel/test/ch.erl index 25d1b4354c..25d6f6d200 100644 --- a/lib/kernel/test/ch.erl +++ b/lib/kernel/test/ch.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/ch_sup.erl b/lib/kernel/test/ch_sup.erl index 9d03628839..4c923b2909 100644 --- a/lib/kernel/test/ch_sup.erl +++ b/lib/kernel/test/ch_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/cleanup.erl b/lib/kernel/test/cleanup.erl index 831ceba8f5..01db1e9124 100644 --- a/lib/kernel/test/cleanup.erl +++ b/lib/kernel/test/cleanup.erl @@ -18,11 +18,22 @@ %% -module(cleanup). --export([all/1, cleanup/1]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2, cleanup/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +all() -> + [cleanup]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> {req, [kernel], [cleanup]}. cleanup(suite) -> []; cleanup(_) -> diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index e52f8a0e37..3ad49254f1 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,9 +18,9 @@ %% -module(code_SUITE). --include("test_server.hrl"). -%-compile(export_all). --export([all/1]). +-include_lib("test_server/include/test_server.hrl"). + +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -export([set_path/1, get_path/1, add_path/1, add_paths/1, del_path/1, replace_path/1, load_file/1, load_abs/1, ensure_loaded/1, delete/1, purge/1, soft_purge/1, is_loaded/1, all_loaded/1, @@ -34,7 +34,7 @@ big_boot_embedded/1, on_load_embedded/1, on_load_errors/1, native_early_modules/1]). --export([init_per_testcase/2, fin_per_testcase/2, +-export([init_per_testcase/2, end_per_testcase/2, init_per_suite/1, end_per_suite/1, sticky_compiler/1]). @@ -43,19 +43,29 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [set_path, get_path, add_path, add_paths, del_path, replace_path, load_file, load_abs, ensure_loaded, delete, purge, soft_purge, is_loaded, all_loaded, load_binary, dir_req, object_code, set_path_file, - pa_pz_option, add_del_path, - dir_disappeared, ext_mod_dep, clash, - load_cached, start_node_with_cache, add_and_rehash, - where_is_file_no_cache, where_is_file_cached, - purge_stacktrace, mult_lib_roots, bad_erl_libs, - code_archive, code_archive2, on_load, on_load_embedded, - big_boot_embedded, - on_load_errors, native_early_modules]. + pa_pz_option, add_del_path, dir_disappeared, + ext_mod_dep, clash, load_cached, start_node_with_cache, + add_and_rehash, where_is_file_no_cache, + where_is_file_cached, purge_stacktrace, mult_lib_roots, + bad_erl_libs, code_archive, code_archive2, on_load, + on_load_embedded, big_boot_embedded, on_load_errors, + native_early_modules]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. init_per_suite(Config) -> %% The compiler will no longer create a Beam file if @@ -76,7 +86,18 @@ init_per_testcase(_Func, Config) -> P=code:get_path(), P=code:get_path(), [{watchdog, Dog}, {code_path, P}|Config]. -fin_per_testcase(_Func, Config) -> + +end_per_testcase(TC, Config) when TC == mult_lib_roots; + TC == big_boot_embedded -> + {ok, HostName} = inet:gethostname(), + NodeName = list_to_atom(atom_to_list(TC)++"@"++HostName), + ?t:stop_node(NodeName), + end_per_testcase(Config); +end_per_testcase(_Func, Config) -> + end_per_testcase(Config). + +end_per_testcase(Config) -> + code:purge(code_b_test), Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), P=?config(code_path, Config), @@ -906,6 +927,8 @@ add_and_rehash(Config) when is_list(Config) -> ?line true = rpc:call(Node, code, add_path, [OkDir]), ?line {error,_} = rpc:call(Node, code, add_path, [BadDir]), ?line ok = rpc:call(Node, code, rehash, []), + + ?t:stop_node(Node), ok. where_is_file_no_cache(suite) -> @@ -1007,9 +1030,9 @@ mult_lib_roots(Config) when is_list(Config) -> ?t:start_node(mult_lib_roots, slave, [{args,"-env ERL_LIBS "++ErlLibs}]), - ?line {ok,Cwd} = file:get_cwd(), + ?line TSPath = filename:dirname(code:which(test_server)), ?line Path0 = rpc:call(Node, code, get_path, []), - ?line [Cwd,"."|Path1] = Path0, + ?line [TSPath,"."|Path1] = Path0, ?line [Kernel|Path2] = Path1, ?line [Stdlib|Path3] = Path2, ?line mult_lib_verify_lib(Kernel, "kernel"), @@ -1028,7 +1051,6 @@ mult_lib_roots(Config) when is_list(Config) -> ?line true = rpc:call(Node, code_SUITE_mult_root_module, works_fine, []), - ?line ?t:stop_node(Node), ok. mult_lib_compile(Root, Last) -> diff --git a/lib/kernel/test/code_a_test.erl b/lib/kernel/test/code_a_test.erl index 745bbf032c..22830fff53 100644 --- a/lib/kernel/test/code_a_test.erl +++ b/lib/kernel/test/code_a_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/code_b_test.erl b/lib/kernel/test/code_b_test.erl index 0f0107a2b4..a8ff570e2e 100644 --- a/lib/kernel/test/code_b_test.erl +++ b/lib/kernel/test/code_b_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl index 1bfe76f5ea..4ae47b4762 100644 --- a/lib/kernel/test/disk_log_SUITE.erl +++ b/lib/kernel/test/disk_log_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -28,46 +28,47 @@ -define(config(X,Y), foo). -define(t,test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -define(datadir(Conf), ?config(data_dir, Conf)). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, - halt_int/1, halt_int_inf/1, halt_int_sz/1, + halt_int_inf/1, halt_int_sz_1/1, halt_int_sz_2/1, - read_mode/1, halt_int_ro/1, halt_ext_ro/1, wrap_int_ro/1, + halt_int_ro/1, halt_ext_ro/1, wrap_int_ro/1, wrap_ext_ro/1, halt_trunc/1, halt_misc/1, halt_ro_alog/1, halt_ro_balog/1, halt_ro_crash/1, - wrap_int/1, wrap_int_1/1, wrap_int_2/1, inc_wrap_file/1, + wrap_int_1/1, wrap_int_2/1, inc_wrap_file/1, - halt_ext/1, halt_ext_inf/1, + halt_ext_inf/1, - halt_ext_sz/1, halt_ext_sz_1/1, halt_ext_sz_2/1, + halt_ext_sz_1/1, halt_ext_sz_2/1, - wrap_ext/1, wrap_ext_1/1, wrap_ext_2/1, + wrap_ext_1/1, wrap_ext_2/1, - head/1, head_func/1, plain_head/1, one_header/1, + head_func/1, plain_head/1, one_header/1, - notif/1, wrap_notif/1, full_notif/1, trunc_notif/1, blocked_notif/1, + wrap_notif/1, full_notif/1, trunc_notif/1, blocked_notif/1, new_idx_vsn/1, reopen/1, - block/1, block_blocked/1, block_queue/1, block_queue2/1, + block_blocked/1, block_queue/1, block_queue2/1, unblock/1, - open/1, open_overwrite/1, open_size/1, open_truncate/1, open_error/1, + open_overwrite/1, open_size/1, open_truncate/1, open_error/1, - close/1, close_race/1, close_block/1, close_deadlock/1, + close_race/1, close_block/1, close_deadlock/1, - error/1, error_repair/1, error_log/1, error_index/1, + error_repair/1, error_log/1, error_index/1, chunk/1, @@ -75,15 +76,15 @@ many_users/1, - info/1, info_current/1, + info_current/1, - change_size/1, change_size_before/1, change_size_during/1, + change_size_before/1, change_size_during/1, change_size_after/1, default_size/1, change_size2/1, change_size_truncate/1, change_attribute/1, - distribution/1, dist_open/1, dist_error_open/1, dist_notify/1, + dist_open/1, dist_error_open/1, dist_notify/1, dist_terminate/1, dist_accessible/1, dist_deadlock/1, dist_open2/1, other_groups/1, @@ -94,7 +95,7 @@ -export([head_fun/1, hf/0, lserv/1, measure/0, init_m/1, xx/0, head_exit/0, slow_header/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([try_unblock/1]). @@ -142,8 +143,59 @@ change_size_after, default_size]). -all(suite) -> - ?ALL_TESTS. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, halt_int}, {group, wrap_int}, + {group, halt_ext}, {group, wrap_ext}, + {group, read_mode}, {group, head}, {group, notif}, + new_idx_vsn, reopen, {group, block}, unblock, + {group, open}, {group, close}, {group, error}, chunk, + truncate, many_users, {group, info}, + {group, change_size}, change_attribute, + {group, distribution}, evil, otp_6278]. + +groups() -> + [{halt_int, [], [halt_int_inf, {group, halt_int_sz}]}, + {halt_int_sz, [], [halt_int_sz_1, halt_int_sz_2]}, + {read_mode, [], + [halt_int_ro, halt_ext_ro, wrap_int_ro, wrap_ext_ro, + halt_trunc, halt_misc, halt_ro_alog, halt_ro_balog, + halt_ro_crash]}, + {wrap_int, [], [wrap_int_1, wrap_int_2, inc_wrap_file]}, + {halt_ext, [], [halt_ext_inf, {group, halt_ext_sz}]}, + {halt_ext_sz, [], [halt_ext_sz_1, halt_ext_sz_2]}, + {wrap_ext, [], [wrap_ext_1, wrap_ext_2]}, + {head, [], [head_func, plain_head, one_header]}, + {notif, [], + [wrap_notif, full_notif, trunc_notif, blocked_notif]}, + {block, [], [block_blocked, block_queue, block_queue2]}, + {open, [], + [open_overwrite, open_size, open_truncate, open_error]}, + {close, [], [close_race, close_block, close_deadlock]}, + {error, [], [error_repair, error_log, error_index]}, + {info, [], [info_current]}, + {change_size, [], + [change_size_before, change_size_during, + change_size_after, default_size, change_size2, + change_size_truncate]}, + {distribution, [], + [dist_open, dist_error_open, dist_notify, + dist_terminate, dist_accessible, dist_deadlock, + dist_open2, other_groups]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Case, Config) -> @@ -167,12 +219,11 @@ init_per_testcase(Case, Config) -> [{watchdog, Dog}|Config] end. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -halt_int(suite) -> [halt_int_inf, halt_int_sz]. halt_int_inf(suite) -> []; halt_int_inf(doc) -> ["Test simple halt disk log, size infinity"]; @@ -187,7 +238,6 @@ halt_int_inf(Conf) when is_list(Conf) -> ?line ok = disk_log:close(a), ?line ok = file:delete(File). -halt_int_sz(suite) -> [halt_int_sz_1, halt_int_sz_2]. halt_int_sz_1(suite) -> []; halt_int_sz_1(doc) -> ["Test simple halt disk log, size defined"]; @@ -275,10 +325,6 @@ halt_int_sz_2(Conf) when is_list(Conf) -> ?line ok = file:delete(File3), ok. -read_mode(suite) -> [halt_int_ro, halt_ext_ro, - wrap_int_ro, wrap_ext_ro, - halt_trunc, halt_misc, halt_ro_alog, halt_ro_balog, - halt_ro_crash]. halt_int_ro(suite) -> []; halt_int_ro(doc) -> ["Test simple halt disk log, read only, internal"]; @@ -480,7 +526,6 @@ halt_ro_crash(Conf) when is_list(Conf) -> -wrap_int(suite) -> [wrap_int_1, wrap_int_2, inc_wrap_file]. wrap_int_1(suite) -> []; wrap_int_1(doc) -> ["Test wrap disk log, internal"]; @@ -628,7 +673,6 @@ inc_wrap_file(Conf) when is_list(Conf) -> -halt_ext(suite) -> [halt_ext_inf, halt_ext_sz]. halt_ext_inf(suite) -> []; halt_ext_inf(doc) -> ["Test halt disk log, external, infinity"]; @@ -642,7 +686,6 @@ halt_ext_inf(Conf) when is_list(Conf) -> ?line ok = disk_log:close(a), ?line ok = file:delete(File). -halt_ext_sz(suite) -> [halt_ext_sz_1, halt_ext_sz_2]. halt_ext_sz_1(suite) -> []; halt_ext_sz_1(doc) -> ["Test halt disk log, external, size defined"]; @@ -734,7 +777,6 @@ halt_ext_sz_2(Conf) when is_list(Conf) -> ?line ok = file:delete(File3), ok. -wrap_ext(suite) -> [wrap_ext_1, wrap_ext_2]. wrap_ext_1(suite) -> []; wrap_ext_1(doc) -> ["Test wrap disk log, external, size defined"]; @@ -1147,7 +1189,6 @@ end_times({T1,W1}) -> {W2, _} = statistics(wall_clock), {T2-T1, W2-W1}. -head(suite) -> [head_func, plain_head, one_header]. head_func(suite) -> []; head_func(doc) -> ["Test head parameter"]; @@ -1327,8 +1368,6 @@ one_header(Conf) when is_list(Conf) -> ok. -notif(suite) -> [wrap_notif, full_notif, trunc_notif, - blocked_notif]. wrap_notif(suite) -> []; wrap_notif(doc) -> ["Test notify parameter, wrap"]; @@ -1553,7 +1592,6 @@ reopen(Conf) when is_list(Conf) -> ?line Q = qlen(), ok. -block(suite) -> [block_blocked, block_queue, block_queue2]. block_blocked(suite) -> []; block_blocked(doc) -> @@ -1826,8 +1864,6 @@ try_unblock(Log) -> ?line Error = {error, {not_blocked_by_pid, n}} = disk_log:unblock(Log), ?line "The disk log" ++ _ = format_error(Error). -open(suite) -> [open_overwrite, open_size, - open_truncate, open_error]. open_overwrite(suite) -> []; open_overwrite(doc) -> @@ -2075,7 +2111,6 @@ open_error(Conf) when is_list(Conf) -> ?line del(File, No). -close(suite) -> [close_race, close_block, close_deadlock]. close_race(suite) -> []; close_race(doc) -> @@ -2497,7 +2532,6 @@ lserv(Log) -> end, lserv(Log). -error(suite) -> [error_repair, error_log, error_index]. error_repair(suite) -> []; error_repair(doc) -> @@ -3215,7 +3249,6 @@ del_files(_Size, File) -> -info(suite) -> [info_current]. info_current(suite) -> []; info_current(doc) -> @@ -3420,11 +3453,6 @@ info_current(Conf) when is_list(Conf) -> ok. -change_size(suite) -> [change_size_before, - change_size_during, - change_size_after, - default_size, change_size2, - change_size_truncate]. change_size_before(suite) -> []; change_size_before(doc) -> @@ -4094,13 +4122,6 @@ change_attribute(Conf) when is_list(Conf) -> ?line Q = qlen(), ?line del(File, No). -distribution(suite) -> [dist_open, dist_error_open, - dist_notify, - dist_terminate, - dist_accessible, - dist_deadlock, - dist_open2, - other_groups]. dist_open(suite) -> []; dist_open(doc) -> diff --git a/lib/kernel/test/erl_boot_server_SUITE.erl b/lib/kernel/test/erl_boot_server_SUITE.erl index 241d68fef4..cea3715ce4 100644 --- a/lib/kernel/test/erl_boot_server_SUITE.erl +++ b/lib/kernel/test/erl_boot_server_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,9 +18,9 @@ %% -module(erl_boot_server_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). -export([start/1, start_link/1, stop/1, add/1, delete/1, responses/1]). @@ -33,9 +33,27 @@ %% Changed for the new erl_boot_server for R3A by Bjorn Gustavsson. %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [start, start_link, stop, add, delete, responses]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + -define(all_ones, {255, 255, 255, 255}). start(doc) -> "Tests the erl_boot_server:start/1 function."; diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl index a215ec3608..9cccdab76b 100644 --- a/lib/kernel/test/erl_distribution_SUITE.erl +++ b/lib/kernel/test/erl_distribution_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,13 +19,14 @@ -module(erl_distribution_SUITE). %-define(line_trace, 1). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([tick/1, tick_change/1, illegal_nodenames/1, hidden_node/1, table_waste/1, net_setuptime/1, - monitor_nodes/1, + monitor_nodes_nodedown_reason/1, monitor_nodes_complex_nodedown_reason/1, monitor_nodes_node_type/1, @@ -41,7 +42,7 @@ tick_serv_test/2, tick_serv_test1/1, keep_conn/1, time_ping/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([start_node/2]). @@ -57,16 +58,39 @@ %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [tick, tick_change, illegal_nodenames, hidden_node, - table_waste, net_setuptime, - monitor_nodes]. + table_waste, net_setuptime, {group, monitor_nodes}]. + +groups() -> + [{monitor_nodes, [], + [monitor_nodes_nodedown_reason, + monitor_nodes_complex_nodedown_reason, + monitor_nodes_node_type, monitor_nodes_misc, + monitor_nodes_otp_6481, monitor_nodes_errors, + monitor_nodes_combinations, monitor_nodes_cleanup, + monitor_nodes_many]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(4)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -530,18 +554,6 @@ check_monitor_nodes_res(Pid, Node) -> end. -monitor_nodes(doc) -> - []; -monitor_nodes(suite) -> - [monitor_nodes_nodedown_reason, - monitor_nodes_complex_nodedown_reason, - monitor_nodes_node_type, - monitor_nodes_misc, - monitor_nodes_otp_6481, - monitor_nodes_errors, - monitor_nodes_combinations, - monitor_nodes_cleanup, - monitor_nodes_many]. %% %% Testcase: @@ -853,7 +865,7 @@ monitor_nodes_otp_6481_test(Config, TestType) when is_list(Config) -> % the node mercilessly. % We then want to ensure that the nodedown message arrives % last ... without garbage after it. - Pid = spawn(fun() -> node_loop_send(Me, NodeMsg, 1) end), + _ = spawn(fun() -> node_loop_send(Me, NodeMsg, 1) end), receive {Me, kill_it} -> ok end, halt() end), diff --git a/lib/kernel/test/erl_distribution_wb_SUITE.erl b/lib/kernel/test/erl_distribution_wb_SUITE.erl index 627fed1fdd..3b8b2d9150 100644 --- a/lib/kernel/test/erl_distribution_wb_SUITE.erl +++ b/lib/kernel/test/erl_distribution_wb_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,12 +18,13 @@ %% -module(erl_distribution_wb_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). --export([init_per_testcase/2, fin_per_testcase/2, whitebox/1, +-export([init_per_testcase/2, end_per_testcase/2, whitebox/1, switch_options/1, missing_compulsory_dflags/1]). %% 1) @@ -77,14 +78,32 @@ -define(u32(X3,X2,X1,X0), (((X3) bsl 24) bor ((X2) bsl 16) bor ((X1) bsl 8) bor (X0))). -all(suite) -> - [whitebox,switch_options,missing_compulsory_dflags]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [whitebox, switch_options, missing_compulsory_dflags]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(1)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl index 19c84ab34c..f47c4603cf 100644 --- a/lib/kernel/test/erl_prim_loader_SUITE.erl +++ b/lib/kernel/test/erl_prim_loader_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,9 +19,10 @@ -module(erl_prim_loader_SUITE). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([get_path/1, set_path/1, get_file/1, inet_existing/1, inet_coming_up/1, inet_disconnects/1, @@ -29,27 +30,41 @@ local_archive/1, remote_archive/1, primary_archive/1, virtual_dir_in_archive/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %%----------------------------------------------------------------- %% Test suite for erl_prim_loader. (Most code is run during system start/stop.) %%----------------------------------------------------------------- -all(suite) -> - [ - get_path, set_path, get_file, - inet_existing, inet_coming_up, - inet_disconnects, multiple_slaves, - file_requests, local_archive, - remote_archive, primary_archive, - virtual_dir_in_archive - ]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [get_path, set_path, get_file, inet_existing, + inet_coming_up, inet_disconnects, multiple_slaves, + file_requests, local_archive, remote_archive, + primary_archive, virtual_dir_in_archive]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:minutes(3)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -291,7 +306,6 @@ wait_and_shutdown([], _) -> ok. -file_requests(suite) -> {req, [{local_slave_nodes, 1}, {time, 10}]}; file_requests(doc) -> ["Start a node using the 'inet' loading method, ", "verify that the boot server responds to file requests."]; file_requests(Config) when is_list(Config) -> @@ -300,9 +314,11 @@ file_requests(Config) when is_list(Config) -> %% compare with results from file server calls (the %% boot server uses the same file sys and cwd) {ok,Files} = file:list_dir("."), + io:format("Files: ~p~n",[Files]), ?line {ok,Files} = rpc:call(Node, erl_prim_loader, list_dir, ["."]), - {ok,Info} = file:read_file_info("test_server.beam"), - ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, ["test_server.beam"]), + {ok,Info} = file:read_file_info(code:which(test_server)), + ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, + [code:which(test_server)]), {ok,Cwd} = file:get_cwd(), ?line {ok,Cwd} = rpc:call(Node, erl_prim_loader, get_cwd, []), case file:get_cwd("C:") of diff --git a/lib/kernel/test/error_logger_SUITE.erl b/lib/kernel/test/error_logger_SUITE.erl index eda86861d5..05bf5aae18 100644 --- a/lib/kernel/test/error_logger_SUITE.erl +++ b/lib/kernel/test/error_logger_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ %% -module(error_logger_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%----------------------------------------------------------------- %% We don't have to test the normal behaviour here, i.e. the tty @@ -27,7 +27,9 @@ %% error_logger deliver the expected events. %%----------------------------------------------------------------- --export([all/1, error_report/1, info_report/1, error/1, info/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + error_report/1, info_report/1, error/1, info/1, emulator/1, tty/1, logfile/1, add/1, delete/1]). -export([generate_error/0]). @@ -37,9 +39,27 @@ terminate/2]). -all(suite) -> - [error_report, info_report, error, info, - emulator, tty, logfile, add, delete]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [error_report, info_report, error, info, emulator, tty, + logfile, add, delete]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%----------------------------------------------------------------- diff --git a/lib/kernel/test/error_logger_warn_SUITE.erl b/lib/kernel/test/error_logger_warn_SUITE.erl index 6629eca1ad..265e1ae4c8 100644 --- a/lib/kernel/test/error_logger_warn_SUITE.erl +++ b/lib/kernel/test/error_logger_warn_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,9 @@ %% -module(error_logger_warn_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, basic/1,warnings_info/1,warnings_warnings/1, rb_basic/1,rb_warnings_info/1,rb_warnings_warnings/1, rb_trunc/1,rb_utc/1,file_utc/1]). @@ -26,7 +28,7 @@ %% Internal exports. -export([init/1,handle_event/2,handle_info/2,handle_call/2]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(EXPECT(Pattern), (fun() -> @@ -43,15 +45,33 @@ -define(default_timeout, ?t:minutes(1)). -all(suite) -> - [basic, warnings_info, warnings_warnings, - rb_basic, rb_warnings_info, rb_warnings_warnings, - rb_trunc,rb_utc, file_utc]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, warnings_info, warnings_warnings, rb_basic, + rb_warnings_info, rb_warnings_warnings, rb_trunc, + rb_utc, file_utc]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index 47592ddb14..8078c7d021 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -40,29 +40,29 @@ -module(?FILE_SUITE). --export([all/1, - init/1, fini/1, - init_per_testcase/2, fin_per_testcase/2, - read_write_file/1, dirs/1, files/1, names/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + read_write_file/1, names/1]). -export([cur_dir_0/1, cur_dir_1/1, make_del_dir/1, - pos/1, pos1/1, pos2/1]). --export([close/1, consult/1, consult1/1, path_consult/1, delete/1]). --export([eval/1, eval1/1, path_eval/1, script/1, script1/1, path_script/1, - open/1, open1/1, + pos1/1, pos2/1]). +-export([close/1, consult1/1, path_consult/1, delete/1]). +-export([ eval1/1, path_eval/1, script1/1, path_script/1, + open1/1, old_modes/1, new_modes/1, path_open/1, open_errors/1]). --export([file_info/1, file_info_basic_file/1, file_info_basic_directory/1, +-export([ file_info_basic_file/1, file_info_basic_directory/1, file_info_bad/1, file_info_times/1, file_write_file_info/1]). -export([rename/1, access/1, truncate/1, datasync/1, sync/1, read_write/1, pread_write/1, append/1, exclusive/1]). --export([errors/1, e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). +-export([ e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). -export([otp_5814/1]). --export([compression/1, read_not_really_compressed/1, +-export([ read_not_really_compressed/1, read_compressed_cooked/1, read_compressed_cooked_binary/1, read_cooked_tar_problem/1, write_compressed/1, compress_errors/1, catenated_gzips/1]). --export([links/1, make_link/1, read_link_info_for_non_link/1, symlinks/1]). +-export([ make_link/1, read_link_info_for_non_link/1, symlinks/1]). -export([copy/1]). @@ -93,23 +93,56 @@ --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -all(suite) -> - {conf, init, - [altname, read_write_file, dirs, files, - delete, rename, names, errors, - compression, links, copy, - delayed_write, read_ahead, segment_read, segment_write, - ipread, pid2name, interleaved_read_write, - otp_5814, large_file, read_line_1, read_line_2, read_line_3, read_line_4, - standard_io], - fini}. - -init(Config) when is_list(Config) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [altname, read_write_file, {group, dirs}, + {group, files}, delete, rename, names, {group, errors}, + {group, compression}, {group, links}, copy, + delayed_write, read_ahead, segment_read, segment_write, + ipread, pid2name, interleaved_read_write, otp_5814, + large_file, read_line_1, read_line_2, read_line_3, + read_line_4, standard_io]. + +groups() -> + [{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1]}, + {files, [], + [{group, open}, {group, pos}, {group, file_info}, + {group, consult}, {group, eval}, {group, script}, + truncate, sync, datasync, advise]}, + {open, [], + [open1, old_modes, new_modes, path_open, close, access, + read_write, pread_write, append, open_errors, + exclusive]}, + {pos, [], [pos1, pos2]}, + {file_info, [], + [file_info_basic_file, file_info_basic_directory, + file_info_bad, file_info_times, file_write_file_info]}, + {consult, [], [consult1, path_consult]}, + {eval, [], [eval1, path_eval]}, + {script, [], [script1, path_script]}, + {errors, [], + [e_delete, e_rename, e_make_dir, e_del_dir]}, + {compression, [], + [read_compressed_cooked, read_compressed_cooked_binary, + read_cooked_tar_problem, read_not_really_compressed, + write_compressed, compress_errors, catenated_gzips]}, + {links, [], + [make_link, read_link_info_for_non_link, symlinks]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> Priv = ?config(priv_dir, Config), @@ -126,7 +159,7 @@ init(Config) when is_list(Config) -> ?FILE_INIT(Config) end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> os:cmd("subst z: /d"); @@ -139,7 +172,7 @@ init_per_testcase(_Func, Config) -> %%error_logger:info_msg("~p:~p *****~n", [?MODULE, _Func]), ?FILE_INIT_PER_TESTCASE(Config). -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> %% error_logger:info_msg("~p:~p END *****~n", [?MODULE, _Func]), ?FILE_FIN_PER_TESTCASE(Config). @@ -314,7 +347,6 @@ read_write_file(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirs(suite) -> [make_del_dir, cur_dir_0, cur_dir_1]. make_del_dir(suite) -> []; make_del_dir(doc) -> []; @@ -461,12 +493,7 @@ win_cur_dir_1(_Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -files(suite) -> - [open,pos,file_info,consult,eval,script,truncate, - sync,datasync,advise]. -open(suite) -> [open1,old_modes,new_modes,path_open,close,access,read_write, - pread_write,append,open_errors,exclusive]. open1(suite) -> []; open1(doc) -> []; @@ -858,7 +885,6 @@ exclusive(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -pos(suite) -> [pos1,pos2]. pos1(suite) -> []; pos1(doc) -> []; @@ -950,8 +976,6 @@ pos2(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -file_info(suite) -> [file_info_basic_file, file_info_basic_directory, - file_info_bad, file_info_times, file_write_file_info]. file_info_basic_file(suite) -> []; file_info_basic_file(doc) -> []; @@ -1217,7 +1241,6 @@ file_write_file_info(Config) when is_list(Config) -> get_good_directory(Config) -> ?line ?config(priv_dir, Config). -consult(suite) -> [consult1, path_consult]. consult1(suite) -> []; consult1(doc) -> []; @@ -1278,7 +1301,6 @@ path_consult(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -eval(suite) -> [eval1,path_eval]. eval1(suite) -> []; eval1(doc) -> []; @@ -1351,7 +1373,6 @@ path_eval(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -script(suite) -> [script1,path_script]. script1(suite) -> []; script1(doc) -> ""; @@ -1702,7 +1723,6 @@ names(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -errors(suite) -> [e_delete, e_rename, e_make_dir, e_del_dir]. e_delete(suite) -> []; e_delete(doc) -> []; @@ -1959,12 +1979,6 @@ e_del_dir(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -compression(suite) -> - [read_compressed_cooked, read_compressed_cooked_binary, - read_cooked_tar_problem, - read_not_really_compressed, - write_compressed, compress_errors, - catenated_gzips]. %% Trying reading and positioning from a compressed file. @@ -2258,8 +2272,6 @@ altname(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), Result. -links(doc) -> "Test the link functions."; -links(suite) -> [make_link, read_link_info_for_non_link, symlinks]. make_link(doc) -> "Test creating a hard link."; make_link(suite) -> []; diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl index fbafbcd9b7..53bcb1162d 100644 --- a/lib/kernel/test/file_name_SUITE.erl +++ b/lib/kernel/test/file_name_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ %% %CopyrightEnd% %% --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). %% @@ -70,7 +70,10 @@ %% list_dir %% read_link --export([all/1,init_per_testcase/2, fin_per_testcase/2]). +-export([all/0,groups/0,suite/0, + init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([normal/1,icky/1,very_icky/1,normalize/1]). @@ -78,13 +81,29 @@ init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog,Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> - [normal,icky,very_icky,normalize]. +all() -> + [normal, icky, very_icky, normalize]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. normalize(suite) -> []; diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index 9aa94a0868..03e734445c 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,26 +18,58 @@ %% -module(gen_sctp_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet_sctp.hrl"). %%-compile(export_all). --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0, + init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export( [basic/1, api_open_close/1,api_listen/1,api_connect_init/1,api_opts/1, xfer_min/1,xfer_active/1,def_sndrcvinfo/1,implicit_inet6/1]). -all(suite) -> - [basic, - api_open_close,api_listen,api_connect_init,api_opts, - xfer_min,xfer_active,def_sndrcvinfo,implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [basic, api_open_close, api_listen, api_connect_init, + api_opts, xfer_min, xfer_active, def_sndrcvinfo, + implicit_inet6]. + +groups() -> + []. + +init_per_suite(Config) -> + try gen_sctp:open() of + {ok,Socket} -> + gen_sctp:close(Socket), + []; + _ -> + [] + catch + error:badarg -> + {skip,"SCTP not supported on this machine"}; + _:_ -> + Config + end. + +end_per_suite(_Conifig) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(15)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index 94637290a1..fd4685cdad 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -22,30 +22,52 @@ %% are not tested here, because they are tested indirectly in this and %% and other test suites. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). --export([all/1, init_per_testcase/2, fin_per_testcase/2, - t_accept/1, t_connect_timeout/1, t_accept_timeout/1, - t_connect/1, t_connect_bad/1, - t_recv/1, t_recv_timeout/1, t_recv_eof/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + t_connect_timeout/1, t_accept_timeout/1, + t_connect_bad/1, + t_recv_timeout/1, t_recv_eof/1, t_shutdown_write/1, t_shutdown_both/1, t_shutdown_error/1, t_fdopen/1, t_implicit_inet6/1]). -all(suite) -> [t_accept, t_connect, t_recv, t_shutdown_write, - t_shutdown_both, t_shutdown_error, t_fdopen, - t_implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, t_accept}, {group, t_connect}, {group, t_recv}, + t_shutdown_write, t_shutdown_both, t_shutdown_error, + t_fdopen, t_implicit_inet6]. + +groups() -> + [{t_accept, [], [t_accept_timeout]}, + {t_connect, [], [t_connect_timeout, t_connect_bad]}, + {t_recv, [], [t_recv_timeout, t_recv_eof]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). %%% gen_tcp:accept/1,2 -t_accept(suite) -> [t_accept_timeout]. t_accept_timeout(doc) -> "Test that gen_tcp:accept/2 (with timeout) works."; t_accept_timeout(suite) -> []; @@ -55,7 +77,6 @@ t_accept_timeout(Config) when is_list(Config) -> %%% gen_tcp:connect/X -t_connect(suite) -> [t_connect_timeout, t_connect_bad]. t_connect_timeout(doc) -> "Test that gen_tcp:connect/4 (with timeout) works."; t_connect_timeout(Config) when is_list(Config) -> @@ -84,7 +105,6 @@ t_connect_bad(Config) when is_list(Config) -> %%% gen_tcp:recv/X -t_recv(suite) -> [t_recv_timeout, t_recv_eof]. t_recv_timeout(doc) -> "Test that gen_tcp:recv/3 (with timeout works)."; t_recv_timeout(suite) -> []; @@ -160,34 +180,38 @@ t_fdopen(Config) when is_list(Config) -> %%% implicit inet6 option to api functions t_implicit_inet6(Config) when is_list(Config) -> - ?line Hostname = ok(inet:gethostname()), + ?line Host = ok(inet:gethostname()), + ?line + case inet:getaddr(Host, inet6) of + {ok,Addr} -> + ?line t_implicit_inet6(Host, Addr); + {error,Reason} -> + {skip, + "Can not look up IPv6 address: " + ++atom_to_list(Reason)} + end. + +t_implicit_inet6(Host, Addr) -> ?line case gen_tcp:listen(0, [inet6]) of {ok,S1} -> - ?line - case inet:getaddr(Hostname, inet6) of - {ok,Host} -> - ?line Loopback = {0,0,0,0,0,0,0,1}, - ?line io:format("~s ~p~n", ["Loopback",Loopback]), - ?line implicit_inet6(S1, Loopback), - ?line ok = gen_tcp:close(S1), - %% - ?line Localhost = - ok(inet:getaddr("localhost", inet6)), - ?line io:format("~s ~p~n", ["localhost",Localhost]), - ?line S2 = ok(gen_tcp:listen(0, [{ip,Localhost}])), - ?line implicit_inet6(S2, Localhost), - ?line ok = gen_tcp:close(S2), - %% - ?line io:format("~s ~p~n", [Hostname,Host]), - ?line S3 = ok(gen_tcp:listen(0, [{ifaddr,Host}])), - ?line implicit_inet6(S3, Host), - ?line ok = gen_tcp:close(S1); - {error,eafnosupport} -> - ?line ok = gen_tcp:close(S1), - {skip,"Can not look up IPv6 address"} - end; - _ -> + ?line Loopback = {0,0,0,0,0,0,0,1}, + ?line io:format("~s ~p~n", ["::1",Loopback]), + ?line implicit_inet6(S1, Loopback), + ?line ok = gen_tcp:close(S1), + %% + ?line Localhost = "localhost", + ?line Localaddr = ok(inet:getaddr(Localhost, inet6)), + ?line io:format("~s ~p~n", [Localhost,Localaddr]), + ?line S2 = ok(gen_tcp:listen(0, [{ip,Localaddr}])), + ?line implicit_inet6(S2, Localaddr), + ?line ok = gen_tcp:close(S2), + %% + ?line io:format("~s ~p~n", [Host,Addr]), + ?line S3 = ok(gen_tcp:listen(0, [{ifaddr,Addr}])), + ?line implicit_inet6(S3, Addr), + ?line ok = gen_tcp:close(S3); + {error,_} -> {skip,"IPv6 not supported"} end. diff --git a/lib/kernel/test/gen_tcp_echo_SUITE.erl b/lib/kernel/test/gen_tcp_echo_SUITE.erl index a2e09877af..fffaaf4c45 100644 --- a/lib/kernel/test/gen_tcp_echo_SUITE.erl +++ b/lib/kernel/test/gen_tcp_echo_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,11 +18,13 @@ %% -module(gen_tcp_echo_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %%-compile(export_all). --export([all/1, init_per_testcase/2, fin_per_testcase/2, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, active_echo/1, passive_echo/1, active_once_echo/1, slow_active_echo/1, slow_passive_echo/1, limit_active_echo/1, limit_passive_echo/1, @@ -31,16 +33,34 @@ -define(TPKT_VRSN, 3). -define(LINE_LENGTH, 1023). % (default value of gen_tcp option 'recbuf') - 1 -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [active_echo, passive_echo, active_once_echo, - slow_active_echo, slow_passive_echo, - limit_active_echo, limit_passive_echo, - large_limit_active_echo, large_limit_passive_echo]. + slow_active_echo, slow_passive_echo, limit_active_echo, + limit_passive_echo, large_limit_active_echo, + large_limit_passive_echo]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:minutes(5)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index d73c5fab56..b1ef8826d5 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,14 +18,16 @@ %% -module(gen_tcp_misc_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). %-compile(export_all). --export([all/1, controlling_process/1, no_accept/1, close_with_pending_output/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + controlling_process/1, no_accept/1, close_with_pending_output/1, data_before_close/1, iter_max_socks/1, get_status/1, passive_sockets/1, accept_closed_by_other_process/1, - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, otp_3924/1, otp_3924_sender/4, closed_socket/1, shutdown_active/1, shutdown_passive/1, shutdown_pending/1, default_options/1, http_bad_packet/1, @@ -34,39 +36,60 @@ partial_recv_and_close_2/1,partial_recv_and_close_3/1,so_priority/1, % Accept tests primitive_accept/1,multi_accept_close_listen/1,accept_timeout/1, - accept_timeouts_in_order/1,accept_timeouts_in_order2/1,accept_timeouts_in_order3/1, - accept_timeouts_mixed/1, + accept_timeouts_in_order/1,accept_timeouts_in_order2/1, + accept_timeouts_in_order3/1,accept_timeouts_mixed/1, killing_acceptor/1,killing_multi_acceptors/1,killing_multi_acceptors2/1, - several_accepts_in_one_go/1,active_once_closed/1, send_timeout/1, otp_7731/1, - zombie_sockets/1, otp_7816/1, otp_8102/1]). + several_accepts_in_one_go/1,active_once_closed/1, send_timeout/1, send_timeout_active/1, + otp_7731/1, zombie_sockets/1, otp_7816/1, otp_8102/1]). %% Internal exports. --export([sender/3, not_owner/1, passive_sockets_server/2, priority_server/1, otp_7731_server/1, zombie_server/2]). +-export([sender/3, not_owner/1, passive_sockets_server/2, priority_server/1, + otp_7731_server/1, zombie_server/2]). init_per_testcase(_Func, Config) when is_list(Config) -> Dog = test_server:timetrap(test_server:seconds(240)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [controlling_process, no_accept, - close_with_pending_output, - data_before_close, iter_max_socks, passive_sockets, + close_with_pending_output, data_before_close, + iter_max_socks, passive_sockets, accept_closed_by_other_process, otp_3924, closed_socket, shutdown_active, shutdown_passive, shutdown_pending, - default_options, http_bad_packet, - busy_send, busy_disconnect_passive, busy_disconnect_active, - fill_sendq, partial_recv_and_close, - partial_recv_and_close_2, partial_recv_and_close_3, so_priority, - primitive_accept,multi_accept_close_listen,accept_timeout, - accept_timeouts_in_order,accept_timeouts_in_order2,accept_timeouts_in_order3, - accept_timeouts_mixed, - killing_acceptor,killing_multi_acceptors,killing_multi_acceptors2, - several_accepts_in_one_go, active_once_closed, send_timeout, otp_7731, + default_options, http_bad_packet, busy_send, + busy_disconnect_passive, busy_disconnect_active, + fill_sendq, partial_recv_and_close, + partial_recv_and_close_2, partial_recv_and_close_3, + so_priority, primitive_accept, + multi_accept_close_listen, accept_timeout, + accept_timeouts_in_order, accept_timeouts_in_order2, + accept_timeouts_in_order3, accept_timeouts_mixed, + killing_acceptor, killing_multi_acceptors, + killing_multi_acceptors2, several_accepts_in_one_go, + active_once_closed, send_timeout, send_timeout_active, otp_7731, zombie_sockets, otp_7816, otp_8102]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + default_options(doc) -> ["Tests kernel application variables inet_default_listen_options and " @@ -1934,6 +1957,60 @@ send_timeout(Config) when is_list(Config) -> ParaFun(false), ParaFun(true), ok. +mad_sender(S) -> + {_, _, USec} = now(), + case gen_tcp:send(S, integer_to_list(USec)) of + ok -> + mad_sender(S); + Err -> + Err + end. + + +flush() -> + receive + _X -> + %erlang:display(_X), + flush() + after 0 -> + ok + end. + +send_timeout_active(suite) -> + []; +send_timeout_active(doc) -> + ["Test the send_timeout socket option for active sockets"]; +send_timeout_active(Config) when is_list(Config) -> + Dog = test_server:timetrap(test_server:seconds(20)), + %% Basic + BasicFun = + fun(AutoClose) -> + ?line {Loop,A,RNode,C} = setup_active_timeout_sink(1, AutoClose), + inet:setopts(A, [{active, once}]), + ?line Mad = spawn_link(RNode,fun() -> mad_sender(C) end), + ?line {error,timeout} = + Loop(fun() -> + receive + {tcp, Sock, _Data} -> + inet:setopts(A, [{active, once}]), + Res = gen_tcp:send(A,lists:duplicate(1000, $a)), + %erlang:display(Res), + Res; + Err -> + io:format("sock closed: ~p~n", [Err]), + Err + end + end), + unlink(Mad), + exit(Mad,kill), + ?line test_server:stop_node(RNode) + end, + BasicFun(false), + flush(), + BasicFun(true), + flush(), + test_server:timetrap_cancel(Dog), + ok. after_send_timeout(AutoClose) -> case AutoClose of @@ -2016,35 +2093,35 @@ setup_closed_ao() -> {Loop,A}. setup_timeout_sink(Timeout, AutoClose) -> - Dir = filename:dirname(code:which(?MODULE)), - {ok,R} = test_server:start_node(test_default_options_slave,slave, + ?line Dir = filename:dirname(code:which(?MODULE)), + ?line {ok,R} = test_server:start_node(test_default_options_slave,slave, [{args,"-pa " ++ Dir}]), - Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), - {ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}, + ?line Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), + ?line {ok, L} = gen_tcp:listen(0, [{active,false},{packet,2}, {send_timeout,Timeout}, {send_timeout_close,AutoClose}]), - Fun = fun(F) -> + ?line Fun = fun(F) -> receive {From,X} when is_function(X) -> From ! {self(),X()}, F(F); die -> ok end end, - Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), - {ok, Port} = inet:port(L), - Remote = fun(Fu) -> + ?line Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), + ?line {ok, Port} = inet:port(L), + ?line Remote = fun(Fu) -> Pid ! {self(), Fu}, receive {Pid,X} -> X end end, - {ok, C} = Remote(fun() -> + ?line {ok, C} = Remote(fun() -> gen_tcp:connect(Host,Port, [{active,false},{packet,2}]) end), - {ok,A} = gen_tcp:accept(L), - gen_tcp:send(A,"Hello"), - {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end), - Loop2 = fun(_,_,0) -> + ?line {ok,A} = gen_tcp:accept(L), + ?line gen_tcp:send(A,"Hello"), + ?line {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end), + ?line Loop2 = fun(_,_,0) -> {failure, timeout}; (L2,F2,N) -> Ret = F2(), @@ -2055,9 +2132,53 @@ setup_timeout_sink(Timeout, AutoClose) -> Other -> Other end end, - Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, + ?line Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, {Loop,A,R}. - + +setup_active_timeout_sink(Timeout, AutoClose) -> + ?line Dir = filename:dirname(code:which(?MODULE)), + ?line {ok,R} = test_server:start_node(test_default_options_slave,slave, + [{args,"-pa " ++ Dir}]), + ?line Host = list_to_atom(lists:nth(2,string:tokens(atom_to_list(node()),"@"))), + ?line {ok, L} = gen_tcp:listen(0, [binary,{active,false},{packet,0},{nodelay, true},{keepalive, true}, + {send_timeout,Timeout}, + {send_timeout_close,AutoClose}]), + ?line Fun = fun(F) -> + receive + {From,X} when is_function(X) -> + From ! {self(),X()}, F(F); + die -> ok + end + end, + ?line Pid = rpc:call(R,erlang,spawn,[fun() -> Fun(Fun) end]), + ?line {ok, Port} = inet:port(L), + ?line Remote = fun(Fu) -> + Pid ! {self(), Fu}, + receive {Pid,X} -> X + end + end, + ?line {ok, C} = Remote(fun() -> + gen_tcp:connect(Host,Port, + [{active,false}]) + end), + ?line {ok,A} = gen_tcp:accept(L), + ?line gen_tcp:send(A,"Hello"), + ?line {ok, "H"++_} = Remote(fun() -> gen_tcp:recv(C,0) end), + ?line Loop2 = fun(_,_,0) -> + {failure, timeout}; + (L2,F2,N) -> + Ret = F2(), + io:format("~p~n",[Ret]), + case Ret of + ok -> receive after 1 -> ok end, + L2(L2,F2,N-1); + Other -> Other + end + end, + ?line Loop = fun(F3) -> Loop2(Loop2,F3,1000) end, + {Loop,A,R,C}. + + millistamp() -> {Mega, Secs, Micros} = erlang:now(), (Micros div 1000) + Secs * 1000 + Mega * 1000000000. diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 2ff1d7210a..d8a5519195 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -21,7 +21,7 @@ % because udp is not deterministic. % -module(gen_udp_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). @@ -29,23 +29,42 @@ % XXX - we should pick a port that we _know_ is closed. That's pretty hard. -define(CLOSED_PORT, 6666). --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([send_to_closed/1, buffer_size/1, binary_passive_recv/1, bad_address/1, read_packets/1, open_fd/1, connect/1, implicit_inet6/1]). -all(suite) -> - [send_to_closed, - buffer_size, binary_passive_recv, bad_address, read_packets, - open_fd, connect, implicit_inet6]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [send_to_closed, buffer_size, binary_passive_recv, + bad_address, read_packets, open_fd, connect, + implicit_inet6]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -431,36 +450,38 @@ connect(Config) when is_list(Config) -> ok. implicit_inet6(Config) when is_list(Config) -> - ?line Hostname = ok(inet:gethostname()), + ?line Host = ok(inet:gethostname()), + ?line + case inet:getaddr(Host, inet6) of + {ok,Addr} -> + ?line implicit_inet6(Host, Addr); + {error,Reason} -> + {skip, + "Can not look up IPv6 address: " + ++atom_to_list(Reason)} + end. + +implicit_inet6(Host, Addr) -> ?line Active = {active,false}, ?line case gen_udp:open(0, [inet6,Active]) of {ok,S1} -> - ?line - case inet:getaddr(Hostname, inet6) of - {ok,Host} -> - ?line Loopback = {0,0,0,0,0,0,0,1}, - ?line io:format("~s ~p~n", ["Loopback",Loopback]), - ?line implicit_inet6(S1, Active, Loopback), - ?line ok = gen_udp:close(S1), - %% - ?line Localhost = - ok(inet:getaddr("localhost", inet6)), - ?line io:format("~s ~p~n", ["localhost",Localhost]), - ?line S2 = - ok(gen_udp:open(0, [{ip,Localhost},Active])), - ?line implicit_inet6(S2, Active, Localhost), - ?line ok = gen_udp:close(S2), - %% - ?line io:format("~s ~p~n", [Hostname,Host]), - ?line S3 = - ok(gen_udp:open(0, [{ifaddr,Host},Active])), - ?line implicit_inet6(S3, Active, Host), - ?line ok = gen_udp:close(S1); - {error,eafnosupport} -> - ?line ok = gen_udp:close(S1), - {skip,"Can not look up IPv6 address"} - end; + ?line Loopback = {0,0,0,0,0,0,0,1}, + ?line io:format("~s ~p~n", ["::1",Loopback]), + ?line implicit_inet6(S1, Active, Loopback), + ?line ok = gen_udp:close(S1), + %% + ?line Localhost = "localhost", + ?line Localaddr = ok(inet:getaddr(Localhost, inet6)), + ?line io:format("~s ~p~n", [Localhost,Localaddr]), + ?line S2 = ok(gen_udp:open(0, [{ip,Localaddr},Active])), + ?line implicit_inet6(S2, Active, Localaddr), + ?line ok = gen_udp:close(S2), + %% + ?line io:format("~s ~p~n", [Host,Addr]), + ?line S3 = ok(gen_udp:open(0, [{ifaddr,Addr},Active])), + ?line implicit_inet6(S3, Active, Addr), + ?line ok = gen_udp:close(S3); _ -> {skip,"IPv6 not supported"} end. @@ -481,5 +502,4 @@ implicit_inet6(S1, Active, Addr) -> ?line {Addr,P2,"pong"} = ok(gen_udp:recv(S1, 1024)), ?line ok = gen_udp:close(S2). - ok({ok,V}) -> V. diff --git a/lib/kernel/test/global_SUITE.erl b/lib/kernel/test/global_SUITE.erl index 7a84ad5e75..1e7bcf1766 100644 --- a/lib/kernel/test/global_SUITE.erl +++ b/lib/kernel/test/global_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,8 @@ %-define(line_trace, 1). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1, names/1, names_hidden/1, locks/1, locks_hidden/1, bad_input/1, names_and_locks/1, lock_die/1, name_die/1, basic_partition/1, basic_name_partition/1, @@ -42,14 +43,14 @@ -export([global_load/3, lock_global/2, lock_global2/2]). --export([ttt/1]). +-export([]). -export([mass_spawn/1]). -export([start_tracer/0, stop_tracer/0, get_trace/0]). -compile(export_all). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(NODES, [node()|nodes()]). @@ -58,41 +59,62 @@ %% The resource used by the global module. -define(GLOBAL_LOCK, global). -ttt(suite) -> - [ -%% 5&6: succeeds -%% 4&5&6: succeeds -%% 3&4&5&6: succeeds -%% 1&2&3&6: fails -%% 1&2&6: succeeds -%% 3&6: succeeds - names, names_hidden, locks, locks_hidden, - bad_input, - names_and_locks, lock_die, name_die, basic_partition, -% advanced_partition, basic_name_partition, -% stress_partition, simple_ring, simple_line, - ring]. - -all(suite) -> + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case init:get_argument(ring_line) of - {ok, _} -> - [ring_line]; + {ok, _} -> [ring_line]; _ -> - [names, names_hidden, locks, locks_hidden, - bad_input, + [names, names_hidden, locks, locks_hidden, bad_input, names_and_locks, lock_die, name_die, basic_partition, advanced_partition, basic_name_partition, - stress_partition, simple_ring, simple_line, - ring, line, global_lost_nodes, otp_1849, - otp_3162, otp_5640, otp_5737, otp_6931, - simple_disconnect, simple_resolve, simple_resolve2, - simple_resolve3, - leftover_name, re_register_name, name_exit, - external_nodes, many_nodes, sync_0, global_groups_change, - register_1, both_known_1, lost_unregister, - mass_death, garbage_messages] + stress_partition, simple_ring, simple_line, ring, line, + global_lost_nodes, otp_1849, otp_3162, otp_5640, + otp_5737, otp_6931, simple_disconnect, simple_resolve, + simple_resolve2, simple_resolve3, leftover_name, + re_register_name, name_exit, external_nodes, many_nodes, + sync_0, global_groups_change, register_1, both_known_1, + lost_unregister, mass_death, garbage_messages] end. +groups() -> + [{ttt, [], + [names, names_hidden, locks, locks_hidden, bad_input, + names_and_locks, lock_die, name_die, basic_partition, + ring]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_suite(Config) -> + + %% Copied from test_server_ctrl ln 647, we have to do this here as + %% the test_server only does this when run without common_test + global:sync(), + case global:whereis_name(test_server) of + undefined -> + io:format(user, "Registering test_server globally!~n",[]), + global:register_name(test_server, whereis(test_server_ctrl)); + Pid -> + case node() of + N when N == node(Pid) -> + io:format(user, "Warning: test_server already running!\n", []), + global:re_register_name(test_server,self()); + _ -> + ok + end + end, + Config. + +end_per_suite(_Config) -> + global:unregister_name(test_server), + ok. + + -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). -define(nodes_tag, '$global_nodes'). @@ -100,9 +122,16 @@ all(suite) -> init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> ok = gen_server:call(global_name_server, high_level_trace_start,infinity), + + %% Make sure that everything is dead and done. Otherwise there are problems + %% on platforms on which it takes a long time to shut down a node. + stop_nodes(nodes()), + timer:sleep(1000), + [{?TESTCASE, Case}, {registered, registered()} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> + ct:log("Calling end_per_testcase!",[]), ?line write_high_level_trace(Config), ?line _ = gen_server:call(global_name_server, high_level_trace_stop, infinity), @@ -114,6 +143,7 @@ fin_per_testcase(_Case, Config) -> {What, N} <- [{"Added", Registered -- InitRegistered}, {"Removed", InitRegistered -- Registered}], N =/= []], + ok. %%% General comments: diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 430cc61267..13b2fd07b5 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,25 +19,61 @@ -module(global_group_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, + init_per_suite/1, end_per_suite/1]). -export([start_gg_proc/1, no_gg_proc/1, no_gg_proc_sync/1, compatible/1, one_grp/1, one_grp_x/1, two_grp/1, hidden_groups/1, test_exit/1]). -export([init/1, init/2, init2/2, start_proc/1, start_proc_rereg/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). %-compile(export_all). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(NODES, [node()|nodes()]). -define(UNTIL(Seq), loop_until_true(fun() -> Seq end)). -all(suite) -> - [start_gg_proc, no_gg_proc, no_gg_proc_sync, - compatible, one_grp, one_grp_x, two_grp, test_exit, - hidden_groups]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [start_gg_proc, no_gg_proc, no_gg_proc_sync, compatible, + one_grp, one_grp_x, two_grp, test_exit, hidden_groups]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) -> + + %% Copied from test_server_ctrl ln 647, we have to do this here as + %% the test_server only does this when run without common_test + global:sync(), + case global:whereis_name(test_server) of + undefined -> + io:format(user, "Registering test_server globally!~n",[]), + global:register_name(test_server, whereis(test_server_ctrl)); + Pid -> + case node() of + N when N == node(Pid) -> + io:format(user, "Warning: test_server already running!\n", []), + global:re_register_name(test_server,self()); + _ -> + ok + end + end, + Config. + +end_per_suite(_Config) -> + global:unregister_name(test_server), + ok. -define(TESTCASE, testcase_name). -define(testcase, ?config(?TESTCASE, Config)). @@ -46,7 +82,7 @@ init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog=?t:timetrap(?t:minutes(5)), [{?TESTCASE, Case}, {watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -164,8 +200,8 @@ no_gg_proc(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive @@ -339,8 +375,8 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive @@ -513,8 +549,8 @@ compatible(Config) when is_list(Config) -> ?line Own_nodes_should = [node(), Cp1nn, Cp2nn, Cp3nn, Cpxnn, Cpynn, Cpznn], ?line Own_nodes = rpc:call(Cp3, global_group, own_nodes, []), - ?line true = (Own_nodes -- Own_nodes_should) =:= [], - ?line true = (Own_nodes_should -- Own_nodes) =:= [], + ?line [] = (Own_nodes -- Own_nodes_should), + ?line [] = (Own_nodes_should -- Own_nodes), ?line Pid2 = rpc:call(Cp1, global_group, send, [test2, {ping, self()}]), ?line receive diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl index 0d0296238b..043c753cf8 100644 --- a/lib/kernel/test/heart_SUITE.erl +++ b/lib/kernel/test/heart_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,12 +18,14 @@ %% -module(heart_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, ostype/1, start/1, restart/1, reboot/1, set_cmd/1, clear_cmd/1, - dont_drop/1, kill_pid/1, fini/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, start/1, restart/1, + reboot/1, set_cmd/1, clear_cmd/1, + dont_drop/1, kill_pid/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([start_heart_stress/1, mangle/1, suicide_by_heart/0]). @@ -33,7 +35,7 @@ init_per_testcase(_Func, Config) -> Dog=test_server:timetrap(test_server:seconds(?DEFAULT_TIMEOUT_SECS)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Nodes = nodes(), lists:foreach(fun(X) -> NNam = list_to_atom(hd(string:tokens(atom_to_list(X),"@"))), @@ -53,18 +55,29 @@ fin_per_testcase(_Func, Config) -> %% Should be started in a CC view with: %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> - [{conf, ostype, [start, restart, reboot, - set_cmd, clear_cmd, kill_pid], fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -ostype(Config) when is_list(Config) -> +all() -> + [start, restart, reboot, set_cmd, clear_cmd, kill_pid]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, windows} -> {skipped, "No use to run on Windows 95/98"}; _ -> Config end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> Config. start_check(Type, Name) -> diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl index ec05bf99b9..1bb173a3ac 100644 --- a/lib/kernel/test/inet_SUITE.erl +++ b/lib/kernel/test/inet_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,29 +18,72 @@ %% -module(inet_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/inet.hrl"). -include_lib("kernel/src/inet_dns.hrl"). --export([all/1, t_gethostbyaddr/1, t_getaddr/1, t_gethostbyname/1, - t_gethostbyaddr_v6/1, t_getaddr_v6/1, t_gethostbyname_v6/1, - ipv4_to_ipv6/1, host_and_addr/1, parse/1, t_gethostnative/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + t_gethostbyaddr/0, t_gethostbyaddr/1, + t_getaddr/0, t_getaddr/1, + t_gethostbyname/0, t_gethostbyname/1, + t_gethostbyaddr_v6/0, t_gethostbyaddr_v6/1, + t_getaddr_v6/0, t_getaddr_v6/1, + t_gethostbyname_v6/0, t_gethostbyname_v6/1, + ipv4_to_ipv6/0, ipv4_to_ipv6/1, + host_and_addr/0, host_and_addr/1, + t_gethostnative/1, gethostnative_parallell/1, cname_loop/1, - gethostnative_soft_restart/1,gethostnative_debug_level/1,getif/1, - getif_ifr_name_overflow/1,getservbyname_overflow/1,getifaddrs/1]). + gethostnative_soft_restart/0, gethostnative_soft_restart/1, + gethostnative_debug_level/0, gethostnative_debug_level/1, + getif/1, + getif_ifr_name_overflow/1,getservbyname_overflow/1, getifaddrs/1]). -export([get_hosts/1, get_ipv6_hosts/1, parse_hosts/1, parse_address/1, kill_gethost/0, parallell_gethost/0]). -export([init_per_testcase/2, end_per_testcase/2]). +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [t_gethostbyaddr, t_gethostbyname, t_getaddr, + t_gethostbyaddr_v6, t_gethostbyname_v6, t_getaddr_v6, + ipv4_to_ipv6, host_and_addr, {group, parse}, + t_gethostnative, gethostnative_parallell, cname_loop, + gethostnative_debug_level, gethostnative_soft_restart, + getif, getif_ifr_name_overflow, getservbyname_overflow, + getifaddrs]. + +groups() -> + [{parse, [], [parse_hosts, parse_address]}]. + +%% Required configuaration +required(v4) -> + [{require, test_host_ipv4_only}, + {require, test_dummy_host}]; +required(v6) -> + [{require, test_host_ipv6_only}, + {require, test_dummy_ipv6_host}]; +required(hosts) -> + case os:type() of + {OS, _} when OS =:= win32; OS =:= vxworks -> + [{require, hardcoded_hosts}, + {require, hardcoded_ipv6_hosts}]; + _Else -> + [{require, test_hosts}] + end. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [t_gethostbyaddr, t_gethostbyname, t_getaddr, - t_gethostbyaddr_v6, t_gethostbyname_v6, t_getaddr_v6, - ipv4_to_ipv6, host_and_addr, parse,t_gethostnative, - gethostnative_parallell, cname_loop, - gethostnative_debug_level,gethostnative_soft_restart, - getif,getif_ifr_name_overflow,getservbyname_overflow,getifaddrs]. +end_per_group(_GroupName, Config) -> + Config. init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), @@ -50,10 +93,12 @@ end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). - +t_gethostbyaddr() -> + required(v4). t_gethostbyaddr(doc) -> "Test the inet:gethostbyaddr/1 function."; t_gethostbyaddr(Config) when is_list(Config) -> - ?line {Name,FullName,IPStr,IP,Aliases,_,_} = ?config(test_host_ipv4_only, Config), + ?line {Name,FullName,IPStr,IP,Aliases,_,_} = + ct:get_config(test_host_ipv4_only), ?line {ok,HEnt} = inet:gethostbyaddr(IPStr), ?line {ok,HEnt} = inet:gethostbyaddr(IP), ?line {error,Error} = inet:gethostbyaddr(Name), @@ -75,15 +120,16 @@ t_gethostbyaddr(Config) when is_list(Config) -> end, ?line {_DName, _DFullName, DIPStr, DIP, _, _, _} = - ?config(test_dummy_host, Config), + ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr), ?line {error,nxdomain} = inet:gethostbyaddr(DIP), ok. +t_gethostbyaddr_v6() -> required(v6). t_gethostbyaddr_v6(doc) -> "Test the inet:gethostbyaddr/1 inet6 function."; t_gethostbyaddr_v6(Config) when is_list(Config) -> ?line {Name6, FullName6, IPStr6, IP6, Aliases6} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line case inet:gethostbyaddr(IPStr6) of %% Even if IPv6 is not supported, the native resolver may succeed @@ -103,27 +149,28 @@ t_gethostbyaddr_v6(Config) when is_list(Config) -> {HEnt6#hostent.h_aliases,[[],Aliases6]}]), ?line {_DName6, _DFullName6, DIPStr6, DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:gethostbyaddr(DIPStr6), ?line {error,nxdomain} = inet:gethostbyaddr(DIP6), ok end. +t_gethostbyname() -> required(v4). t_gethostbyname(doc) -> "Test the inet:gethostbyname/1 function."; t_gethostbyname(suite) -> []; t_gethostbyname(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,IP,Aliases,IP_46_Str,_} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line {ok,_} = inet:gethostbyname(IPStr), ?line {ok,HEnt} = inet:gethostbyname(Name), ?line {ok,HEnt} = inet:gethostbyname(list_to_atom(Name)), ?line HEnt_ = HEnt#hostent{h_addrtype = inet, h_length = 4, h_addr_list = [IP]}, + ?line HEnt_ = HEnt, ?line check_elems([{HEnt#hostent.h_name,[Name,FullName]}, {HEnt#hostent.h_aliases,[[],Aliases]}]), - ?line {ok,HEntF} = inet:gethostbyname(FullName), ?line HEntF_ = HEntF#hostent{h_name = FullName, h_addrtype = inet, @@ -133,15 +180,16 @@ t_gethostbyname(Config) when is_list(Config) -> ?line check_elems([{HEnt#hostent.h_aliases,[[],Aliases]}]), ?line {DName, _DFullName, _DIPStr, _DIP, _, _, _} = - ?config(test_dummy_host, Config), + ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:gethostbyname(DName), ?line {error,nxdomain} = inet:gethostbyname(IP_46_Str). +t_gethostbyname_v6() -> required(v6). t_gethostbyname_v6(doc) -> "Test the inet:gethostbyname/1 inet6 function."; t_gethostbyname_v6(suite) -> []; t_gethostbyname_v6(Config) when is_list(Config) -> ?line {Name, _, _, _,Aliases,IP_46_Str,IP_46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), case {inet:gethostbyname(IP_46_Str, inet6), inet:gethostbyname(Name, inet6)} of @@ -154,7 +202,7 @@ t_gethostbyname_v6(Config) when is_list(Config) -> ?line check_elems([{HEnt46#hostent.h_aliases,[[],Aliases]}]), ?line {Name6, FullName6, IPStr6, IP6, Aliases6} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line {ok,_} = inet:gethostbyname(IPStr6, inet6), ?line {ok,HEnt6} = inet:gethostbyname(Name6, inet6), ?line {ok,HEnt6} = inet:gethostbyname(list_to_atom(Name6), inet6), @@ -200,7 +248,7 @@ t_gethostbyname_v6(Config) when is_list(Config) -> end, ?line {DName6, _DFullName6, _DIPStr6, _DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:gethostbyname(DName6, inet6), ok; {_,_} -> @@ -219,11 +267,12 @@ check_elem(Val, [], Tests0) -> ?t:fail({no_match,Val,Tests0}). +t_getaddr() -> required(v4). t_getaddr(doc) -> "Test the inet:getaddr/2 function."; t_getaddr(suite) -> []; t_getaddr(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,IP,_,IP_46_Str,IP46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line {ok,IP} = inet:getaddr(list_to_atom(Name), inet), ?line {ok,IP} = inet:getaddr(Name, inet), ?line {ok,IP} = inet:getaddr(FullName, inet), @@ -232,17 +281,18 @@ t_getaddr(Config) when is_list(Config) -> ?line {error,nxdomain} = inet:getaddr(IP_46_Str, inet), ?line {error,eafnosupport} = inet:getaddr(IP46, inet), - ?line {DName, DFullName, DIPStr, DIP, _, _, _} = ?config(test_dummy_host, Config), + ?line {DName, DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host), ?line {error,nxdomain} = inet:getaddr(DName, inet), ?line {error,nxdomain} = inet:getaddr(DFullName, inet), ?line {ok,DIP} = inet:getaddr(DIPStr, inet), ?line {ok,DIP} = inet:getaddr(DIP, inet). +t_getaddr_v6() -> required(v4) ++ required(v6). t_getaddr_v6(doc) -> "Test the inet:getaddr/2 function."; t_getaddr_v6(suite) -> []; t_getaddr_v6(Config) when is_list(Config) -> ?line {Name,FullName,IPStr,_IP,_,IP_46_Str,IP46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), case {inet:getaddr(IP_46_Str, inet6),inet:getaddr(Name, inet6)} of {{ok,IP46},{ok,_}} -> %% Since we suceeded in parsing an IPv6 address string and @@ -261,7 +311,7 @@ t_getaddr_v6(Config) when is_list(Config) -> %% inet_db:res_option(lookup)) %% end, ?line {Name6, FullName6, IPStr6, IP6, _} = - ?config(test_host_ipv6_only, Config), + ct:get_config(test_host_ipv6_only), ?line {ok,_} = inet:getaddr(list_to_atom(Name6), inet6), ?line {ok,_} = inet:getaddr(Name6, inet6), ?line {ok,_} = inet:getaddr(FullName6, inet6), @@ -269,7 +319,7 @@ t_getaddr_v6(Config) when is_list(Config) -> ?line {ok,IP6} = inet:getaddr(IPStr6, inet6), ?line {DName6, DFullName6, DIPStr6, DIP6, _} = - ?config(test_dummy_ipv6_host, Config), + ct:get_config(test_dummy_ipv6_host), ?line {error,nxdomain} = inet:getaddr(DName6, inet6), ?line {error,nxdomain} = inet:getaddr(DFullName6, inet6), ?line {ok,DIP6} = inet:getaddr(DIPStr6, inet6), @@ -279,6 +329,7 @@ t_getaddr_v6(Config) when is_list(Config) -> {skip, "IPv6 is not supported on this host"} end. +ipv4_to_ipv6() -> required(v4). ipv4_to_ipv6(doc) -> "Test if IPv4 address is converted to IPv6 address."; ipv4_to_ipv6(suite) -> []; ipv4_to_ipv6(Config) when is_list(Config) -> @@ -287,7 +338,7 @@ ipv4_to_ipv6(Config) when is_list(Config) -> %% address should be returned. If no IPv6 support on this host, an %% error should beturned. ?line {_Name,_FullName,IPStr,_IP,Aliases,IP_46_Str,IP_46} = - ?config(test_host_ipv4_only, Config), + ct:get_config(test_host_ipv4_only), ?line IP4to6Res = case inet:getaddr(IPStr, inet6) of {ok,IP_46} -> @@ -314,6 +365,7 @@ ipv4_to_ipv6(Config) when is_list(Config) -> end, ok. +host_and_addr() -> required(hosts). host_and_addr(doc) -> ["Test looking up hosts and addresses. Use 'ypcat hosts' ", "or the local eqivalent to find all hosts."]; host_and_addr(suite) -> []; @@ -334,30 +386,30 @@ try_host({Ip0, Host}) -> %% Get all hosts from the system using 'ypcat hosts' or the local %% equvivalent. -get_hosts(Config) -> +get_hosts(_Config) -> case os:type() of {unix, _} -> List = lists:map(fun(X) -> atom_to_list(X)++" " - end, ?config(test_hosts, Config)), + end, ct:get_config(test_hosts)), Cmd = "ypmatch "++List++" hosts.byname", HostFile = os:cmd(Cmd), get_hosts(HostFile, [], [], []); _ -> - ?config(hardcoded_hosts, Config) + ct:get_config(hardcoded_hosts) end. -get_ipv6_hosts(Config) -> +get_ipv6_hosts(_Config) -> case os:type() of {unix, _} -> List = lists:map(fun(X) -> atom_to_list(X)++" " - end, ?config(test_hosts, Config)), + end, ct:get_config(ipv6_hosts)), Cmd = "ypmatch "++List++" ipnodes.byname", HostFile = os:cmd(Cmd), get_hosts(HostFile, [], [], []); _ -> - ?config(hardcoded_ipv6_hosts, Config) + ct:get_config(hardcoded_ipv6_hosts) end. get_hosts([$\t|Rest], Cur, Ip, Result) when Ip /= [] -> @@ -376,9 +428,6 @@ get_hosts([C|Rest], Cur, Ip, Result) -> get_hosts([], _, _, Result) -> Result. -parse(suite) -> [parse_hosts, parse_address]; -parse(doc) -> ["Test that parsing of the hosts file or equivalent works,", - "and that erroneous lines are skipped"]. parse_hosts(Config) when is_list(Config) -> ?line DataDir = ?config(data_dir,Config), @@ -730,6 +779,7 @@ cname_loop(Config) when is_list(Config) -> lookup_count=300, lookup_processes=20}). +gethostnative_soft_restart() -> required(hosts). gethostnative_soft_restart(suite) -> []; gethostnative_soft_restart(doc) -> @@ -740,6 +790,8 @@ gethostnative_soft_restart(Config) when is_list(Config) -> #gethostnative_control{ control_seq=[soft_restart]}). + +gethostnative_debug_level() -> required(hosts). gethostnative_debug_level(suite) -> []; gethostnative_debug_level(doc) -> diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl index cc32d1f8f9..5fc8df475d 100644 --- a/lib/kernel/test/inet_res_SUITE.erl +++ b/lib/kernel/test/inet_res_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,24 +18,51 @@ %% -module(inet_res_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/inet.hrl"). -include_lib("kernel/src/inet_dns.hrl"). --export([all/1, init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). -export([basic/1, resolve/1, edns0/1, txt_record/1, files_monitor/1]). --export([gethostbyaddr/1, gethostbyaddr_v6/1, - gethostbyname/1, gethostbyname_v6/1, - getaddr/1, getaddr_v6/1, ipv4_to_ipv6/1, host_and_addr/1]). +-export([ + gethostbyaddr/0, gethostbyaddr/1, + gethostbyaddr_v6/0, gethostbyaddr_v6/1, + gethostbyname/0, gethostbyname/1, + gethostbyname_v6/0, gethostbyname_v6/1, + getaddr/0, getaddr/1, + getaddr_v6/0, getaddr_v6/1, + ipv4_to_ipv6/0, ipv4_to_ipv6/1, + host_and_addr/0, host_and_addr/1 + ]). -define(RUN_NAMED, "run-named"). -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [basic, resolve, edns0, txt_record, files_monitor, - gethostbyaddr, gethostbyaddr_v6, gethostbyname, gethostbyname_v6, - getaddr, getaddr_v6, ipv4_to_ipv6, host_and_addr]. + gethostbyaddr, gethostbyaddr_v6, gethostbyname, + gethostbyname_v6, getaddr, getaddr_v6, ipv4_to_ipv6, + host_and_addr]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. zone_dir(basic) -> otptest; @@ -450,11 +477,19 @@ do_files_monitor(Config) -> %% Compatibility tests. Call the inet_SUITE tests, but with %% lookup = [file,dns] instead of [native] +gethostbyaddr() -> inet_SUITE:t_gethostbyaddr(). gethostbyaddr(Config) -> inet_SUITE:t_gethostbyaddr(Config). +gethostbyaddr_v6() -> inet_SUITE:t_gethostbyaddr_v6(). gethostbyaddr_v6(Config) -> inet_SUITE:t_gethostbyaddr_v6(Config). +gethostbyname() -> inet_SUITE:t_gethostbyname(). gethostbyname(Config) -> inet_SUITE:t_gethostbyname(Config). +gethostbyname_v6() -> inet_SUITE:t_gethostbyname_v6(). gethostbyname_v6(Config) -> inet_SUITE:t_gethostbyname_v6(Config). +getaddr() -> inet_SUITE:t_getaddr(). getaddr(Config) -> inet_SUITE:t_getaddr(Config). +getaddr_v6() -> inet_SUITE:t_getaddr_v6(). getaddr_v6(Config) -> inet_SUITE:t_getaddr_v6(Config). +ipv4_to_ipv6() -> inet_SUITE:ipv4_to_ipv6(). ipv4_to_ipv6(Config) -> inet_SUITE:ipv4_to_ipv6(Config). +host_and_addr() -> inet_SUITE:host_and_addr(). host_and_addr(Config) -> inet_SUITE:host_and_addr(Config). diff --git a/lib/kernel/test/inet_sockopt_SUITE.erl b/lib/kernel/test/inet_sockopt_SUITE.erl index 0fa0226ccf..0c63a6d653 100644 --- a/lib/kernel/test/inet_sockopt_SUITE.erl +++ b/lib/kernel/test/inet_sockopt_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ %% -module(inet_sockopt_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(C_GET_IPPROTO_TCP,1). @@ -48,7 +48,9 @@ -define(C_QUIT,99). --export([all/1, simple/1, loop_all/1, simple_raw/1, simple_raw_getbin/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + simple/1, loop_all/1, simple_raw/1, simple_raw_getbin/1, doc_examples_raw/1,doc_examples_raw_getbin/1, large_raw/1,large_raw_getbin/1,combined/1,combined_getbin/1, type_errors/1]). @@ -56,10 +58,29 @@ -export([init_per_testcase/2, end_per_testcase/2]). -all(suite) -> - [simple,loop_all,simple_raw,simple_raw_getbin, - doc_examples_raw, doc_examples_raw_getbin, - large_raw,large_raw_getbin,combined,combined_getbin,type_errors]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [simple, loop_all, simple_raw, simple_raw_getbin, + doc_examples_raw, doc_examples_raw_getbin, large_raw, + large_raw_getbin, combined, combined_getbin, + type_errors]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl index bbd8261197..2db0f7dcb8 100644 --- a/lib/kernel/test/init_SUITE.erl +++ b/lib/kernel/test/init_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,16 +18,18 @@ %% -module(init_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([get_arguments/1, get_argument/1, boot_var/1, restart/1, + many_restarts/1, get_plain_arguments/1, - reboot/1, stop/1, get_status/1, script_id/1, boot/1]). + reboot/1, stop/1, get_status/1, script_id/1]). -export([boot1/1, boot2/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([init/1, fini/1]). @@ -38,17 +40,35 @@ %% Should be started in a CC view with: %% erl -sname master -rsh ctrsh %%----------------------------------------------------------------- -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [get_arguments, get_argument, boot_var, - get_plain_arguments, - restart, - get_status, script_id, boot]. + many_restarts, + get_plain_arguments, restart, get_status, script_id, + {group, boot}]. + +groups() -> + [{boot, [], [boot1, boot2]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:seconds(?DEFAULT_TIMEOUT_SEC)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). @@ -299,6 +319,73 @@ is_real_system(KernelVsn, StdlibVsn) -> %% Therefore the slave process must be killed %% before restart. %% ------------------------------------------------ +many_restarts(doc) -> []; +many_restarts(suite) -> + case ?t:os_type() of + {Fam, _} when Fam == unix; Fam == win32 -> + {req, [distribution, {local_slave_nodes, 1}, {time, 5}]}; + _ -> + {skip, "Only run on unix and win32"} + end; + +many_restarts(Config) when is_list(Config) -> + ?line Dog = ?t:timetrap(?t:seconds(480)), + ?line {ok, Node} = loose_node:start(init_test, "", ?DEFAULT_TIMEOUT_SEC), + ?line loop_restart(30,Node,rpc:call(Node,erlang,whereis,[error_logger])), + ?line loose_node:stop(Node), + ?line ?t:timetrap_cancel(Dog), + ok. + +loop_restart(0,_,_) -> + ok; +loop_restart(N,Node,EHPid) -> + ?line erlang:monitor_node(Node, true), + ?line ok = rpc:call(Node, init, restart, []), + ?line receive + {nodedown, Node} -> + ok + after 10000 -> + loose_node:stop(Node), + ?t:fail(not_stopping) + end, + ?line ok = wait_for(30, Node, EHPid), + ?line loop_restart(N-1,Node,rpc:call(Node,erlang,whereis,[error_logger])). + +wait_for(0,Node,_) -> + loose_node:stop(Node), + error; +wait_for(N,Node,EHPid) -> + ?line case rpc:call(Node, erlang, whereis, [error_logger]) of + Pid when is_pid(Pid), Pid =/= EHPid -> + %% ?line erlang:display(ok), + ?line ok; + _X -> + %% ?line erlang:display(_X), + %% ?line Procs = rpc:call(Node, erlang, processes, []), + %% ?line erlang:display(Procs), + %% case is_list(Procs) of + %% true -> + %% ?line [(catch erlang:display( + %% rpc:call(Node, + %% erlang, + %% process_info, + %% [Y,registered_name]))) + %% || Y <- Procs]; + %% _ -> + %% ok + %% end, + receive + after 100 -> + ok + end, + ?line wait_for(N-1,Node,EHPid) + end. + +%% ------------------------------------------------ +%% Slave executes erlang:halt() on master nodedown. +%% Therefore the slave process must be killed +%% before restart. +%% ------------------------------------------------ restart(doc) -> []; restart(suite) -> case ?t:os_type() of @@ -488,7 +575,6 @@ script_id(Config) when is_list(Config) -> %% ------------------------------------------------ %% Start the slave system with -boot flag. %% ------------------------------------------------ -boot(suite) -> [boot1, boot2]. boot1(doc) -> []; boot1(suite) -> {req, [distribution, {local_slave_nodes, 1}, {time, 35}]}; diff --git a/lib/kernel/test/interactive_shell_SUITE.erl b/lib/kernel/test/interactive_shell_SUITE.erl index c0db292ba5..b2308dd321 100644 --- a/lib/kernel/test/interactive_shell_SUITE.erl +++ b/lib/kernel/test/interactive_shell_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -17,8 +17,10 @@ %% %CopyrightEnd% %% -module(interactive_shell_SUITE). --include("test_server.hrl"). --export([all/1, get_columns_and_rows/1, exit_initial/1, job_control_local/1, +-include_lib("test_server/include/test_server.hrl"). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + get_columns_and_rows/1, exit_initial/1, job_control_local/1, job_control_remote/1, job_control_remote_noshell/1]). @@ -44,10 +46,28 @@ end_per_testcase(_Func, Config) -> test_server:timetrap_cancel(Dog). -all(suite) -> - [get_columns_and_rows, exit_initial, job_control_local, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [get_columns_and_rows, exit_initial, job_control_local, job_control_remote, job_control_remote_noshell]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %-define(DEBUG,1). -ifdef(DEBUG). -define(dbg(Data),erlang:display(Data)). diff --git a/lib/kernel/test/kernel.cover b/lib/kernel/test/kernel.cover index 228dafc565..f6967ca651 100644 --- a/lib/kernel/test/kernel.cover +++ b/lib/kernel/test/kernel.cover @@ -1,4 +1,3 @@ %% -*- erlang -*- -{exclude,all}. -{include,[gen_udp,inet6_udp,inet_res,inet_dns]}. +{incl_mods,[gen_udp,inet6_udp,inet_res,inet_dns]}. diff --git a/lib/kernel/test/kernel.dynspec b/lib/kernel/test/kernel.dynspec deleted file mode 100644 index 297a7c71ea..0000000000 --- a/lib/kernel/test/kernel.dynspec +++ /dev/null @@ -1,57 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("kernel.dynspec", [{'Os',"Unix"}]). - -case Os of - "VxWorks" -> - FsCantHandle = "VxWorks filesystem can't handle this", - FsOverload = "VxWorks filesystem would overload", - CantHandle = "VxWorks can't handle this", - SlaveMisadaption = "Test not adopted to slaves on different machine", - [{skip,{application_SUITE, - "VxWorks: requires manual testing "++ - "(requires multiple nodes (OTP-1774))"}}, - {skip,{bif_SUITE, spawn_link_race1, "Known bug."}}, - {skip,{erl_distribution_SUITE, "VxWorks: More vx nodes needed"}}, - {skip,{file_SUITE,read_write_file,FsCantHandle}}, - {skip,{file_SUITE,cur_dir_0,FsCantHandle}}, - {skip,{file_SUITE,open1,FsCantHandle}}, - {skip,{file_SUITE,file_info_times,FsCantHandle}}, - {skip,{file_SUITE,file_write_file_info,FsCantHandle}}, - {skip,{file_SUITE,truncate,FsCantHandle}}, - {skip,{file_SUITE,rename,FsCantHandle}}, - {skip,{file_SUITE,e_delete,FsCantHandle}}, - {skip,{file_SUITE,e_rename,FsCantHandle}}, - {skip,{file_SUITE,delayed_write,FsCantHandle}}, - {skip,{file_SUITE,read_ahead,FsCantHandle}}, - {skip,{file_SUITE,segment_write,FsOverload}}, - {skip,{file_SUITE,segment_read,FsOverload}}, - {skip,{file_SUITE,compress_errors,FsCantHandle}}, - {skip,{global_SUITE, - "To heavy on slavenodes for VxWorks (and more)."}}, - {skip,{global_group_SUITE, "To heavy on slavenodes for VxWorks."}}, - {skip,{heart_SUITE, "Not for VxWorks heart, it's special"}}, - {skip,{init_SUITE,restart,"Uses peer nodes"}}, - {skip,{kernel_config_SUITE, "VxWorks does not support slave nodes"}}, - {skip,{os_SUITE,space_in_cwd,CantHandle}}, - {skip,{os_SUITE,space_in_name,CantHandle}}, - {skip,{os_SUITE,quoting,CantHandle}}, - {skip,{prim_file_SUITE,open1,FsCantHandle}}, - {skip,{prim_file_SUITE,compress_errors,FsCantHandle}}, - {skip,{seq_trace_SUITE,distributed_recv,SlaveMisadaption}}, - {skip,{seq_trace_SUITE,distributed_exit,SlaveMisadaption}}]; - _ -> - [] -end ++ -try gen_sctp:open() of - {ok,Socket} -> - gen_sctp:close(Socket), - []; - _ -> - [] -catch - error:badarg -> - [{skip,{gen_sctp_SUITE,"SCTP not supported on this machine"}}]; - _:_ -> - [] -end. diff --git a/lib/kernel/test/kernel.spec b/lib/kernel/test/kernel.spec new file mode 100644 index 0000000000..62afc9f97b --- /dev/null +++ b/lib/kernel/test/kernel.spec @@ -0,0 +1,4 @@ +{config, "../test_server/ts.config"}. +{config, "../test_server/ts.unix.config"}. + +{suites,"../kernel_test", all}. diff --git a/lib/kernel/test/kernel.spec.wxworks b/lib/kernel/test/kernel.spec.wxworks new file mode 100644 index 0000000000..370e474e64 --- /dev/null +++ b/lib/kernel/test/kernel.spec.wxworks @@ -0,0 +1,63 @@ +%% -*- erlang -*- +{suites,"kernel_test",all}. +{skip_cases,"kernel_test",bif_SUITE,[spawn_link_race1],"Known bug."}. +{skip_cases,"kernel_test",file_SUITE, + [read_write_file], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [cur_dir_0], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [open1], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [file_info_times], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [file_write_file_info], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [truncate], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [rename], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [e_delete], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [e_rename], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [delayed_write], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [read_ahead], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",file_SUITE, + [segment_write], + "VxWorks filesystem would overload"}. +{skip_cases,"kernel_test",file_SUITE, + [segment_read], + "VxWorks filesystem would overload"}. +{skip_cases,"kernel_test",file_SUITE, + [compress_errors], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",init_SUITE,[restart],"Uses peer nodes"}. +{skip_cases,"kernel_test",os_SUITE,[space_in_cwd],"VxWorks can't handle this"}. +{skip_cases,"kernel_test",os_SUITE, + [space_in_name], + "VxWorks can't handle this"}. +{skip_cases,"kernel_test",os_SUITE,[quoting],"VxWorks can't handle this"}. +{skip_cases,"kernel_test",prim_file_SUITE, + [open1], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",prim_file_SUITE, + [compress_errors], + "VxWorks filesystem can't handle this"}. +{skip_cases,"kernel_test",seq_trace_SUITE, + [distributed_recv], + "Test not adopted to slaves on different machine"}. +{skip_cases,"kernel_test",seq_trace_SUITE, + [distributed_exit], + "Test not adopted to slaves on different machine"}. diff --git a/lib/kernel/test/kernel_SUITE.erl b/lib/kernel/test/kernel_SUITE.erl index bb1d905de3..16b6c54939 100644 --- a/lib/kernel/test/kernel_SUITE.erl +++ b/lib/kernel/test/kernel_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,15 +20,16 @@ %%% Kernel application test suite. %%%----------------------------------------------------------------- -module(kernel_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([app_test/1]). @@ -36,15 +37,31 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [app_test]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/kernel_config_SUITE.erl b/lib/kernel/test/kernel_config_SUITE.erl index c72fc3f02d..93bdb8657c 100644 --- a/lib/kernel/test/kernel_config_SUITE.erl +++ b/lib/kernel/test/kernel_config_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,23 +18,35 @@ %% -module(kernel_config_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). --export([all/1, sync/1]). +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, sync/1]). --export([init/1, fini/1]). +-export([init_per_suite/1, end_per_suite/1]). -all(suite) -> - [{conf, init, [sync], fini}]. +suite() -> [{ct_hooks,[ts_install_cth]}]. -init(doc) -> []; -init(suite) -> []; -init(Config) when is_list(Config) -> +all() -> + [sync]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(doc) -> []; +init_per_suite(suite) -> []; +init_per_suite(Config) when is_list(Config) -> Config. -fini(doc) -> []; -fini(suite) -> []; -fini(Config) when is_list(Config) -> +end_per_suite(doc) -> []; +end_per_suite(suite) -> []; +end_per_suite(Config) when is_list(Config) -> stop_node(init_test), Config. diff --git a/lib/kernel/test/myApp.erl b/lib/kernel/test/myApp.erl index 2b92046141..26dc74f91b 100644 --- a/lib/kernel/test/myApp.erl +++ b/lib/kernel/test/myApp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index eacf3c7584..b08b12c978 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,15 +18,34 @@ %% -module(os_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([space_in_cwd/1, quoting/1, space_in_name/1, bad_command/1, find_executable/1, unix_comment_in_command/1, evil/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [space_in_cwd, quoting, space_in_name, bad_command, + find_executable, unix_comment_in_command, evil]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [space_in_cwd, quoting, space_in_name, bad_command, find_executable, - unix_comment_in_command, evil]. space_in_cwd(doc) -> "Test that executing a command in a current working directory " @@ -156,6 +175,21 @@ find_executable(Config) when is_list(Config) -> ?line find_exe(Current, "my_batch", ".bat", Path), ok; {unix, _} -> + DataDir = ?config(data_dir, Config), + + %% Smoke test. + case lib:progname() of + erl -> + ?line ErlPath = os:find_executable("erl"), + ?line true = is_list(ErlPath), + ?line true = filelib:is_regular(ErlPath); + _ -> + %% Don't bother -- the progname could include options. + ok + end, + + %% Never return a directory name. + ?line false = os:find_executable("unix", [DataDir]), ok; vxworks -> ok diff --git a/lib/kernel/test/pdict_SUITE.erl b/lib/kernel/test/pdict_SUITE.erl index 87ee951a0c..8afdfc8a47 100644 --- a/lib/kernel/test/pdict_SUITE.erl +++ b/lib/kernel/test/pdict_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ %% NB: The ?line macro cannot be used when testing the dictionary. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(M(A,B),m(A,B,?MODULE,?LINE)). -ifdef(DEBUG). @@ -29,22 +29,41 @@ -define(DEBUGF(A,B), noop). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, simple/1, complicated/1, heavy/1, info/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). -export([other_process/2]). init_per_testcase(_Case, Config) -> ?line Dog = ?t:timetrap(test_server:minutes(10)), [{watchdog, Dog} | Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> [simple, complicated, heavy, info]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + simple(doc) -> ["Tests simple functionality in process dictionary."]; simple(suite) -> diff --git a/lib/kernel/test/pg2_SUITE.erl b/lib/kernel/test/pg2_SUITE.erl index df28dcf447..0ac34e735c 100644 --- a/lib/kernel/test/pg2_SUITE.erl +++ b/lib/kernel/test/pg2_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,14 +20,16 @@ %%----------------------------------------------------------------- -module(pg2_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(datadir, ?config(data_dir, Config)). -define(privdir, ?config(priv_dir, Config)). --export([all/1, init_per_testcase/2, fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2]). --export([tickets/1, - otp_7277/1, otp_8259/1, otp_8653/1, +-export([ + otp_7277/1, otp_8259/1, otp_8653/1, compat/1, basic/1]). % Default timetrap timeout (set in init_per_testcase). @@ -44,16 +46,33 @@ init_per_testcase(Case, Config) -> ?line Dog = ?t:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog} | Config]. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> Dog = ?config(watchdog, _Config), test_server:timetrap_cancel(Dog), ok. -all(suite) -> - [tickets]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, tickets}]. + +groups() -> + [{tickets, [], + [otp_7277, otp_8259, otp_8653, compat, basic]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -tickets(suite) -> - [otp_7277, otp_8259, otp_8653, compat, basic]. otp_7277(doc) -> "OTP-7277. Bugfix leave()."; diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index 1688ec45ca..a04ea3cdcd 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -17,40 +17,40 @@ %% %CopyrightEnd% %% -module(prim_file_SUITE). --export([all/1, - init/1, fini/1, - read_write_file/1, dirs/1, files/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + read_write_file/1]). -export([cur_dir_0a/1, cur_dir_0b/1, cur_dir_1a/1, cur_dir_1b/1, make_del_dir_a/1, make_del_dir_b/1, - pos/1, pos1/1, pos2/1]). + pos1/1, pos2/1]). -export([close/1, delete_a/1, delete_b/1]). --export([open/1, open1/1, modes/1]). --export([file_info/1, - file_info_basic_file_a/1, file_info_basic_file_b/1, - file_info_basic_directory_a/1, file_info_basic_directory_b/1, - file_info_bad_a/1, file_info_bad_b/1, - file_info_times_a/1, file_info_times_b/1, - file_write_file_info_a/1, file_write_file_info_b/1]). +-export([ open1/1, modes/1]). +-export([ + file_info_basic_file_a/1, file_info_basic_file_b/1, + file_info_basic_directory_a/1, file_info_basic_directory_b/1, + file_info_bad_a/1, file_info_bad_b/1, + file_info_times_a/1, file_info_times_b/1, + file_write_file_info_a/1, file_write_file_info_b/1]). -export([rename_a/1, rename_b/1, access/1, truncate/1, datasync/1, sync/1, read_write/1, pread_write/1, append/1, exclusive/1]). --export([errors/1, e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). +-export([ e_delete/1, e_rename/1, e_make_dir/1, e_del_dir/1]). --export([compression/1, read_not_really_compressed/1, - read_compressed/1, write_compressed/1, - compress_errors/1]). +-export([ read_not_really_compressed/1, + read_compressed/1, write_compressed/1, + compress_errors/1]). --export([links/1, - make_link_a/1, make_link_b/1, - read_link_info_for_non_link/1, - symlinks_a/1, symlinks_b/1, - list_dir_limit/1]). +-export([ + make_link_a/1, make_link_b/1, + read_link_info_for_non_link/1, + symlinks_a/1, symlinks_b/1, + list_dir_limit/1]). -export([advise/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -define(PRIM_FILE, prim_file). @@ -67,14 +67,47 @@ _ -> apply(?PRIM_FILE, F, [H | A]) end). -all(suite) -> {req, [kernel], - {conf, init, - [read_write_file, dirs, files, - delete_a, delete_b, rename_a, rename_b, errors, - compression, links, list_dir_limit], - fini}}. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [read_write_file, {group, dirs}, {group, files}, + delete_a, delete_b, rename_a, rename_b, {group, errors}, + {group, compression}, {group, links}, list_dir_limit]. + +groups() -> + [{dirs, [], + [make_del_dir_a, make_del_dir_b, cur_dir_0a, cur_dir_0b, + cur_dir_1a, cur_dir_1b]}, + {files, [], + [{group, open}, {group, pos}, {group, file_info}, + truncate, sync, datasync, advise]}, + {open, [], + [open1, modes, close, access, read_write, pread_write, + append, exclusive]}, + {pos, [], [pos1, pos2]}, + {file_info, [], + [file_info_basic_file_a, file_info_basic_file_b, + file_info_basic_directory_a, + file_info_basic_directory_b, file_info_bad_a, + file_info_bad_b, file_info_times_a, file_info_times_b, + file_write_file_info_a, file_write_file_info_b]}, + {errors, [], + [e_delete, e_rename, e_make_dir, e_del_dir]}, + {compression, [], + [read_compressed, read_not_really_compressed, + write_compressed, compress_errors]}, + {links, [], + [make_link_a, make_link_b, read_link_info_for_non_link, + symlinks_a, symlinks_b]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -init(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> Priv = ?config(priv_dir, Config), @@ -91,7 +124,7 @@ init(Config) when is_list(Config) -> Config end. -fini(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> case os:type() of {win32, _} -> os:cmd("subst z: /d"); @@ -190,9 +223,6 @@ read_write_file(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -dirs(suite) -> [make_del_dir_a, make_del_dir_b, - cur_dir_0a, cur_dir_0b, - cur_dir_1a, cur_dir_1b]. make_del_dir_a(suite) -> []; make_del_dir_a(doc) -> []; @@ -382,10 +412,7 @@ win_cur_dir_1(_Config, Handle) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -files(suite) -> [open,pos,file_info,truncate,sync,datasync,advise]. -open(suite) -> [open1,modes,close,access,read_write, - pread_write,append,exclusive]. open1(suite) -> []; open1(doc) -> []; @@ -628,7 +655,6 @@ exclusive(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -pos(suite) -> [pos1,pos2]. pos1(suite) -> []; pos1(doc) -> []; @@ -716,12 +742,6 @@ pos2(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -file_info(suite) -> [file_info_basic_file_a, file_info_basic_file_b, - file_info_basic_directory_a, - file_info_basic_directory_b, - file_info_bad_a, file_info_bad_b, - file_info_times_a, file_info_times_b, - file_write_file_info_a, file_write_file_info_b]. file_info_basic_file_a(suite) -> []; file_info_basic_file_a(doc) -> []; @@ -1298,7 +1318,6 @@ rename(Config, Handle, Suffix) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -errors(suite) -> [e_delete, e_rename, e_make_dir, e_del_dir]. e_delete(suite) -> []; e_delete(doc) -> []; @@ -1550,8 +1569,6 @@ e_del_dir(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -compression(suite) -> [read_compressed, read_not_really_compressed, - write_compressed, compress_errors]. %% Trying reading and positioning from a compressed file. @@ -1704,11 +1721,6 @@ compress_errors(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. -links(doc) -> "Test the link functions."; -links(suite) -> - [make_link_a, make_link_b, - read_link_info_for_non_link, - symlinks_a, symlinks_b]. make_link_a(doc) -> "Test creating a hard link."; make_link_a(suite) -> []; diff --git a/lib/kernel/test/ram_file_SUITE.erl b/lib/kernel/test/ram_file_SUITE.erl index 798a37d3dc..9b3fbb91fc 100644 --- a/lib/kernel/test/ram_file_SUITE.erl +++ b/lib/kernel/test/ram_file_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,14 +19,15 @@ -module(ram_file_SUITE). --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, %% init/1, fini/1, - init_per_testcase/2, fin_per_testcase/2]). + init_per_testcase/2, end_per_testcase/2]). -export([open_modes/1, open_old_modes/1, pread_pwrite/1, position/1, truncate/1, sync/1, get_set_file/1, compress/1, uuencode/1, large_file_errors/1, large_file_light/1, large_file_heavy/1]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include_lib("kernel/include/file.hrl"). -define(FILE_MODULE, file). % Name of module to test @@ -34,11 +35,29 @@ %%-------------------------------------------------------------------------- -all(suite) -> - [open_modes, open_old_modes, pread_pwrite, position, +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [open_modes, open_old_modes, pread_pwrite, position, truncate, sync, get_set_file, compress, uuencode, large_file_errors, large_file_light, large_file_heavy]. +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Time = case Func of @@ -51,7 +70,7 @@ init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> %% error_logger:info_msg("~p:~p *****~n", [?MODULE, Func]), [{watchdog, Dog} | Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> %% error_logger:info_msg("~p:~p END *****~n", [?MODULE, Func]), Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog). diff --git a/lib/kernel/test/rpc_SUITE.erl b/lib/kernel/test/rpc_SUITE.erl index 2b7de40797..7adef49014 100644 --- a/lib/kernel/test/rpc_SUITE.erl +++ b/lib/kernel/test/rpc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,8 @@ %% -module(rpc_SUITE). --export([all/1]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2]). -export([call/1, block_call/1, multicall/1, multicall_timeout/1, multicall_dies/1, multicall_node_dies/1, called_dies/1, called_node_dies/1, @@ -26,13 +27,31 @@ -export([suicide/2, suicide/3, f/0, f2/0]). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [call, block_call, multicall, multicall_timeout, + multicall_dies, multicall_node_dies, called_dies, + called_node_dies, called_throws, call_benchmark, + async_call]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [call, block_call, multicall, multicall_timeout, - multicall_dies, multicall_node_dies, - called_dies, called_node_dies, - called_throws, call_benchmark, async_call]. call(doc) -> "Test different rpc calls"; diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl index b557c7fb1e..47eeb4df4c 100644 --- a/lib/kernel/test/seq_trace_SUITE.erl +++ b/lib/kernel/test/seq_trace_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -18,7 +18,9 @@ %% -module(seq_trace_SUITE). --export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2]). -export([token_set_get/1, tracer_set_get/1, print/1, send/1, distributed_send/1, recv/1, distributed_recv/1, trace_exit/1, distributed_exit/1, call/1, port/1, @@ -29,21 +31,40 @@ start_tracer/0, stop_tracer/1, do_match_set_seq_token/1, do_gc_seq_token/1, countdown_start/2]). -%-define(line_trace, 1). --include("test_server.hrl"). + %-define(line_trace, 1). +-include_lib("test_server/include/test_server.hrl"). -define(default_timeout, ?t:minutes(1)). -all(suite) -> [token_set_get, tracer_set_get, print, - send, distributed_send, recv, distributed_recv, - trace_exit, distributed_exit, call, port, - match_set_seq_token, gc_seq_token]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [token_set_get, tracer_set_get, print, send, + distributed_send, recv, distributed_recv, trace_exit, + distributed_exit, call, port, match_set_seq_token, + gc_seq_token]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> ?line Dog = test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/kernel/test/topApp.erl b/lib/kernel/test/topApp.erl index acf98e6da0..f44e99f738 100644 --- a/lib/kernel/test/topApp.erl +++ b/lib/kernel/test/topApp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/topApp2.erl b/lib/kernel/test/topApp2.erl index 4587910ff3..b791d4a914 100644 --- a/lib/kernel/test/topApp2.erl +++ b/lib/kernel/test/topApp2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/topApp3.erl b/lib/kernel/test/topApp3.erl index 1bb6f2f31a..456ef5b2fb 100644 --- a/lib/kernel/test/topApp3.erl +++ b/lib/kernel/test/topApp3.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/kernel/test/wrap_log_reader_SUITE.erl b/lib/kernel/test/wrap_log_reader_SUITE.erl index ceac593e44..ffc8def626 100644 --- a/lib/kernel/test/wrap_log_reader_SUITE.erl +++ b/lib/kernel/test/wrap_log_reader_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -28,31 +28,53 @@ -define(config(X,Y), foo). -define(t,test_server). -else. --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -define(format(S, A), ok). -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. --export([all/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, no_file/1, - one/1, one_empty/1, one_filled/1, - two/1, two_filled/1, - four/1, four_filled/1, - wrap/1, wrap_filled/1, + one_empty/1, one_filled/1, + two_filled/1, + four_filled/1, + wrap_filled/1, wrapping/1, external/1, error/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([init_per_testcase/2, end_per_testcase/2]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [no_file, {group, one}, {group, two}, {group, four}, + {group, wrap}, wrapping, external, error]. + +groups() -> + [{one, [], [one_empty, one_filled]}, + {two, [], [two_filled]}, {four, [], [four_filled]}, + {wrap, [], [wrap_filled]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [no_file, one, two, four, wrap, wrapping, external, error]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Dog=?t:timetrap(?t:seconds(60)), [{watchdog, Dog} | Config]. -fin_per_testcase(_Func, _Config) -> +end_per_testcase(_Func, _Config) -> Dog=?config(watchdog, _Config), ?t:timetrap_cancel(Dog). @@ -76,8 +98,6 @@ no_file(Conf) when is_list(Conf) -> delete_files(File), ok. -one(suite) -> [one_empty, one_filled]; -one(doc) -> ["One index file"]. one_empty(suite) -> []; one_empty(doc) -> ["One empty index file"]; @@ -139,8 +159,6 @@ test_one(File) -> {chunk, 1, ["first round, two"]}, eof], wlt, ?LINE), ok. -two(suite) -> [two_filled]; -two(doc) -> ["Two index files"]. two_filled(suite) -> []; two_filled(doc) -> ["Two filled index files"]; @@ -181,8 +199,6 @@ test_two(File) -> {chunk, 2, ["first round, 12"]}, eof], wlt, ?LINE), ok. -four(suite) -> [four_filled]; -four(doc) -> ["Four index files"]. four_filled(suite) -> []; four_filled(doc) -> ["Four filled index files"]; @@ -226,8 +242,6 @@ test_four(File) -> {chunk, 2, ["first round, 42"]}, eof], wlt, ?LINE), ok. -wrap(suite) -> [wrap_filled]; -wrap(doc) -> ["Wrap index file, first wrapping"]. wrap_filled(suite) -> []; wrap_filled(doc) -> ["First wrap, open, filled index file"]; diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index f20c9a176b..9eb84c9167 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,7 +19,7 @@ -module(zlib_SUITE). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -compile(export_all). @@ -48,7 +48,7 @@ init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(60)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Func, Config) -> +end_per_testcase(_Func, Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog). @@ -69,33 +69,40 @@ error(Format, Args, File, Line) -> %% end, %% log("<>ERROR<>~n" ++ Format, Args, File, Line). -all(suite) -> - [api, examples, func, smp, otp_7359]. - -api(doc) -> "Basic the api tests"; -api(suite) -> - [api_open_close, - api_deflateInit, - api_deflateSetDictionary, - api_deflateReset, - api_deflateParams, - api_deflate, - api_deflateEnd, - api_inflateInit, - api_inflateSetDictionary, - api_inflateSync, - api_inflateReset, - api_inflate, - api_inflateEnd, - api_setBufsz, - api_getBufsz, - api_crc32, - api_adler32, - api_getQSize, - api_un_compress, - api_un_zip, -% api_g_un_zip_file, - api_g_un_zip]. +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [{group, api}, {group, examples}, {group, func}, smp, + otp_7359]. + +groups() -> + [{api, [], + [api_open_close, api_deflateInit, + api_deflateSetDictionary, api_deflateReset, + api_deflateParams, api_deflate, api_deflateEnd, + api_inflateInit, api_inflateSetDictionary, + api_inflateSync, api_inflateReset, api_inflate, + api_inflateEnd, api_setBufsz, api_getBufsz, api_crc32, + api_adler32, api_getQSize, api_un_compress, api_un_zip, + api_g_un_zip]}, + {examples, [], [intro]}, + {func, [], + [zip_usage, gz_usage, gz_usage2, compress_usage, + dictionary_usage, large_deflate, crc, adler]}]. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + api_open_close(doc) -> "Test open/0 and close/1"; api_open_close(suite) -> []; @@ -517,11 +524,6 @@ bad_len_data() -> %% zlib:zip(<<42>>), one byte changed. <<31,139,8,0,0,0,0,0,0,3,211,2,0,91,38,185,9,2,0,0,0>>. -examples(doc) -> "Test the doc examples"; -examples(suite) -> - [ - intro - ]. intro(suite) -> []; intro(doc) -> ""; @@ -551,15 +553,6 @@ intro(Config) when is_list(Config) -> Orig = list_to_binary(lists:duplicate(5, D)), ?m(Orig, zlib:uncompress(Res)). -func(doc) -> "Test the functionality"; -func(suite) -> - [zip_usage, gz_usage, gz_usage2, compress_usage, - dictionary_usage, - large_deflate, - %% inflateSync, - crc, - adler - ]. large_deflate(doc) -> "Test deflate large file, which had a bug reported on erlang-bugs"; large_deflate(suite) -> []; diff --git a/lib/kernel/vsn.mk b/lib/kernel/vsn.mk index e33b90a274..e7b71cc168 100644 --- a/lib/kernel/vsn.mk +++ b/lib/kernel/vsn.mk @@ -1 +1 @@ -KERNEL_VSN = 2.14.3 +KERNEL_VSN = 2.14.4 |