aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/doc/src/code.xml2
-rw-r--r--lib/kernel/doc/src/disk_log.xml2
-rw-r--r--lib/kernel/doc/src/error_handler.xml2
-rw-r--r--lib/kernel/doc/src/file.xml76
-rw-r--r--lib/kernel/doc/src/gen_tcp.xml1
-rw-r--r--lib/kernel/doc/src/inet.xml65
-rw-r--r--lib/kernel/doc/src/notes.xml98
-rw-r--r--lib/kernel/doc/src/part_notes_history.xml2
-rw-r--r--lib/kernel/doc/src/rpc.xml2
-rw-r--r--lib/kernel/doc/src/user.xml2
-rw-r--r--lib/kernel/src/application.erl6
-rw-r--r--lib/kernel/src/code.erl131
-rw-r--r--lib/kernel/src/disk_log_1.erl8
-rw-r--r--lib/kernel/src/erl_ddll.erl33
-rw-r--r--lib/kernel/src/error_handler.erl11
-rw-r--r--lib/kernel/src/file.erl74
-rw-r--r--lib/kernel/src/file_io_server.erl4
-rw-r--r--lib/kernel/src/global.erl30
-rw-r--r--lib/kernel/src/inet.erl12
-rw-r--r--lib/kernel/src/inet6_tcp_dist.erl6
-rw-r--r--lib/kernel/src/inet_int.hrl3
-rw-r--r--lib/kernel/src/net_kernel.erl33
-rw-r--r--lib/kernel/src/os.erl33
-rw-r--r--lib/kernel/test/Makefile3
-rw-r--r--lib/kernel/test/appinc1.erl2
-rw-r--r--lib/kernel/test/appinc1x.erl2
-rw-r--r--lib/kernel/test/appinc2.erl2
-rw-r--r--lib/kernel/test/appinc2A.erl2
-rw-r--r--lib/kernel/test/appinc2B.erl2
-rw-r--r--lib/kernel/test/appinc2top.erl2
-rw-r--r--lib/kernel/test/application_SUITE.erl53
-rw-r--r--lib/kernel/test/bif_SUITE.erl50
-rw-r--r--lib/kernel/test/ch.erl2
-rw-r--r--lib/kernel/test/ch_sup.erl2
-rw-r--r--lib/kernel/test/cleanup.erl17
-rw-r--r--lib/kernel/test/code_SUITE.erl180
-rw-r--r--lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl2
-rw-r--r--lib/kernel/test/code_a_test.erl2
-rw-r--r--lib/kernel/test/code_b_test.erl2
-rw-r--r--lib/kernel/test/disk_log_SUITE.erl127
-rw-r--r--lib/kernel/test/erl_boot_server_SUITE.erl26
-rw-r--r--lib/kernel/test/erl_distribution_SUITE.erl79
-rw-r--r--lib/kernel/test/erl_distribution_wb_SUITE.erl33
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl50
-rw-r--r--lib/kernel/test/error_logger_SUITE.erl32
-rw-r--r--lib/kernel/test/error_logger_warn_SUITE.erl36
-rw-r--r--lib/kernel/test/file_SUITE.erl127
-rw-r--r--lib/kernel/test/file_name_SUITE.erl1756
-rw-r--r--lib/kernel/test/gen_sctp_SUITE.erl48
-rw-r--r--lib/kernel/test/gen_tcp_api_SUITE.erl100
-rw-r--r--lib/kernel/test/gen_tcp_echo_SUITE.erl36
-rw-r--r--lib/kernel/test/gen_tcp_misc_SUITE.erl195
-rw-r--r--lib/kernel/test/gen_udp_SUITE.erl98
-rw-r--r--lib/kernel/test/global_SUITE.erl98
-rw-r--r--lib/kernel/test/global_group_SUITE.erl66
-rw-r--r--lib/kernel/test/heart_SUITE.erl35
-rw-r--r--lib/kernel/test/inet_SUITE.erl257
-rw-r--r--lib/kernel/test/inet_res_SUITE.erl53
-rw-r--r--lib/kernel/test/inet_sockopt_SUITE.erl35
-rw-r--r--lib/kernel/test/init_SUITE.erl108
-rw-r--r--lib/kernel/test/interactive_shell_SUITE.erl30
-rw-r--r--lib/kernel/test/kernel.cover3
-rw-r--r--lib/kernel/test/kernel.dynspec57
-rw-r--r--lib/kernel/test/kernel.spec4
-rw-r--r--lib/kernel/test/kernel.spec.wxworks63
-rw-r--r--lib/kernel/test/kernel_SUITE.erl33
-rw-r--r--lib/kernel/test/kernel_config_SUITE.erl36
-rw-r--r--lib/kernel/test/myApp.erl2
-rw-r--r--lib/kernel/test/os_SUITE.erl49
-rw-r--r--lib/kernel/test/pdict_SUITE.erl31
-rw-r--r--lib/kernel/test/pg2_SUITE.erl39
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl114
-rw-r--r--lib/kernel/test/ram_file_SUITE.erl33
-rw-r--r--lib/kernel/test/rpc_SUITE.erl35
-rw-r--r--lib/kernel/test/seq_trace_SUITE.erl39
-rw-r--r--lib/kernel/test/topApp.erl2
-rw-r--r--lib/kernel/test/topApp2.erl2
-rw-r--r--lib/kernel/test/topApp3.erl2
-rw-r--r--lib/kernel/test/wrap_log_reader_SUITE.erl52
-rw-r--r--lib/kernel/test/zlib_SUITE.erl81
-rw-r--r--lib/kernel/vsn.mk2
81 files changed, 4143 insertions, 922 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/file.xml b/lib/kernel/doc/src/file.xml
index 2044b074ee..36fce464c5 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -36,6 +36,61 @@
other Erlang processes to continue executing in parallel with
the file operations. See the command line flag
<c>+A</c> in <seealso marker="erts:erl">erl(1)</seealso>.</p>
+
+ <p>The Erlang VM supports file names in Unicode to a limited
+ extent. Depending on how the VM is started (with the parameter
+ <c>+fnu</c> or <c>+fnl</c>), file names given can contain
+ characters > 255 and the VM system will convert file names
+ back and forth to the native file name encoding.</p>
+
+ <p>The default behavior for Unicode character translation depends
+ on to what extent the underlying OS/filesystem enforces consistent
+ naming. On OSes where all file names are ensured to be in one or
+ another encoding, Unicode is the default (currently this holds for
+ Windows and MacOSX). On OSes with completely transparent file
+ naming (i.e. all Unixes except MacOSX), ISO-latin-1 file naming is
+ the default. The reason for the ISO-latin-1 default is that
+ file names are not guaranteed to be possible to interpret according to
+ the Unicode encoding expected (i.e. UTF-8), and file names that
+ cannot be decoded will only be accessible by using &quot;raw
+ file names&quot;, in other word file names given as binaries.</p>
+
+ <p>As file names are traditionally not binaries in Erlang,
+ applications that need to handle raw file names need to be
+ converted, why the Unicode mode for file names is not default on
+ systems having completely transparent file naming.</p>
+
+ <note>As of R14B01, the most basic file handling modules
+ (<c>file</c>, <c>prim_file</c>, <c>filelib</c> and
+ <c>filename</c>) accept raw file names, but the rest of OTP is not
+ guaranteed to handle them, why Unicode file naming on systems
+ where it is not default is still considered experimental.</note>
+
+ <p>Raw file names is a new feature in OTP R14B01, which allows the
+ user to supply completely uninterpreted file names to the
+ underlying OS/filesystem. They are supplied as binaries, where it
+ is up to the user to supply a correct encoding for the
+ environment. The function <c>file:native_name_encoding()</c> can
+ be used to check what encoding the VM is working in. If the
+ function returns <c>latin1</c> file names are not in any way
+ converted to Unicode, if it is <c>utf8</c>, raw file names should
+ be encoded as UTF-8 if they are to follow the convention of the VM
+ (and usually the convention of the OS as well). Using raw
+ file names is useful if you have a filesystem with inconsistent
+ file naming, where some files are named in UTF-8 encoding while
+ others are not. A file:list_dir on such mixed file name systems
+ when the VM is in Unicode file name mode might return file names as
+ raw binaries as they cannot be interpreted as Unicode
+ file names. Raw file names can also be used to give UTF-8 encoded
+ file names even though the VM is not started in Unicode file name
+ translation mode.</p>
+
+ <p>Note that on Windows, <c>file:native_name_encoding()</c>
+ returns <c>utf8</c> per default, which is the format for raw
+ file names even on Windows, although the underlying OS specific
+ code works in a limited version of little endian UTF16. As far as
+ the Erlang programmer is concerned, Windows native Unicode format
+ is UTF-8...</p>
</description>
<section>
@@ -47,8 +102,14 @@ iodata() = iolist() | binary()
io_device()
as returned by file:open/2, a process handling IO protocols
-name() = string() | atom() | DeepList
+name() = string() | atom() | DeepList | RawFilename
DeepList = [char() | atom() | DeepList]
+ RawFilename = binary()
+ If VM is in unicode filename mode, string() and char() are allowed to be > 255.
+ RawFilename is a filename not subject to Unicode translation, meaning that it
+ can contain characters not conforming to the Unicode encoding expected from the
+ filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode
+ filename mode).
posix()
an atom which is named from the POSIX error codes used in
@@ -598,13 +659,24 @@ f.txt: {person, "kalle", 25}.
</desc>
</func>
<func>
+ <name>native_name_encoding() -> latin1 | utf8</name>
+ <fsummary>Return the VM's configured filename encoding.</fsummary>
+ <desc>
+ <p>This function returns the configured default file name encoding to use for raw file names. Generally an application supplying file names raw (as binaries), should obey the character encoding returned by this function.</p>
+ <p>By default, the VM uses ISO-latin-1 file name encoding on filesystems and/or OSes that use completely transparent file naming. This includes all Unix versions except MacOSX, where the vfs layer enforces UTF-8 file naming. By giving the experimental option <c>+fnu</c> when starting Erlang, UTF-8 translation of file names can be turned on even for those systems. If Unicode file name translation is in effect, the system behaves as usual as long as file names conform to the encoding, but will return file names that are not properly encoded in UTF-8 as raw file names (i.e. binaries).</p>
+ <p>On Windows, this function also returns <c>utf8</c> by default. The OS uses a pure Unicode naming scheme and file names are always possible to interpret as valid Unicode. The fact that the underlying Windows OS actually encodes file names using little endian UTF-16 can be ignored by the Erlang programmer. Windows and MacOSX are the only operating systems where the VM operates in Unicode file name mode by default.</p>
+ </desc>
+ </func>
+ <func>
<name>open(Filename, Modes) -> {ok, IoDevice} | {error, Reason}</name>
<fsummary>Open a file</fsummary>
<type>
<v>Filename = name()</v>
<v>Modes = [Mode]</v>
- <v>&nbsp;Mode = read | write | append | exclusive | raw | binary | {delayed_write, Size, Delay} | delayed_write | {read_ahead, Size} | read_ahead | compressed</v>
+ <v>&nbsp;Mode = read | write | append | exclusive | raw | binary | {delayed_write, Size, Delay} | delayed_write | {read_ahead, Size} | read_ahead | compressed | {encoding, Encoding}</v>
<v>&nbsp;&nbsp;Size = Delay = int()</v>
+ <v>&nbsp;&nbsp;Encoding = latin1 | unicode | utf8 | utf16 | {utf16, Endian} | utf32 | {utf32, Endian}</v>
+ <v>&nbsp;&nbsp;&nbsp;&nbsp;Endian = big | little</v>
<v>IoDevice = io_device()</v>
<v>Reason = ext_posix() | system_limit</v>
</type>
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 2ae230152c..f05a224f33 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -220,6 +220,69 @@ fe80::204:acff:fe17:bf38
<p>Returns the local hostname. Will never fail.</p>
</desc>
</func>
+
+ <func>
+ <name>getifaddrs() -> {ok,Iflist} | {error,posix}</name>
+ <fsummary>Return a list of interfaces and their addresses</fsummary>
+ <type>
+ <v>Iflist = {Ifname,[Ifopt]}</v>
+ <v>Ifname = string()</v>
+ <v>Ifopt = {flag,[Flag]} | {addr,Addr} | {netmask,Netmask}
+ | {broadaddr,Broadaddr} | {dstaddr,Dstaddr}
+ | {hwaddr,Hwaddr}</v>
+ <v>Flag = up | broadcast | loopback | pointtopoint
+ | running | multicast</v>
+ <v>Addr = Netmask = Broadadddr = Dstaddr = ip_address()</v>
+ <v>Hwaddr = [byte()]</v>
+ </type>
+ </func>
+ <desc>
+ <p>
+ Returns a list of 2-tuples containing interface names and the
+ interface's addresses. <c>Ifname</c> is a Unicode string.
+ <c>Hwaddr</c> is hardware dependent, e.g on Ethernet interfaces
+ it is the 6-byte Ethernet address (MAC address (EUI-48 address)).
+ </p>
+ <p>
+ The <c>{addr,Addr}</c>, <c>{netmask,_}</c> and <c>{broadaddr,_}</c>
+ tuples are repeated in the result list iff the interface has multiple
+ addresses. If you come across an interface that has
+ multiple <c>{flag,_}</c> or <c>{hwaddr,_}</c> tuples you have
+ a really strange interface or possibly a bug in this function.
+ The <c>{flag,_}</c> tuple is mandatory, all other optional.
+ </p>
+ <p>
+ Do not rely too much on the order of <c>Flag</c> atoms or
+ <c>Ifopt</c> tuples. There are some rules, though:
+ <list>
+ <item>
+ Immediately after <c>{addr,_}</c> follows <c>{netmask,_}</c>
+ </item>
+ <item>
+ Immediately thereafter follows <c>{broadaddr,_}</c> if
+ the <c>broadcast</c> flag is <em>not</em> set and the
+ <c>pointtopoint</c>flag <em>is</em> set.
+ </item>
+ <item>
+ Any <c>{netmask,_}</c>, <c>{broadaddr,_}</c> or
+ <c>{dstaddr,_}</c> tuples that follow an <c>{addr,_}</c>
+ tuple concerns that address.
+ </item>
+ </list>
+ </p>
+ <p>
+ The <c>{hwaddr,_}</c> tuple is not returned on Solaris since the
+ hardware address historically belongs to the link layer and only
+ the superuser can read such addresses.
+ </p>
+ <p>
+ On Windows, the data is fetched from quite different OS API
+ functions, so the <c>Netmask</c> and <c>Broadaddr</c>
+ values may be calculated, just as some <c>Flag</c> values.
+ You have been warned. Report flagrant bugs.
+ </p>
+ </desc>
+
<func>
<name>getopts(Socket, Options) -> {ok, OptionValues} | {error, posix()}</name>
<fsummary>Get one or more options for a socket</fsummary>
@@ -369,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 edd6ea52b0..065b24c53d 100644
--- a/lib/kernel/doc/src/notes.xml
+++ b/lib/kernel/doc/src/notes.xml
@@ -30,6 +30,104 @@
</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>
+ <list>
+ <item>
+ <p>
+ The Erlang VM now supports Unicode filenames. The feature
+ is turned on by default on systems where Unicode
+ filenames are mandatory (Windows and MacOSX), but can be
+ enabled on other systems with the '+fnu' emulator option.
+ Enabling the Unicode filename feature on systems where it
+ is not default is however considered experimental and not
+ to be used for production. Together with the Unicode file
+ name support, the concept of "raw filenames" is
+ introduced, which means filenames provided without
+ implicit unicode encoding translation. Raw filenames are
+ provided as binaries, not lists. For further information,
+ see stdlib users guide and the chapter about using
+ Unicode in Erlang. Also see the file module manual page.</p>
+ <p>
+ *** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>
+ Own Id: OTP-8887</p>
+ </item>
+ <item>
+ <p>
+ There is now a new function inet:getifaddrs/0 modeled
+ after C library function getifaddrs() on BSD and LInux
+ that reports existing interfaces and their addresses on
+ the host. This replaces the undocumented and unsupported
+ inet:getiflist/0 and inet:ifget/2.</p>
+ <p>
+ Own Id: OTP-8926</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Kernel 2.14.1.1</title>
<section><title>Fixed Bugs and Malfunctions</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 ec256d5806..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'.
@@ -213,19 +216,21 @@ unstick_mod(Mod) when is_atom(Mod) -> call({unstick_mod,Mod}).
-spec is_sticky(Module :: atom()) -> boolean().
is_sticky(Mod) when is_atom(Mod) -> call({is_sticky,Mod}).
--spec set_path(Directories :: [file:filename()]) -> 'true' | {'error', term()}.
+-spec set_path(Directories :: [file:filename()]) ->
+ 'true' | {'error', 'bad_directory' | 'bad_path'}.
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', term()}.
+-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', term()}.
+-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', term()}.
+-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'.
@@ -237,14 +242,13 @@ add_pathsz(Dirs) when is_list(Dirs) -> call({add_paths,last,Dirs}).
-spec add_pathsa(Directories :: [file:filename()]) -> 'ok'.
add_pathsa(Dirs) when is_list(Dirs) -> call({add_paths,first,Dirs}).
-%% XXX Contract's input argument differs from add_path/1 -- why?
-spec del_path(Name :: file:filename() | atom()) -> boolean() | {'error', 'bad_name'}.
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,19 +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),
- 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
@@ -295,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();
@@ -304,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.
@@ -328,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.
@@ -426,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)
@@ -483,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 17dd02acd4..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
@@ -17,6 +17,11 @@
%% %CopyrightEnd%
%%
-module(error_handler).
+%% FIXME: remove no_native directive after HiPE has been changed to make
+%% remote calls link to the target's Export* like BEAM does.
+%% For a detailed explanation see the commit titled
+%% "error_handler: add no_native compiler directive"
+-compile(no_native).
%% A simple error handler.
@@ -75,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 cffe4e3db5..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
@@ -75,25 +75,34 @@
-define(RAM_FILE, ram_file). % Module
%% data types
--type filename() :: string().
+-type filename() :: string() | binary().
-type file_info() :: #file_info{}.
-type fd() :: #file_descriptor{}.
-type io_device() :: pid() | fd().
-type location() :: integer() | {'bof', integer()} | {'cur', integer()}
| {'eof', integer()} | 'bof' | 'cur' | 'eof'.
--type mode() :: 'read' | 'write' | 'append' | 'raw' | 'binary' |
- {'delayed_write', non_neg_integer(), non_neg_integer()} |
- 'delayed_write' | {'read_ahead', pos_integer()} |
- 'read_ahead' | 'compressed' | 'exclusive'.
--type name() :: string() | atom() | [name()].
--type posix() :: atom().
+-type mode() :: 'read' | 'write' | 'append'
+ | 'exclusive' | 'raw' | 'binary'
+ | {'delayed_write', non_neg_integer(), non_neg_integer()}
+ | 'delayed_write' | {'read_ahead', pos_integer()}
+ | 'read_ahead' | 'compressed'
+ | {'encoding', unicode:encoding()}.
+-type name() :: string() | atom() | [name()] | binary().
+-type posix() :: 'eacces' | 'eagain' | 'ebadf' | 'ebusy' | 'edquot'
+ | 'eexist' | 'efault' | 'efbig' | 'eintr' | 'einval'
+ | 'eio' | 'eisdir' | 'eloop' | 'emfile' | 'emlink'
+ | 'enametoolong'
+ | 'enfile' | 'enodev' | 'enoent' | 'enomem' | 'enospc'
+ | 'enotblk' | 'enotdir' | 'enotsup' | 'enxio' | 'eperm'
+ | 'epipe' | 'erofs' | 'espipe' | 'esrch' | 'estale'
+ | 'exdev'.
-type bindings() :: any().
-type date() :: {pos_integer(), pos_integer(), pos_integer()}.
-type time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}.
-type date_time() :: {date(), time()}.
--type posix_file_advise() :: 'normal' | 'sequential' | 'random' | 'no_reuse' |
- 'will_need' | 'dont_need'.
+-type posix_file_advise() :: 'normal' | 'sequential' | 'random'
+ | 'no_reuse' | 'will_need' | 'dont_need'.
%%%-----------------------------------------------------------------
%%% General functions
@@ -174,7 +183,7 @@ make_dir(Name) ->
del_dir(Name) ->
check_and_call(del_dir, [file_name(Name)]).
--spec read_file_info(Name :: name()) -> {'ok', #file_info{}} | {'error', posix()}.
+-spec read_file_info(Name :: name()) -> {'ok', file_info()} | {'error', posix()}.
read_file_info(Name) ->
check_and_call(read_file_info, [file_name(Name)]).
@@ -184,7 +193,7 @@ read_file_info(Name) ->
altname(Name) ->
check_and_call(altname, [file_name(Name)]).
--spec read_link_info(Name :: name()) -> {'ok', #file_info{}} | {'error', posix()}.
+-spec read_link_info(Name :: name()) -> {'ok', file_info()} | {'error', posix()}.
read_link_info(Name) ->
check_and_call(read_link_info, [file_name(Name)]).
@@ -194,7 +203,7 @@ read_link_info(Name) ->
read_link(Name) ->
check_and_call(read_link, [file_name(Name)]).
--spec write_file_info(Name :: name(), Info :: #file_info{}) ->
+-spec write_file_info(Name :: name(), Info :: file_info()) ->
'ok' | {'error', posix()}.
write_file_info(Name, Info = #file_info{}) ->
@@ -205,7 +214,8 @@ write_file_info(Name, Info = #file_info{}) ->
list_dir(Name) ->
check_and_call(list_dir, [file_name(Name)]).
--spec read_file(Name :: name()) -> {'ok', binary()} | {'error', posix()}.
+-spec read_file(Name :: name()) ->
+ {'ok', binary()} | {'error', posix() | 'terminated' | 'system_limit'}.
read_file(Name) ->
check_and_call(read_file, [file_name(Name)]).
@@ -220,17 +230,17 @@ make_link(Old, New) ->
make_symlink(Old, New) ->
check_and_call(make_symlink, [file_name(Old), file_name(New)]).
--spec write_file(Name :: name(), Bin :: binary()) -> 'ok' | {'error', posix()}.
+-spec write_file(Name :: name(), Bin :: iodata()) ->
+ 'ok' | {'error', posix() | 'terminated' | 'system_limit'}.
write_file(Name, Bin) ->
check_and_call(write_file, [file_name(Name), make_binary(Bin)]).
%% This whole operation should be moved to the file_server and prim_file
%% when it is time to change file server protocol again.
-%% Meanwhile, it is implemented here, slihtly less efficient.
-%%
+%% 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) ->
@@ -286,7 +296,7 @@ raw_write_file_info(Name, #file_info{} = Info) ->
%% Contemporary mode specification - list of options
-spec open(Name :: name(), Modes :: [mode()]) ->
- {'ok', io_device()} | {'error', posix()}.
+ {'ok', io_device()} | {'error', posix() | 'system_limit'}.
open(Item, ModeList) when is_list(ModeList) ->
case lists:member(raw, ModeList) of
@@ -339,7 +349,7 @@ open(Item, Mode) ->
%%% The File argument must be either a Pid or a handle
%%% returned from ?PRIM_FILE:open.
--spec close(File :: io_device()) -> 'ok' | {'error', posix()}.
+-spec close(File :: io_device()) -> 'ok' | {'error', posix() | 'terminated'}.
close(File) when is_pid(File) ->
R = file_request(File, close),
@@ -358,7 +368,7 @@ close(_) ->
{error, badarg}.
-spec advise(File :: io_device(), Offset :: integer(),
- Length :: integer(), Advise :: posix_file_advise()) ->
+ Length :: integer(), Advise :: posix_file_advise()) ->
'ok' | {'error', posix()}.
advise(File, Offset, Length, Advise) when is_pid(File) ->
@@ -440,7 +450,7 @@ pread(_, _, _) ->
{error, badarg}.
-spec write(File :: io_device() | atom(), Byte :: iodata()) ->
- 'ok' | {'error', posix()}.
+ 'ok' | {'error', posix() | 'terminated'}.
write(File, Bytes) when (is_pid(File) orelse is_atom(File)) ->
case make_binary(Bytes) of
@@ -1024,22 +1034,26 @@ path_open_first([], _Name, _Mode, LastError) ->
%% Generates a flat file name from a deep list of atoms and
%% characters (integers).
+file_name(N) when is_binary(N) ->
+ N;
file_name(N) ->
try
- file_name_1(N)
+ file_name_1(N,file:native_name_encoding())
catch Reason ->
{error, Reason}
end.
-file_name_1([C|T]) when is_integer(C), C > 0, C =< 255 ->
- [C|file_name_1(T)];
-file_name_1([H|T]) ->
- file_name_1(H) ++ file_name_1(T);
-file_name_1([]) ->
+file_name_1([C|T],latin1) when is_integer(C), C < 256->
+ [C|file_name_1(T,latin1)];
+file_name_1([C|T],utf8) when is_integer(C) ->
+ [C|file_name_1(T,utf8)];
+file_name_1([H|T],E) ->
+ file_name_1(H,E) ++ file_name_1(T,E);
+file_name_1([],_) ->
[];
-file_name_1(N) when is_atom(N) ->
+file_name_1(N,_) when is_atom(N) ->
atom_to_list(N);
-file_name_1(_) ->
+file_name_1(_,_) ->
throw(badarg).
make_binary(Bin) when is_binary(Bin) ->
diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl
index 39dc32bb79..14da9c1a55 100644
--- a/lib/kernel/src/file_io_server.erl
+++ b/lib/kernel/src/file_io_server.erl
@@ -44,11 +44,11 @@ format_error(ErrorId) ->
erl_posix_msg:message(ErrorId).
start(Owner, FileName, ModeList)
- when is_pid(Owner), is_list(FileName), is_list(ModeList) ->
+ when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) ->
do_start(spawn, Owner, FileName, ModeList).
start_link(Owner, FileName, ModeList)
- when is_pid(Owner), is_list(FileName), is_list(ModeList) ->
+ when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) ->
do_start(spawn_link, Owner, FileName, 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/inet.erl b/lib/kernel/src/inet.erl
index 93d75321ba..327e0f93f1 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -25,6 +25,7 @@
%% socket
-export([peername/1, sockname/1, port/1, send/2,
setopts/2, getopts/2,
+ getifaddrs/0, getifaddrs/1,
getif/1, getif/0, getiflist/0, getiflist/1,
ifget/3, ifget/2, ifset/3, ifset/2,
getstat/1, getstat/2,
@@ -265,6 +266,17 @@ setopts(Socket, Opts) ->
getopts(Socket, Opts) ->
prim_inet:getopts(Socket, Opts).
+-spec getifaddrs(Socket :: socket()) ->
+ {'ok', [string()]} | {'error', posix()}.
+
+getifaddrs(Socket) ->
+ prim_inet:getifaddrs(Socket).
+
+-spec getifaddrs() -> {'ok', [string()]} | {'error', posix()}.
+
+getifaddrs() ->
+ withsocket(fun(S) -> prim_inet:getifaddrs(S) end).
+
-spec getiflist(Socket :: socket()) ->
{'ok', [string()]} | {'error', posix()}.
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/inet_int.hrl b/lib/kernel/src/inet_int.hrl
index cf357b7fba..6f1688c6a2 100644
--- a/lib/kernel/src/inet_int.hrl
+++ b/lib/kernel/src/inet_int.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-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
@@ -82,6 +82,7 @@
-define(INET_REQ_IFGET, 22).
-define(INET_REQ_IFSET, 23).
-define(INET_REQ_SUBSCRIBE, 24).
+-define(INET_REQ_GETIFADDRS, 25).
%% TCP requests
-define(TCP_REQ_ACCEPT, 40).
-define(TCP_REQ_LISTEN, 41).
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 5b8698fd1b..95517ffd6a 100644
--- a/lib/kernel/test/Makefile
+++ b/lib/kernel/test/Makefile
@@ -51,6 +51,7 @@ MODULES= \
error_logger_SUITE \
error_logger_warn_SUITE \
file_SUITE \
+ file_name_SUITE \
prim_file_SUITE \
ram_file_SUITE \
gen_tcp_api_SUITE \
@@ -141,7 +142,7 @@ 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 -R u+w $(RELSYSDIR)
@tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
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 c9437df258..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").
+-include_lib("test_server/include/test_server.hrl").
--export([all/1]).
+-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,
@@ -31,9 +31,10 @@
where_is_file_cached/1, where_is_file_no_cache/1,
purge_stacktrace/1, mult_lib_roots/1, bad_erl_libs/1,
code_archive/1, code_archive2/1, on_load/1,
+ 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]).
@@ -42,18 +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,
- 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
@@ -74,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),
@@ -584,13 +607,21 @@ clash(Config) when is_list(Config) ->
TmpEzFile = Priv++"foobar-0.tmp.ez",
?line {ok, _} = file:copy(DDir++"foobar-0.1.ez", TmpEzFile),
?line true = code:add_path(TmpEzFile++"/foobar-0.1/ebin"),
- ?line ok = file:delete(TmpEzFile),
+ case os:type() of
+ {win32,_} ->
+ %% The file wont be deleted on windows until it's closed, why we
+ %% need to rename instead.
+ ?line ok = file:rename(TmpEzFile,TmpEzFile++".moved");
+ _ ->
+ ?line ok = file:delete(TmpEzFile)
+ end,
test_server:capture_start(),
?line ok = code:clash(),
test_server:capture_stop(),
?line [BadPathMsg|_] = test_server:capture_get(),
?line true = lists:prefix("** Bad path can't read", BadPathMsg),
?line true = code:set_path(P),
+ file:delete(TmpEzFile++".moved"), %% Only effect on windows
ok.
ext_mod_dep(suite) ->
@@ -635,7 +666,7 @@ analyse([], [This={M,F,A}|Path], Visited, ErrCnt0) ->
%% These modules should be loaded by code.erl before
%% the code_server is started.
OK = [erlang, os, prim_file, erl_prim_loader, init, ets,
- code_server, lists, lists_sort, filename, packages,
+ code_server, lists, lists_sort, unicode, binary, filename, packages,
gb_sets, gb_trees, hipe_unified_loader, hipe_bifs,
prim_zip, zlib],
ErrCnt1 =
@@ -664,6 +695,22 @@ analyse2(MFA={_,_,_}, Path, Visited0) ->
%%%% We need to check these manually...
% fun's are ok as long as they are defined locally.
check_funs({'$M_EXPR','$F_EXPR',_},
+ [{unicode,characters_to_binary_int,3},
+ {unicode,characters_to_binary,3},
+ {filename,filename_string_to_binary,1}|_]) -> 0;
+check_funs({'$M_EXPR','$F_EXPR',_},
+ [{unicode,ml_map,3},
+ {unicode,characters_to_binary_int,3},
+ {unicode,characters_to_binary,3},
+ {filename,filename_string_to_binary,1}|_]) -> 0;
+check_funs({'$M_EXPR','$F_EXPR',_},
+ [{unicode,do_o_binary2,2},
+ {unicode,do_o_binary,2},
+ {unicode,o_trans,1},
+ {unicode,characters_to_binary_int,3},
+ {unicode,characters_to_binary,3},
+ {filename,filename_string_to_binary,1}|_]) -> 0;
+check_funs({'$M_EXPR','$F_EXPR',_},
[{code_server,load_native_code,4},
{code_server,load_native_code_1,2},
{code_server,load_native_code,2},
@@ -880,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) ->
@@ -981,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"),
@@ -1002,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) ->
@@ -1145,6 +1193,22 @@ compile_files([File | Files], SrcDir, OutDir) ->
compile_files([], _, _) ->
ok.
+big_boot_embedded(suite) ->
+ [];
+big_boot_embedded(doc) ->
+ ["Test that a boot file with (almost) all of OTP can be used to start an"
+ " embeddedd system."];
+big_boot_embedded(Config) when is_list(Config) ->
+ ?line {BootArg,AppsInBoot} = create_big_boot(Config),
+ ?line {ok, Node} =
+ ?t:start_node(big_boot_embedded, slave,
+ [{args,"-boot "++BootArg++" -mode embedded"}]),
+ ?line RemoteNodeApps =
+ [ {X,Y} || {X,_,Y} <-
+ rpc:call(Node,application,loaded_applications,[]) ],
+ ?line true = lists:sort(AppsInBoot) =:= lists:sort(RemoteNodeApps),
+ ok.
+
on_load(Config) when is_list(Config) ->
Master = on_load_test_case_process,
@@ -1226,7 +1290,8 @@ on_load_embedded_1(Config) ->
?line LibRoot = code:lib_dir(),
?line LinkName = filename:join(LibRoot, "on_load_app-1.0"),
?line OnLoadApp = filename:join(DataDir, "on_load_app-1.0"),
- ?line file:delete(LinkName),
+ ?line del_link(LinkName),
+ io:format("LinkName :~p, OnLoadApp: ~p~n",[LinkName,OnLoadApp]),
case file:make_symlink(OnLoadApp, LinkName) of
{error,enotsup} ->
throw({skip,"Support for symlinks required"});
@@ -1255,7 +1320,15 @@ on_load_embedded_1(Config) ->
%% Clean up.
?line stop_node(Node),
- ?line ok = file:delete(LinkName).
+ ?line ok = del_link(LinkName).
+
+del_link(LinkName) ->
+ case file:delete(LinkName) of
+ {error,eperm} ->
+ file:del_dir(LinkName);
+ Other ->
+ Other
+ end.
create_boot(Config, Options) ->
?line {ok, OldDir} = file:get_cwd(),
@@ -1281,6 +1354,73 @@ create_script(Config) ->
?line file:close(Fd),
{filename:dirname(Name),filename:basename(Name)}.
+create_big_boot(Config) ->
+ ?line {ok, OldDir} = file:get_cwd(),
+ ?line {Options,Local} = case is_source_dir() of
+ true -> {[no_module_tests,local],true};
+ _ -> {[no_module_tests],false}
+ end,
+ ?line {LatestDir,LatestName,Apps} = create_big_script(Config,Local),
+ ?line ok = file:set_cwd(LatestDir),
+ ?line ok = systools:make_script(LatestName, Options),
+ ?line ok = file:set_cwd(OldDir),
+ {filename:join(LatestDir, LatestName),Apps}.
+
+% The following apps cannot be loaded
+% hipe .app references (or can reference) files that have no
+% corresponding beam file (if hipe is not enabled)
+filter_app("hipe",_) ->
+ false;
+% Dialyzer and typer depends on hipe
+filter_app("dialyzer",_) ->
+ false;
+filter_app("typer",_) ->
+ false;
+% Orber requires explicit configuration
+filter_app("orber",_) ->
+ false;
+% cos* depends on orber
+filter_app("cos"++_,_) ->
+ false;
+% ic has a mod instruction in the app file but no corresponding start function
+filter_app("ic",_) ->
+ false;
+% Netconf has some dependency that I really do not understand (maybe like orber)
+filter_app("netconf",_) ->
+ false;
+% Safe has the same kind of error in the .app file as ic
+filter_app("safe",_) ->
+ false;
+% OS_mon does not find it's port program when running cerl
+filter_app("os_mon",true) ->
+ false;
+% Other apps should be OK.
+filter_app(_,_) ->
+ true.
+create_big_script(Config,Local) ->
+ ?line PrivDir = ?config(priv_dir, Config),
+ ?line Name = filename:join(PrivDir,"full_script_test"),
+ ?line InitialApplications=application:loaded_applications(),
+ %% Applications left loaded by the application suite, unload them!
+ ?line UnloadFix=[app0,app1,app2,group_leader,app_start_error],
+ ?line [application:unload(Leftover) ||
+ Leftover <- UnloadFix,
+ lists:keymember(Leftover,1,InitialApplications) ],
+ %% Now we should have only "real" applications...
+ ?line [application:load(list_to_atom(Y)) || {match,[Y]} <- [ re:run(X,code:lib_dir()++"/"++"([^/-]*).*/ebin",[{capture,[1],list}]) || X <- code:get_path()],filter_app(Y,Local)],
+ ?line Apps = [ {N,V} || {N,_,V} <- application:loaded_applications()],
+ ?line {ok,Fd} = file:open(Name ++ ".rel", write),
+ ?line io:format(Fd,
+ "{release, {\"Test release 3\", \"P2A\"}, \n"
+ " {erts, \"9.42\"}, \n"
+ " ~p}.\n",
+ [Apps]),
+ ?line file:close(Fd),
+ ?line NewlyLoaded =
+ application:loaded_applications() -- InitialApplications,
+ ?line [ application:unload(N) || {N,_,_} <- NewlyLoaded],
+ {filename:dirname(Name),filename:basename(Name),Apps}.
+
is_source_dir() ->
filename:basename(code:lib_dir(kernel)) =:= "kernel" andalso
filename:basename(code:lib_dir(stdlib)) =:= "stdlib".
diff --git a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl
index b7fdd4d9ae..646921026d 100644
--- a/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl
+++ b/lib/kernel/test/code_SUITE_data/on_load_app-1.0/src/on_load_embedded.erl
@@ -8,7 +8,7 @@ run_me() ->
LibDir = code:lib_dir(on_load_app),
PrivDir = code:priv_dir(on_load_app),
LibDir = filename:dirname(PrivDir),
- ModPath = code:which(?MODULE),
+ ModPath = filename:join(filename:split(code:which(?MODULE))),
LibDir = filename:dirname(filename:dirname(ModPath)),
%% Start a process to remember that the on_load was called.
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 21a96f804a..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:
@@ -845,13 +857,16 @@ monitor_nodes_otp_6481_test(Config, TestType) when is_list(Config) ->
?line {ok, Node} = start_node(Name, "", this),
?line receive {nodeup, Node} -> ok end,
- ?line spawn(Node,
+ ?line RemotePid = spawn(Node,
fun () ->
- receive after 1000 -> ok end,
- lists:foreach(fun (No) ->
- Me ! {NodeMsg, No}
- end,
- Seq),
+ receive after 1500 -> ok end,
+ % infinit loop of msgs
+ % we want an endless stream of messages and the kill
+ % the node mercilessly.
+ % We then want to ensure that the nodedown message arrives
+ % last ... without garbage after it.
+ _ = spawn(fun() -> node_loop_send(Me, NodeMsg, 1) end),
+ receive {Me, kill_it} -> ok end,
halt()
end),
@@ -860,9 +875,11 @@ monitor_nodes_otp_6481_test(Config, TestType) when is_list(Config) ->
%% Verify that '{nodeup, Node}' comes before '{NodeMsg, 1}' (the message
%% bringing up the connection).
- %%?line no_msgs(500), % Why wait? It fails test sometimes /sverker
+ ?line no_msgs(500),
?line {nodeup, Node} = receive Msg1 -> Msg1 end,
- ?line {NodeMsg, 1} = receive Msg2 -> Msg2 end,
+ ?line {NodeMsg, 1} = receive Msg2 -> Msg2 end,
+ % msg stream has begun, kill the node
+ ?line RemotePid ! {self(), kill_it},
%% Verify that '{nodedown, Node}' comes after the last '{NodeMsg, N}'
%% message.
@@ -883,6 +900,10 @@ flush_node_msgs(NodeMsg, No) ->
OtherMsg -> OtherMsg
end.
+node_loop_send(Pid, Msg, No) ->
+ Pid ! {Msg, No},
+ node_loop_send(Pid, Msg, No + 1).
+
monitor_nodes_errors(doc) ->
[];
monitor_nodes_errors(suite) ->
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 17c47f871d..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) -> [];
@@ -3268,7 +3280,7 @@ large_file(Config) when is_list(Config) ->
{{unix,sunos},{A,B,C}}
when A == 5, B == 5, C >= 1; A == 5, B >= 6; A >= 6 ->
do_large_file(Config);
- {{unix,Unix},_} when Unix =:= linux; Unix =:= darwin ->
+ {{unix,Unix},_} when Unix =/= sunos ->
N = unix_free(Config),
io:format("Free: ~w KByte~n", [N]),
if N < 5 * (1 bsl 20) ->
@@ -3278,7 +3290,7 @@ large_file(Config) when is_list(Config) ->
do_large_file(Config)
end;
_ ->
- {skipped,"Only supported on Win32, Linux, or SunOS >= 5.5.1"}
+ {skipped,"Only supported on Win32, Unix or SunOS >= 5.5.1"}
end.
unix_free(Config) ->
@@ -3290,7 +3302,7 @@ unix_free(Config) ->
N.
do_large_file(Config) ->
- ?line Watchdog = ?t:timetrap(?t:minutes(4)),
+ ?line Watchdog = ?t:timetrap(?t:minutes(5)),
%%
?line Name = filename:join(?config(priv_dir, Config),
?MODULE_STRING ++ "_large_file"),
@@ -3329,6 +3341,17 @@ do_large_file(Config) ->
?line {ok,P} = ?FILE_MODULE:position(F, {eof,-L}),
?line {ok,Rs} = ?FILE_MODULE:read(F, L+1),
?line ok = ?FILE_MODULE:close(F),
+ %% Reopen the file with 'append'; used to fail on Windows causing
+ %% writes to go to the beginning of the file for files > 4GB.
+ ?line PL = P + L,
+ ?line PLL = PL + L,
+ ?line {ok,F1} = ?FILE_MODULE:open(Name, [raw,read,write,append]),
+ ?line ok = ?FILE_MODULE:write(F1, R),
+ ?line {ok,PLL} = ?FILE_MODULE:position(F1, {cur,0}),
+ ?line {ok,Rs} = ?FILE_MODULE:pread(F1, P, L),
+ ?line {ok,PL} = ?FILE_MODULE:position(F1, {eof,-L}),
+ ?line {ok,R} = ?FILE_MODULE:read(F1, L+1),
+ ?line ok = ?FILE_MODULE:close(F1),
%%
?line Mref = erlang:monitor(process, Deleter),
?line Deleter ! {Tester,done},
diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl
new file mode 100644
index 0000000000..53bcb1162d
--- /dev/null
+++ b/lib/kernel/test/file_name_SUITE.erl
@@ -0,0 +1,1756 @@
+-module(file_name_SUITE).
+%%
+%% %CopyrightBegin%
+%%
+%% 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
+%% 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%
+%%
+
+-include_lib("test_server/include/test_server.hrl").
+-include_lib("kernel/include/file.hrl").
+
+%%
+%% File operations that take filenames as parameters (* not prim_file operation) (** a drive):
+%% altname
+%% copy (*)
+%% del_dir
+%% delete
+%% get_cwd (**)
+%% list_dir
+%% make_dir
+%% make_link
+%% make_symlink
+%% open
+%% read_file
+%% read_file_info
+%% read_link
+%% read_link_info
+%% rename
+%% set_cwd
+%% write_file
+%% write_file_info
+%%
+%% File operations that opens/uses separate driver port (not connected to file)
+%% altname
+%% del_dir
+%% delete
+%% get_cwd
+%% list_dir
+%% make_dir
+%% make_link
+%% make_symlink
+%% read_file_info
+%% read_link
+%% read_link_info
+%% rename
+%% set_cwd
+%% write_file_info
+%%
+%% Operations that use ?FD_DRV in prim_file
+%% open
+%% read_file
+%% write_file
+%%
+%%
+%% Operations that return a filename/path
+%% altname
+%% get_cwd
+%% list_dir
+%% read_link
+
+-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]).
+
+
+init_per_testcase(_Func, Config) ->
+ Dog = test_server:timetrap(test_server:seconds(60)),
+ [{watchdog,Dog}|Config].
+
+end_per_testcase(_Func, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog).
+
+suite() -> [{ct_hooks,[ts_install_cth]}].
+
+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) ->
+ [];
+normalize(doc) ->
+ ["Check that filename normalization works"];
+normalize(Config) when is_list(Config) ->
+ random:seed({1290,431421,830412}),
+ try
+ ?line UniMode = file:native_name_encoding() =/= latin1,
+ if
+ not UniMode ->
+ throw(need_unicode_mode);
+ true ->
+ ok
+ end,
+ ?line Pairs = [rand_comp_decomp(200) || _ <- lists:seq(1,1000)],
+ case os:type() of
+ {unix,darwin} ->
+ ?line [ true = (A =:= prim_file:internal_native2name(B)) ||
+ {A,B} <- Pairs ];
+ _ ->
+ ok
+ end,
+ ?line [ true = (A =:= prim_file:internal_normalize_utf8(B)) ||
+ {A,B} <- Pairs ]
+
+ catch
+ throw:need_unicode_mode ->
+ io:format("Sorry, can only run in unicode mode.~n"),
+ {skipped,"VM needs to be started in Unicode filename mode"}
+ end.
+
+normal(suite) ->
+ [];
+normal(doc) ->
+ "Check file operations on normal file names regardless of unicode mode";
+normal(Config) when is_list(Config) ->
+ {ok,Dir} = file:get_cwd(),
+ try
+ Priv = ?config(priv_dir, Config),
+ file:set_cwd(Priv),
+ put(file_module,prim_file),
+ ok = check_normal(prim_file),
+ put(file_module,file),
+ ok = check_normal(file)
+ after
+ file:set_cwd(Dir)
+ end.
+
+
+icky(suite) ->
+ [];
+icky(doc) ->
+ "Check file operations on normal file names regardless of unicode mode";
+icky(Config) when is_list(Config) ->
+ case hopeless_darwin() of
+ true ->
+ {skipped,"This version of darwin does not support icky names at all."};
+ false ->
+ {ok,Dir} = file:get_cwd(),
+ try
+ Priv = ?config(priv_dir, Config),
+ file:set_cwd(Priv),
+ put(file_module,prim_file),
+ ok = check_icky(prim_file),
+ put(file_module,file),
+ ok = check_icky(file)
+ after
+ file:set_cwd(Dir)
+ end
+ end.
+very_icky(suite) ->
+ [];
+very_icky(doc) ->
+ "Check file operations on normal file names regardless of unicode mode";
+very_icky(Config) when is_list(Config) ->
+ case hopeless_darwin() of
+ true ->
+ {skipped,"This version of darwin does not support icky names at all."};
+ false ->
+ {ok,Dir} = file:get_cwd(),
+ try
+ Priv = ?config(priv_dir, Config),
+ file:set_cwd(Priv),
+ put(file_module,prim_file),
+ case check_very_icky(prim_file) of
+ need_unicode_mode ->
+ {skipped,"VM needs to be started in Unicode filename mode"};
+ ok ->
+ put(file_module,file),
+ ok = check_very_icky(file)
+ end
+ after
+ file:set_cwd(Dir)
+ end
+ end.
+
+
+check_normal(Mod) ->
+ {ok,Dir} = Mod:get_cwd(),
+ try
+ ?line make_normal_dir(Mod),
+ ?line {ok, L0} = Mod:list_dir("."),
+ ?line L1 = lists:sort(L0),
+ %erlang:display(L1),
+ ?line L1 = lists:sort(list(normal_dir())),
+ ?line {ok,D2} = Mod:get_cwd(),
+ ?line true = is_list(D2),
+ ?line case Mod:altname("fil1") of
+ {error,enotsup} ->
+ ok;
+ {ok,LLL} when is_list(LLL) ->
+ ok
+ end,
+ ?line [ true = is_list(El) || El <- L1],
+ ?line Syms = [ {S,Targ,list_to_binary(get_data(Targ,normal_dir()))}
+ || {T,S,Targ} <- normal_dir(), T =:= symlink ],
+ ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ],
+ ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ],
+ ?line chk_cre_dir(Mod,[{directory,"temp_dir",normal_dir()}]),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line true = is_list(BeginAt),
+ ?line {error,enoent} = Mod:set_cwd("tmp_dir"),
+ ?line ok = Mod:set_cwd("temp_dir"),
+ ?line {ok, NowAt} = Mod:get_cwd(),
+ ?line true = BeginAt =/= NowAt,
+ ?line ok = Mod:set_cwd(".."),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line rm_r(Mod,"temp_dir"),
+ ?line true = is_list(Dir),
+ ?line [ true = is_list(FN) || FN <- L0 ],
+ case has_links() of
+ true ->
+ ?line ok = Mod:make_link("fil1","nisse"),
+ ?line {ok, <<"fil1">>} = Mod:read_file("nisse"),
+ ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisse"),
+ ?line ok = Mod:delete("nisse"),
+ ?line {ok, <<"fil1">>} = Mod:read_file("fil1"),
+ ?line {error,enoent} = Mod:read_file("nisse"),
+ ?line {error,enoent} = Mod:read_link_info("nisse");
+ false ->
+ ok
+ end,
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read]),
+ ?line {ok, Content} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- normal_dir() ],
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read,binary]),
+ ?line BC = list_to_binary(Content),
+ ?line {ok, BC} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- normal_dir() ],
+ ?line Mod:rename("fil1","tmp_fil1"),
+ ?line {ok, <<"fil1">>} = Mod:read_file("tmp_fil1"),
+ ?line {error,enoent} = Mod:read_file("fil1"),
+ ?line Mod:rename("tmp_fil1","fil1"),
+ ?line {ok, <<"fil1">>} = Mod:read_file("fil1"),
+ ?line {error,enoent} = Mod:read_file("tmp_fil1"),
+ ?line {ok,FI} = Mod:read_file_info("fil1"),
+ ?line NewMode = FI#file_info.mode band (bnot 8#333),
+ ?line NewMode2 = NewMode bor 8#222,
+ ?line true = NewMode2 =/= NewMode,
+ ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode}),
+ ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("fil1"),
+ ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode2}),
+ ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("fil1"),
+ ok
+ after
+ case Mod:read_file_info("fil1") of
+ {ok,FII} ->
+ NewModeI = FII#file_info.mode bor 8#777,
+ Mod:write_file_info("fil1",FII#file_info{mode = NewModeI});
+ _ ->
+ ok
+ end,
+ Mod:set_cwd(Dir),
+ io:format("Wd now: ~s~n",[Dir])
+ end.
+
+check_icky(Mod) ->
+ {ok,Dir} = Mod:get_cwd(),
+ try
+ ?line true=(length("���") =:= 3),
+ ?line UniMode = file:native_name_encoding() =/= latin1,
+ ?line make_icky_dir(Mod),
+ ?line {ok, L0} = Mod:list_dir("."),
+ ?line L1 = lists:sort(L0),
+ io:format("~p ~p~n",[L1,list(icky_dir())]),
+ ?line L1 = lists:sort(convlist(list(icky_dir()))),
+ ?line {ok,D2} = Mod:get_cwd(),
+ ?line true = is_list(D2),
+%% Altname only on windows, and there are no non native filenames there
+%% ?line case Mod:altname("fil1") of
+%% {error,enotsup} ->
+%% ok;
+%% {ok,LLL} when is_list(LLL) ->
+%% ok
+%% end,
+ ?line [ true = ((is_list(El) or (UniMode and is_binary(El)))) || El <- L1],
+ ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,icky_dir()))}
+ || {T,S,Targ} <- icky_dir(), T =:= symlink ],
+ ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ],
+ ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ],
+ ?line chk_cre_dir(Mod,[{directory,"���_dir",icky_dir()}]),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line true = is_list(BeginAt),
+ ?line {error,enoent} = Mod:set_cwd("��_dir"),
+ ?line ok = Mod:set_cwd("���_dir"),
+ ?line {ok, NowAt} = Mod:get_cwd(),
+ ?line true = is_list(NowAt),
+ ?line true = BeginAt =/= NowAt,
+ ?line ok = Mod:set_cwd(".."),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line rm_r2(Mod,"���_dir"),
+ {OS,TYPE} = os:type(),
+ % Check that treat_icky really converts to the same as the OS
+ case UniMode of
+ true ->
+ ?line chk_cre_dir(Mod,[{directory,"���_dir",[]}]),
+ ?line ok = Mod:set_cwd("���_dir"),
+ ?line ok = Mod:write_file(<<"���">>,<<"hello">>),
+ ?line Treated = treat_icky(<<"���">>),
+ ?line {ok,[Treated]} = Mod:list_dir("."),
+ ?line ok = Mod:delete(<<"���">>),
+ ?line {ok,[]} = Mod:list_dir("."),
+ ?line ok = Mod:set_cwd(".."),
+ ?line rm_r2(Mod,"���_dir");
+ false ->
+ ok
+ end,
+
+ ?line chk_cre_dir(Mod,[{directory,treat_icky(<<"���_dir">>),icky_dir()}]),
+ if
+ UniMode and (OS =/= win32) ->
+ ?line {error,enoent} = Mod:set_cwd("���_dir");
+ true ->
+ ok
+ end,
+ ?line ok = Mod:set_cwd(treat_icky(<<"���_dir">>)),
+ ?line {ok, NowAt2} = Mod:get_cwd(),
+ io:format("~p~n",[NowAt2]),
+ % Cannot create raw unicode-breaking filenames on windows or macos
+ ?line true = ((((not UniMode) or (OS =:= win32) or (TYPE=:=darwin)) and is_list(NowAt2)) orelse ((UniMode) and is_binary(NowAt2))),
+ ?line true = BeginAt =/= NowAt2,
+ ?line ok = Mod:set_cwd(".."),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line rm_r2(Mod,conv(treat_icky(<<"���_dir">>))),
+ case has_links() of
+ true ->
+ ?line ok = Mod:make_link("fil1","nisse�"),
+ ?line {ok, <<"fil1">>} = Mod:read_file("nisse�"),
+ ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisse�"),
+ ?line ok = Mod:delete("nisse�"),
+ ?line ok = Mod:make_link("fil1",treat_icky(<<"nisse�">>)),
+ ?line {ok, <<"fil1">>} = Mod:read_file(treat_icky(<<"nisse�">>)),
+ ?line {ok, #file_info{type = regular}} = Mod:read_link_info(treat_icky(<<"nisse�">>)),
+ ?line ok = Mod:delete(treat_icky(<<"nisse�">>)),
+ ?line {ok, <<"fil1">>} = Mod:read_file("fil1"),
+ ?line {error,enoent} = Mod:read_file("nisse�"),
+ ?line {error,enoent} = Mod:read_link_info("nisse�"),
+ ?line {error,enoent} = Mod:read_file(treat_icky(<<"nisse�">>)),
+ ?line {error,enoent} = Mod:read_link_info(treat_icky(<<"nisse�">>));
+ false ->
+ ok
+ end,
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read]),
+ ?line {ok, Content} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- icky_dir() ],
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read,binary]),
+ ?line BC = list_to_binary([Content]),
+ ?line {ok, BC} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- icky_dir() ],
+ ?line Mod:rename("���2","���_fil1"),
+ ?line {ok, <<"���2">>} = Mod:read_file("���_fil1"),
+ ?line {error,enoent} = Mod:read_file("���2"),
+ ?line Mod:rename("���_fil1","���2"),
+ ?line {ok, <<"���2">>} = Mod:read_file("���2"),
+ ?line {error,enoent} = Mod:read_file("���_fil1"),
+
+ ?line Mod:rename("���2",treat_icky(<<"���_fil1">>)),
+ ?line {ok, <<"���2">>} = Mod:read_file(treat_icky(<<"���_fil1">>)),
+ if
+ UniMode and (OS =/= win32) ->
+ {error,enoent} = Mod:read_file("���_fil1");
+ true ->
+ ok
+ end,
+ ?line {error,enoent} = Mod:read_file("���2"),
+ ?line Mod:rename(treat_icky(<<"���_fil1">>),"���2"),
+ ?line {ok, <<"���2">>} = Mod:read_file("���2"),
+ ?line {error,enoent} = Mod:read_file("���_fil1"),
+ ?line {error,enoent} = Mod:read_file(treat_icky(<<"���_fil1">>)),
+
+ ?line {ok,FI} = Mod:read_file_info("���2"),
+ ?line NewMode = FI#file_info.mode band (bnot 8#333),
+ ?line NewMode2 = NewMode bor 8#222,
+ ?line true = NewMode2 =/= NewMode,
+ ?line ok = Mod:write_file_info("���2",FI#file_info{mode = NewMode}),
+ ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("���2"),
+ ?line ok = Mod:write_file_info("���2",FI#file_info{mode = NewMode2}),
+ ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("���2"),
+
+ ?line {ok,FII} = Mod:read_file_info(treat_icky(<<"���5">>)),
+ ?line true = NewMode2 =/= NewMode,
+ ?line ok = Mod:write_file_info(treat_icky(<<"���5">>),FII#file_info{mode = NewMode}),
+ ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info(treat_icky(<<"���5">>)),
+ ?line ok = Mod:write_file_info(<<"���5">>,FII#file_info{mode = NewMode2}),
+ ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info(treat_icky(<<"���5">>)),
+ ok
+ after
+ Mod:set_cwd(Dir),
+ io:format("Wd now: ~s~n",[Dir])
+ end.
+
+check_very_icky(Mod) ->
+ {ok,Dir} = Mod:get_cwd(),
+ try
+ ?line true=(length("���") =:= 3),
+ ?line UniMode = file:native_name_encoding() =/= latin1,
+ if
+ not UniMode ->
+ throw(need_unicode_mode);
+ true ->
+ ok
+ end,
+ ?line make_very_icky_dir(Mod),
+ ?line {ok, L0} = Mod:list_dir("."),
+ ?line L1 = lists:sort(L0),
+ ?line L1 = lists:sort(convlist(list(very_icky_dir()))),
+ ?line {ok,D2} = Mod:get_cwd(),
+ ?line true = is_list(D2),
+ ?line [ true = ((is_list(El) or is_binary(El))) || El <- L1],
+ ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,very_icky_dir()))}
+ || {T,S,Targ} <- very_icky_dir(), T =:= symlink ],
+ ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ],
+ ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ],
+ ?line chk_cre_dir(Mod,[{directory,[1088,1079,1091]++"_dir",very_icky_dir()}]),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line true = is_list(BeginAt),
+ ?line {error,enoent} = Mod:set_cwd("��_dir"),
+ ?line ok = Mod:set_cwd([1088,1079,1091]++"_dir"),
+ ?line {ok, NowAt} = Mod:get_cwd(),
+ ?line true = is_list(NowAt),
+ ?line true = BeginAt =/= NowAt,
+ ?line ok = Mod:set_cwd(".."),
+ ?line {ok,BeginAt} = Mod:get_cwd(),
+ ?line rm_r2(Mod,[1088,1079,1091]++"_dir"),
+
+ case has_links() of
+ true ->
+ ?line ok = Mod:make_link("fil1","nisse"++[1088,1079,1091]),
+ ?line {ok, <<"fil1">>} =
+ Mod:read_file("nisse"++[1088,1079,1091]),
+ ?line {ok, #file_info{type = regular}} =
+ Mod:read_link_info("nisse"++[1088,1079,1091]),
+ ?line ok = Mod:delete("nisse"++[1088,1079,1091]),
+ ?line ok = Mod:make_link("fil1",<<"nisse�">>),
+ ?line {ok, <<"fil1">>} = Mod:read_file(<<"nisse�">>),
+ ?line {ok, #file_info{type = regular}} =
+ Mod:read_link_info(<<"nisse�">>),
+ ?line ok = Mod:delete(<<"nisse�">>),
+ ?line {ok, <<"fil1">>} = Mod:read_file("fil1"),
+ ?line {error,enoent} = Mod:read_file("nisse"++[1088,1079,1091]),
+ ?line {error,enoent} = Mod:read_link_info("nisse"++[1088,1079,1091]),
+ ?line {error,enoent} = Mod:read_file(<<"nisse�">>),
+ ?line {error,enoent} = Mod:read_link_info(<<"nisse�">>);
+ false ->
+ ok
+ end,
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read]),
+ ?line {ok, Content} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- very_icky_dir() ],
+ ?line [ begin
+ ?line {ok, FD} = Mod:open(Name,[read,binary]),
+ ?line BC = list_to_binary([Content]),
+ ?line {ok, BC} = Mod:read(FD,1024),
+ ?line ok = file:close(FD)
+ end || {regular,Name,Content} <- very_icky_dir() ],
+ ?line Mod:rename([956,965,963,954,959,49],
+ [956,965,963,954,959]++"_fil1"),
+ ?line {ok, <<"���2">>} = Mod:read_file([956,965,963,954,959]++"_fil1"),
+ ?line {error,enoent} = Mod:read_file([956,965,963,954,959,49]),
+ ?line Mod:rename([956,965,963,954,959]++"_fil1",[956,965,963,954,959,49]),
+ ?line {ok, <<"���2">>} = Mod:read_file([956,965,963,954,959,49]),
+ ?line {error,enoent} = Mod:read_file([956,965,963,954,959]++"_fil1"),
+
+ ?line {ok,FI} = Mod:read_file_info([956,965,963,954,959,49]),
+ ?line NewMode = FI#file_info.mode band (bnot 8#333),
+ ?line NewMode2 = NewMode bor 8#222,
+ ?line true = NewMode2 =/= NewMode,
+ ?line ok = Mod:write_file_info([956,965,963,954,959,49],
+ FI#file_info{mode = NewMode}),
+ ?line {ok,#file_info{mode = NewMode}} =
+ Mod:read_file_info([956,965,963,954,959,49]),
+ ?line ok = Mod:write_file_info([956,965,963,954,959,49],
+ FI#file_info{mode = NewMode2}),
+ ?line {ok,#file_info{mode = NewMode2}} =
+ Mod:read_file_info([956,965,963,954,959,49]),
+ ?line NumOK0 = case has_links() of
+ true -> 5;
+ false -> 3
+ end,
+ ?line NumNOK0 = case has_links() of
+ true -> 4;
+ false -> 3
+ end,
+ ?line {NumOK,NumNOK} = case is_binary(treat_icky(<<"foo">>)) of
+ false ->
+ {NumOK0+NumNOK0,0};
+ true ->
+ {NumOK0,NumNOK0}
+ end,
+ ?line {NumOK,NumNOK} = filelib:fold_files(".",".*",true,fun(_F,{N,M}) when is_list(_F) -> io:format("~ts~n",[_F]),{N+1,M}; (_F,{N,M}) -> io:format("~p~n",[_F]),{N,M+1} end,{0,0}),
+ ?line ok = filelib:fold_files(".",[1076,1089,1072,124,46,42],true,fun(_F,_) -> ok end,false),
+ ?line SF3 = unicode:characters_to_binary("���subfil3",
+ file:native_name_encoding()),
+ ?line SF2 = case treat_icky(<<"���subfil2">>) of
+ LF2 when is_list(LF2) ->
+ unicode:characters_to_binary(LF2,
+ file:native_name_encoding());
+ BF2 ->
+ BF2
+ end,
+ ?line Sorted = lists:sort([SF3,SF2]),
+ ?line Sorted = lists:sort(filelib:wildcard("*",<<"���subdir2">>)),
+ ok
+ catch
+ throw:need_unicode_mode ->
+ io:format("Sorry, can only run in unicode mode.~n"),
+ need_unicode_mode
+ after
+ Mod:set_cwd(Dir),
+ io:format("Wd now: ~s~n",[Dir])
+ end.
+
+%%
+%% Utilities
+%%
+
+
+rm_rf(Mod,Dir) ->
+ case Mod:read_link_info(Dir) of
+ {ok, #file_info{type = directory}} ->
+ {ok, Content} = Mod:list_dir(Dir),
+ [ rm_rf(Mod,filename:join(Dir,C)) || C <- Content ],
+ Mod:del_dir(Dir),
+ ok;
+ {ok, #file_info{}} ->
+ Mod:delete(Dir);
+ _ ->
+ ok
+ end.
+
+rm_r(Mod,Dir) ->
+ %erlang:display({rm_r,Dir}),
+ case Mod:read_link_info(Dir) of
+ {ok, #file_info{type = directory}} ->
+ {ok,#file_info{type = directory}} = Mod:read_file_info(Dir),
+ {ok, Content} = Mod:list_dir(Dir),
+ [ true = is_list(Part) || Part <- Content ],
+ [ true = is_list(filename:join(Dir,Part)) || Part <- Content ],
+ [ rm_r(Mod,filename:join(Dir,C)) || C <- Content ],
+ ok = Mod:del_dir(Dir),
+ ok;
+ {ok, #file_info{type = regular}} ->
+ {ok,#file_info{type = regular}} = Mod:read_file_info(Dir),
+ ok = Mod:delete(Dir);
+ {ok, #file_info{type = symlink}} ->
+ ok = Mod:delete(Dir)
+ end.
+%% For icky test, allow binaries sometimes
+rm_r2(Mod,Dir) ->
+ %erlang:display({rm_r2,Dir}),
+ case Mod:read_link_info(Dir) of
+ {ok, #file_info{type = directory}} ->
+ {ok,#file_info{type = directory}} = Mod:read_file_info(Dir),
+ {ok, Content} = Mod:list_dir(Dir),
+ UniMode = file:native_name_encoding() =/= latin1,
+ [ true = (is_list(Part) orelse UniMode) || Part <- Content ],
+ [ true = (is_list(filename:join(Dir,Part)) orelse UniMode) || Part <- Content ],
+ [ rm_r2(Mod,filename:join(Dir,C)) || C <- Content ],
+ ok = Mod:del_dir(Dir),
+ ok;
+ {ok, #file_info{type = regular}} ->
+ {ok,#file_info{type = regular}} = Mod:read_file_info(Dir),
+ ok = Mod:delete(Dir);
+ {ok, #file_info{type = symlink}} ->
+ ok = Mod:delete(Dir)
+ end.
+chk_cre_dir(_,[]) ->
+ ok;
+chk_cre_dir(Mod,[{regular,Name,Content}|T]) ->
+ %io:format("~p~n",[Name]),
+ ok = Mod:write_file(Name,Content),
+ chk_cre_dir(Mod,T);
+chk_cre_dir(Mod,[{link,Name,Target}|T]) ->
+ ok = Mod:make_link(Target,Name),
+ chk_cre_dir(Mod,T);
+chk_cre_dir(Mod,[{symlink,Name,Target}|T]) ->
+ ok = Mod:make_symlink(Target,Name),
+ chk_cre_dir(Mod,T);
+chk_cre_dir(Mod,[{directory,Name,Content}|T]) ->
+ ok = Mod:make_dir(Name),
+ %io:format("Content = ~p~n",[Content]),
+ Content2 = [{Ty,filename:join(Name,N),case Ty of link -> filename:join(Name,C); _ -> C end} || {Ty,N,C} <- Content ],
+ %io:format("Content2 = ~p~n",[Content2]),
+ chk_cre_dir(Mod,Content2),
+ chk_cre_dir(Mod,T).
+
+has_links() ->
+ case os:type() of
+ {win32,_} ->
+ case os:version() of
+ {N,NN,_} when (N > 5) andalso (NN >= 1) ->
+ true;
+ _ ->
+ false
+ end;
+ _ ->
+ true
+ end.
+
+make_normal_dir(Mod) ->
+ rm_rf(Mod,"normal_dir"),
+ Mod:make_dir("normal_dir"),
+ Mod:set_cwd("normal_dir"),
+ Mod:write_file("fil1","fil1"),
+ Mod:write_file("fil2","fil2"),
+ case has_links() of
+ true ->
+ Mod:make_link("fil2","fil3"),
+ Mod:make_symlink("fil2","fil4");
+ _ ->
+ ok
+ end,
+ Mod:make_dir("subdir"),
+ Mod:write_file(filename:join("subdir","subfil1"),"subfil1"),
+ ok.
+
+normal_dir() ->
+ [{regular,"fil1","fil1"},
+ {regular,"fil2","fil2"}] ++
+ case has_links() of
+ true ->
+ [{regular,"fil3","fil2"},
+ {symlink,"fil4","fil2"}];
+ false ->
+ []
+ end ++
+ [{directory,"subdir",
+ [{regular,"subfil1","subfil1"}]}].
+
+make_icky_dir(Mod) ->
+ rm_rf(Mod,"icky_dir"),
+ Icky=icky_dir(),
+ chk_cre_dir(Mod,[{directory,"icky_dir",linkify([],Icky)}]),
+ Mod:set_cwd("icky_dir"),
+ ok.
+
+linkify(_Passed,[]) ->
+ [];
+linkify(Passed,[{regular,Name,Content}|T]) ->
+ Regulars = [ {N,C} || {regular,N,C} <- Passed, N =/= Name ],
+ case lists:keysearch(Content,2,Regulars) of
+ {value, {Linkto, Content}} ->
+ [{link,Name,Linkto} | linkify(Passed,T)];
+ _ ->
+ [{regular,Name,Content} | linkify([{regular,Name,Content}|Passed],T)]
+ end;
+linkify(Passed,[{directory, Name, Content}|T]) ->
+ [{directory,Name, linkify(Content,Content)}|linkify(Passed,T)];
+linkify(Passed,[H|T]) ->
+ [H|linkify([H|Passed],T)].
+
+hopeless_darwin() ->
+ case {os:type(),os:version()} of
+ {{unix,darwin},{Major,_,_}} when Major < 9 ->
+ true;
+ _ ->
+ false
+ end.
+
+icky_dir() ->
+ [{regular,"fil1","fil1"},
+ {regular,"���2","���2"}] ++
+ case has_links() of
+ true ->
+ [{regular,"���3","���2"},
+ {symlink,"���4","���2"}];
+ false ->
+ []
+ end ++
+ [{regular,treat_icky(<<"���5">>),"���5"}] ++
+ case has_links() of
+ true ->
+ [{symlink,treat_icky(<<"���6">>),treat_icky(<<"���5">>)}];
+ false ->
+ []
+ end ++
+ [{directory,treat_icky(<<"���subdir2">>),
+ [{regular,treat_icky(<<"���subfil2">>),"���subfil12"},
+ {regular,"���subfil3","���subfil13"}]},
+ {directory,"���subdir",
+ [{regular,"���subfil1","���subfil1"}]}].
+
+make_very_icky_dir(Mod) ->
+ rm_rf(Mod,"very_icky_dir"),
+ Icky=very_icky_dir(),
+ chk_cre_dir(Mod,[{directory,"very_icky_dir",linkify([],Icky)}]),
+ Mod:set_cwd("very_icky_dir"),
+ ok.
+
+very_icky_dir() ->
+ [{regular,"fil1","fil1"},
+ {regular,[956,965,963,954,959,49],"���2"}] ++
+ case has_links() of
+ true ->
+ [{regular,[956,965,963,954,959,50],"���2"},
+ {symlink,[956,965,963,954,959,51],[956,965,963,954,959,49]}];
+ false ->
+ []
+ end ++
+ [{regular,treat_icky(<<"���5">>),"���5"}] ++
+ case has_links() of
+ true ->
+ [{symlink,treat_icky(<<"���6">>),treat_icky(<<"���5">>)}];
+ false ->
+ []
+ end ++
+ [{directory,treat_icky(<<"���subdir2">>),
+ [{regular,treat_icky(<<"���subfil2">>),"���subfil12"},
+ {regular,"���subfil3","���subfil13"}]},
+ {directory,[956,965,963,954,959]++"subdir1",
+ [{regular,[956,965,963,954,959]++"subfil1","���subfil1"}]}].
+
+%% Some OS'es simply do not allow non UTF8 filenames
+treat_icky(Bin) ->
+ case os:type() of
+ {unix,darwin} ->
+ binary_to_list(procentify(Bin));
+ {win32,_} ->
+ binary_to_list(Bin);
+ _ ->
+ Bin
+ end.
+
+% Handle windows having absolute soft link targets.
+fixlink({ok,Link}) ->
+ case os:type() of
+ {win32,_} ->
+ {ok,filename:basename(Link)};
+ _ ->
+ {ok,Link}
+ end;
+fixlink(X) ->
+ X.
+
+procentify(<<>>) ->
+ <<>>;
+procentify(<<X:8,Rst/binary>>) when X > 127 ->
+ T=procentify(Rst),
+ Y = list_to_binary([$%
+ | io_lib:format("~2.16B",[X])]),
+ <<Y/binary,T/binary>>;
+procentify(<<X:8,Rst/binary>>) ->
+ T=procentify(Rst),
+ <<X:8,T/binary>>.
+
+
+list([]) ->
+ [];
+list([{_,Name,_} | T]) ->
+ [Name | list(T)].
+
+
+get_data(FN,List) ->
+ case lists:keysearch(FN,2,List) of
+ {value,{regular,FN,C}} ->
+ C;
+ {value,{symlink,FN,NewFN}} ->
+ get_data(NewFN,List);
+ _->
+ []
+ end.
+
+
+convlist(L) ->
+ convlist(file:native_name_encoding(),L).
+convlist(latin1,[Bin|T]) when is_binary(Bin) ->
+ %erlang:display('Convert...'),
+ [binary_to_list(Bin)| convlist(latin1,T)];
+convlist(Any,[H|T]) ->
+ [H|convlist(Any,T)];
+convlist(_,[]) ->
+ [].
+
+conv(L) ->
+ NoUniMode = file:native_name_encoding() =:= latin1,
+ if
+ NoUniMode, is_binary(L) ->
+ binary_to_list(L);
+ true ->
+ L
+ end.
+
+
+rand_comp_decomp(Max) ->
+ N = random:uniform(Max),
+ L = [ rand_decomp() || _ <- lists:seq(1,N) ],
+ LC = [ A || {A,_} <- L],
+ LD = lists:flatten([B || {_,B} <- L]),
+ LB = unicode:characters_to_binary(LD,unicode,utf8),
+ {LC,LB}.
+
+rand_decomp() ->
+ BT = bigtup(),
+ SZ = tuple_size(BT),
+ element(random:uniform(SZ),BT).
+bigtup() ->
+ {{192,[65,768]},
+ {200,[69,768]},
+ {204,[73,768]},
+ {210,[79,768]},
+ {217,[85,768]},
+ {7808,[87,768]},
+ {7922,[89,768]},
+ {224,[97,768]},
+ {232,[101,768]},
+ {236,[105,768]},
+ {242,[111,768]},
+ {249,[117,768]},
+ {7809,[119,768]},
+ {7923,[121,768]},
+ {8173,[168,768]},
+ {7846,[65,770,768]},
+ {7872,[69,770,768]},
+ {7890,[79,770,768]},
+ {7847,[97,770,768]},
+ {7873,[101,770,768]},
+ {7891,[111,770,768]},
+ {7700,[69,772,768]},
+ {7760,[79,772,768]},
+ {7701,[101,772,768]},
+ {7761,[111,772,768]},
+ {7856,[65,774,768]},
+ {7857,[97,774,768]},
+ {475,[85,776,768]},
+ {476,[117,776,768]},
+ {8146,[953,776,768]},
+ {8162,[965,776,768]},
+ {8074,[913,837,787,768]},
+ {8090,[919,837,787,768]},
+ {8106,[937,837,787,768]},
+ {8066,[945,837,787,768]},
+ {8082,[951,837,787,768]},
+ {8098,[969,837,787,768]},
+ {7946,[913,787,768]},
+ {7962,[917,787,768]},
+ {7978,[919,787,768]},
+ {7994,[921,787,768]},
+ {8010,[927,787,768]},
+ {8042,[937,787,768]},
+ {7938,[945,787,768]},
+ {7954,[949,787,768]},
+ {7970,[951,787,768]},
+ {7986,[953,787,768]},
+ {8002,[959,787,768]},
+ {8018,[965,787,768]},
+ {8034,[969,787,768]},
+ {8075,[913,837,788,768]},
+ {8091,[919,837,788,768]},
+ {8107,[937,837,788,768]},
+ {8067,[945,837,788,768]},
+ {8083,[951,837,788,768]},
+ {8099,[969,837,788,768]},
+ {7947,[913,788,768]},
+ {7963,[917,788,768]},
+ {7979,[919,788,768]},
+ {7995,[921,788,768]},
+ {8011,[927,788,768]},
+ {8027,[933,788,768]},
+ {8043,[937,788,768]},
+ {7939,[945,788,768]},
+ {7955,[949,788,768]},
+ {7971,[951,788,768]},
+ {7987,[953,788,768]},
+ {8003,[959,788,768]},
+ {8019,[965,788,768]},
+ {8035,[969,788,768]},
+ {7900,[79,795,768]},
+ {7914,[85,795,768]},
+ {7901,[111,795,768]},
+ {7915,[117,795,768]},
+ {8114,[945,837,768]},
+ {8130,[951,837,768]},
+ {8178,[969,837,768]},
+ {8122,[913,768]},
+ {8136,[917,768]},
+ {8138,[919,768]},
+ {8154,[921,768]},
+ {8184,[927,768]},
+ {8170,[933,768]},
+ {8186,[937,768]},
+ {8048,[945,768]},
+ {8050,[949,768]},
+ {8052,[951,768]},
+ {8054,[953,768]},
+ {8056,[959,768]},
+ {8058,[965,768]},
+ {8060,[969,768]},
+ {8141,[8127,768]},
+ {8157,[8190,768]},
+ {193,[65,769]},
+ {262,[67,769]},
+ {201,[69,769]},
+ {500,[71,769]},
+ {205,[73,769]},
+ {7728,[75,769]},
+ {313,[76,769]},
+ {7742,[77,769]},
+ {323,[78,769]},
+ {211,[79,769]},
+ {7764,[80,769]},
+ {340,[82,769]},
+ {346,[83,769]},
+ {218,[85,769]},
+ {7810,[87,769]},
+ {221,[89,769]},
+ {377,[90,769]},
+ {225,[97,769]},
+ {263,[99,769]},
+ {233,[101,769]},
+ {501,[103,769]},
+ {237,[105,769]},
+ {7729,[107,769]},
+ {314,[108,769]},
+ {7743,[109,769]},
+ {324,[110,769]},
+ {243,[111,769]},
+ {7765,[112,769]},
+ {341,[114,769]},
+ {347,[115,769]},
+ {250,[117,769]},
+ {7811,[119,769]},
+ {253,[121,769]},
+ {378,[122,769]},
+ {8174,[168,769]},
+ {508,[198,769]},
+ {510,[216,769]},
+ {509,[230,769]},
+ {511,[248,769]},
+ {7844,[65,770,769]},
+ {7870,[69,770,769]},
+ {7888,[79,770,769]},
+ {7845,[97,770,769]},
+ {7871,[101,770,769]},
+ {7889,[111,770,769]},
+ {7756,[79,771,769]},
+ {7800,[85,771,769]},
+ {7757,[111,771,769]},
+ {7801,[117,771,769]},
+ {7702,[69,772,769]},
+ {7762,[79,772,769]},
+ {7703,[101,772,769]},
+ {7763,[111,772,769]},
+ {7854,[65,774,769]},
+ {7855,[97,774,769]},
+ {7726,[73,776,769]},
+ {471,[85,776,769]},
+ {7727,[105,776,769]},
+ {472,[117,776,769]},
+ {8147,[953,776,769]},
+ {8163,[965,776,769]},
+ {506,[65,778,769]},
+ {507,[97,778,769]},
+ {8076,[913,837,787,769]},
+ {8092,[919,837,787,769]},
+ {8108,[937,837,787,769]},
+ {8068,[945,837,787,769]},
+ {8084,[951,837,787,769]},
+ {8100,[969,837,787,769]},
+ {7948,[913,787,769]},
+ {7964,[917,787,769]},
+ {7980,[919,787,769]},
+ {7996,[921,787,769]},
+ {8012,[927,787,769]},
+ {8044,[937,787,769]},
+ {7940,[945,787,769]},
+ {7956,[949,787,769]},
+ {7972,[951,787,769]},
+ {7988,[953,787,769]},
+ {8004,[959,787,769]},
+ {8020,[965,787,769]},
+ {8036,[969,787,769]},
+ {8077,[913,837,788,769]},
+ {8093,[919,837,788,769]},
+ {8109,[937,837,788,769]},
+ {8069,[945,837,788,769]},
+ {8085,[951,837,788,769]},
+ {8101,[969,837,788,769]},
+ {7949,[913,788,769]},
+ {7965,[917,788,769]},
+ {7981,[919,788,769]},
+ {7997,[921,788,769]},
+ {8013,[927,788,769]},
+ {8029,[933,788,769]},
+ {8045,[937,788,769]},
+ {7941,[945,788,769]},
+ {7957,[949,788,769]},
+ {7973,[951,788,769]},
+ {7989,[953,788,769]},
+ {8005,[959,788,769]},
+ {8021,[965,788,769]},
+ {8037,[969,788,769]},
+ {7898,[79,795,769]},
+ {7912,[85,795,769]},
+ {7899,[111,795,769]},
+ {7913,[117,795,769]},
+ {7688,[67,807,769]},
+ {7689,[99,807,769]},
+ {8116,[945,837,769]},
+ {8132,[951,837,769]},
+ {8180,[959,837,769]},
+ {8123,[913,769]},
+ {8137,[917,769]},
+ {8139,[919,769]},
+ {8155,[921,769]},
+ {8185,[927,769]},
+ {8171,[933,769]},
+ {8187,[937,769]},
+ {8049,[945,769]},
+ {8051,[949,769]},
+ {8053,[951,769]},
+ {8055,[953,769]},
+ {8057,[959,769]},
+ {8059,[965,769]},
+ {8061,[969,769]},
+ {1027,[1043,769]},
+ {1036,[1050,769]},
+ {1107,[1075,769]},
+ {1116,[1082,769]},
+ {8142,[8127,769]},
+ {8158,[8190,769]},
+ {194,[65,770]},
+ {264,[67,770]},
+ {202,[69,770]},
+ {284,[71,770]},
+ {292,[72,770]},
+ {206,[73,770]},
+ {308,[74,770]},
+ {212,[79,770]},
+ {348,[83,770]},
+ {219,[85,770]},
+ {372,[87,770]},
+ {374,[89,770]},
+ {7824,[90,770]},
+ {226,[97,770]},
+ {265,[99,770]},
+ {234,[101,770]},
+ {285,[103,770]},
+ {293,[104,770]},
+ {238,[105,770]},
+ {309,[106,770]},
+ {244,[111,770]},
+ {349,[115,770]},
+ {251,[117,770]},
+ {373,[119,770]},
+ {375,[121,770]},
+ {7825,[122,770]},
+ {7852,[65,803,770]},
+ {7878,[69,803,770]},
+ {7896,[79,803,770]},
+ {7853,[97,803,770]},
+ {7879,[101,803,770]},
+ {7897,[111,803,770]},
+ {195,[65,771]},
+ {7868,[69,771]},
+ {296,[73,771]},
+ {209,[78,771]},
+ {213,[79,771]},
+ {360,[85,771]},
+ {7804,[86,771]},
+ {7928,[89,771]},
+ {227,[97,771]},
+ {7869,[101,771]},
+ {297,[105,771]},
+ {241,[110,771]},
+ {245,[111,771]},
+ {361,[117,771]},
+ {7805,[118,771]},
+ {7929,[121,771]},
+ {7850,[65,770,771]},
+ {7876,[69,770,771]},
+ {7894,[79,770,771]},
+ {7851,[97,770,771]},
+ {7877,[101,770,771]},
+ {7895,[111,770,771]},
+ {7860,[65,774,771]},
+ {7861,[97,774,771]},
+ {7904,[79,795,771]},
+ {7918,[85,795,771]},
+ {7905,[111,795,771]},
+ {7919,[117,795,771]},
+ {256,[65,772]},
+ {274,[69,772]},
+ {7712,[71,772]},
+ {298,[73,772]},
+ {332,[79,772]},
+ {362,[85,772]},
+ {257,[97,772]},
+ {275,[101,772]},
+ {7713,[103,772]},
+ {299,[105,772]},
+ {333,[111,772]},
+ {363,[117,772]},
+ {482,[198,772]},
+ {483,[230,772]},
+ {480,[65,775,772]},
+ {481,[97,775,772]},
+ {478,[65,776,772]},
+ {469,[85,776,772]},
+ {479,[97,776,772]},
+ {470,[117,776,772]},
+ {7736,[76,803,772]},
+ {7772,[82,803,772]},
+ {7737,[108,803,772]},
+ {7773,[114,803,772]},
+ {492,[79,808,772]},
+ {493,[111,808,772]},
+ {8121,[913,772]},
+ {8153,[921,772]},
+ {8169,[933,772]},
+ {8113,[945,772]},
+ {8145,[953,772]},
+ {8161,[965,772]},
+ {1250,[1048,772]},
+ {1262,[1059,772]},
+ {1251,[1080,772]},
+ {1263,[1091,772]},
+ {258,[65,774]},
+ {276,[69,774]},
+ {286,[71,774]},
+ {300,[73,774]},
+ {334,[79,774]},
+ {364,[85,774]},
+ {259,[97,774]},
+ {277,[101,774]},
+ {287,[103,774]},
+ {301,[105,774]},
+ {335,[111,774]},
+ {365,[117,774]},
+ {7862,[65,803,774]},
+ {7863,[97,803,774]},
+ {7708,[69,807,774]},
+ {7709,[101,807,774]},
+ {8120,[913,774]},
+ {8152,[921,774]},
+ {8168,[933,774]},
+ {8112,[945,774]},
+ {8144,[953,774]},
+ {8160,[965,774]},
+ {1232,[1040,774]},
+ {1238,[1045,774]},
+ {1217,[1046,774]},
+ {1049,[1048,774]},
+ {1038,[1059,774]},
+ {1233,[1072,774]},
+ {1239,[1077,774]},
+ {1218,[1078,774]},
+ {1081,[1080,774]},
+ {1118,[1091,774]},
+ {7682,[66,775]},
+ {266,[67,775]},
+ {7690,[68,775]},
+ {278,[69,775]},
+ {7710,[70,775]},
+ {288,[71,775]},
+ {7714,[72,775]},
+ {304,[73,775]},
+ {7744,[77,775]},
+ {7748,[78,775]},
+ {7766,[80,775]},
+ {7768,[82,775]},
+ {7776,[83,775]},
+ {7786,[84,775]},
+ {7814,[87,775]},
+ {7818,[88,775]},
+ {7822,[89,775]},
+ {379,[90,775]},
+ {7683,[98,775]},
+ {267,[99,775]},
+ {7691,[100,775]},
+ {279,[101,775]},
+ {7711,[102,775]},
+ {289,[103,775]},
+ {7715,[104,775]},
+ {7745,[109,775]},
+ {7749,[110,775]},
+ {7767,[112,775]},
+ {7769,[114,775]},
+ {7777,[115,775]},
+ {7787,[116,775]},
+ {7815,[119,775]},
+ {7819,[120,775]},
+ {7823,[121,775]},
+ {380,[122,775]},
+ {7835,[383,775]},
+ {7780,[83,769,775]},
+ {7781,[115,769,775]},
+ {784,[774,775]},
+ {7782,[83,780,775]},
+ {7783,[115,780,775]},
+ {7784,[83,803,775]},
+ {7785,[115,803,775]},
+ {196,[65,776]},
+ {203,[69,776]},
+ {7718,[72,776]},
+ {207,[73,776]},
+ {214,[79,776]},
+ {220,[85,776]},
+ {7812,[87,776]},
+ {7820,[88,776]},
+ {376,[89,776]},
+ {228,[97,776]},
+ {235,[101,776]},
+ {7719,[104,776]},
+ {239,[105,776]},
+ {246,[111,776]},
+ {7831,[116,776]},
+ {252,[117,776]},
+ {7813,[119,776]},
+ {7821,[120,776]},
+ {255,[121,776]},
+ {1242,[399,776]},
+ {1258,[415,776]},
+ {1243,[601,776]},
+ {1259,[629,776]},
+ {7758,[79,771,776]},
+ {7759,[111,771,776]},
+ {7802,[85,772,776]},
+ {7803,[117,772,776]},
+ {938,[921,776]},
+ {939,[933,776]},
+ {970,[953,776]},
+ {971,[965,776]},
+ {980,[978,776]},
+ {1031,[1030,776]},
+ {1234,[1040,776]},
+ {1025,[1045,776]},
+ {1244,[1046,776]},
+ {1246,[1047,776]},
+ {1252,[1048,776]},
+ {1254,[1054,776]},
+ {1264,[1059,776]},
+ {1268,[1063,776]},
+ {1272,[1067,776]},
+ {1235,[1072,776]},
+ {1105,[1077,776]},
+ {1245,[1078,776]},
+ {1247,[1079,776]},
+ {1253,[1080,776]},
+ {1255,[1086,776]},
+ {1265,[1091,776]},
+ {1269,[1095,776]},
+ {1273,[1099,776]},
+ {1111,[1110,776]},
+ {7842,[65,777]},
+ {7866,[69,777]},
+ {7880,[73,777]},
+ {7886,[79,777]},
+ {7910,[85,777]},
+ {7926,[89,777]},
+ {7843,[97,777]},
+ {7867,[101,777]},
+ {7881,[105,777]},
+ {7887,[111,777]},
+ {7911,[117,777]},
+ {7927,[121,777]},
+ {7848,[65,770,777]},
+ {7874,[69,770,777]},
+ {7892,[79,770,777]},
+ {7849,[97,770,777]},
+ {7875,[101,770,777]},
+ {7893,[111,770,777]},
+ {7858,[65,774,777]},
+ {7859,[97,774,777]},
+ {7902,[79,795,777]},
+ {7916,[85,795,777]},
+ {7903,[111,795,777]},
+ {7917,[117,795,777]},
+ {197,[65,778]},
+ {366,[85,778]},
+ {229,[97,778]},
+ {367,[117,778]},
+ {7832,[119,778]},
+ {7833,[121,778]},
+ {336,[79,779]},
+ {368,[85,779]},
+ {337,[111,779]},
+ {369,[117,779]},
+ {1266,[1059,779]},
+ {1267,[1091,779]},
+ {461,[65,780]},
+ {268,[67,780]},
+ {270,[68,780]},
+ {282,[69,780]},
+ {486,[71,780]},
+ {463,[73,780]},
+ {488,[75,780]},
+ {317,[76,780]},
+ {327,[78,780]},
+ {465,[79,780]},
+ {344,[82,780]},
+ {352,[83,780]},
+ {356,[84,780]},
+ {467,[85,780]},
+ {381,[90,780]},
+ {462,[97,780]},
+ {269,[99,780]},
+ {271,[100,780]},
+ {283,[101,780]},
+ {487,[103,780]},
+ {464,[105,780]},
+ {496,[106,780]},
+ {489,[107,780]},
+ {318,[108,780]},
+ {328,[110,780]},
+ {466,[111,780]},
+ {345,[114,780]},
+ {353,[115,780]},
+ {357,[116,780]},
+ {468,[117,780]},
+ {382,[122,780]},
+ {494,[439,780]},
+ {495,[658,780]},
+ {473,[85,776,780]},
+ {474,[117,776,780]},
+ {901,[168,781]},
+ {912,[953,776,781]},
+ {944,[965,776,781]},
+ {902,[913,781]},
+ {904,[917,781]},
+ {905,[919,781]},
+ {906,[921,781]},
+ {908,[927,781]},
+ {910,[933,781]},
+ {911,[937,781]},
+ {940,[945,781]},
+ {941,[949,781]},
+ {942,[951,781]},
+ {943,[953,781]},
+ {972,[959,781]},
+ {973,[965,781]},
+ {974,[969,781]},
+ {979,[978,781]},
+ {512,[65,783]},
+ {516,[69,783]},
+ {520,[73,783]},
+ {524,[79,783]},
+ {528,[82,783]},
+ {532,[85,783]},
+ {513,[97,783]},
+ {517,[101,783]},
+ {521,[105,783]},
+ {525,[111,783]},
+ {529,[114,783]},
+ {533,[117,783]},
+ {1142,[1140,783]},
+ {1143,[1141,783]},
+ {514,[65,785]},
+ {518,[69,785]},
+ {522,[73,785]},
+ {526,[79,785]},
+ {530,[82,785]},
+ {534,[85,785]},
+ {515,[97,785]},
+ {519,[101,785]},
+ {523,[105,785]},
+ {527,[111,785]},
+ {531,[114,785]},
+ {535,[117,785]},
+ {8072,[913,837,787]},
+ {8088,[919,837,787]},
+ {8104,[937,837,787]},
+ {8064,[945,837,787]},
+ {8080,[951,837,787]},
+ {8096,[969,837,787]},
+ {7944,[913,787]},
+ {7960,[917,787]},
+ {7976,[919,787]},
+ {7992,[921,787]},
+ {8008,[927,787]},
+ {8040,[937,787]},
+ {7936,[945,787]},
+ {7952,[949,787]},
+ {7968,[951,787]},
+ {7984,[953,787]},
+ {8000,[959,787]},
+ {8164,[961,787]},
+ {8016,[965,787]},
+ {8032,[969,787]},
+ {8073,[913,837,788]},
+ {8089,[919,837,788]},
+ {8105,[937,837,788]},
+ {8065,[945,837,788]},
+ {8081,[951,837,788]},
+ {8097,[969,837,788]},
+ {7945,[913,788]},
+ {7961,[917,788]},
+ {7977,[919,788]},
+ {7993,[921,788]},
+ {8009,[927,788]},
+ {8172,[929,788]},
+ {8025,[933,788]},
+ {8041,[937,788]},
+ {7937,[945,788]},
+ {7953,[949,788]},
+ {7969,[951,788]},
+ {7985,[953,788]},
+ {8001,[959,788]},
+ {8165,[961,788]},
+ {8017,[965,788]},
+ {8033,[969,788]},
+ {416,[79,795]},
+ {431,[85,795]},
+ {417,[111,795]},
+ {432,[117,795]},
+ {7840,[65,803]},
+ {7684,[66,803]},
+ {7692,[68,803]},
+ {7864,[69,803]},
+ {7716,[72,803]},
+ {7882,[73,803]},
+ {7730,[75,803]},
+ {7734,[76,803]},
+ {7746,[77,803]},
+ {7750,[78,803]},
+ {7884,[79,803]},
+ {7770,[82,803]},
+ {7778,[83,803]},
+ {7788,[84,803]},
+ {7908,[85,803]},
+ {7806,[86,803]},
+ {7816,[87,803]},
+ {7924,[89,803]},
+ {7826,[90,803]},
+ {7841,[97,803]},
+ {7685,[98,803]},
+ {7693,[100,803]},
+ {7865,[101,803]},
+ {7717,[104,803]},
+ {7883,[105,803]},
+ {7731,[107,803]},
+ {7735,[108,803]},
+ {7747,[109,803]},
+ {7751,[110,803]},
+ {7885,[111,803]},
+ {7771,[114,803]},
+ {7779,[115,803]},
+ {7789,[116,803]},
+ {7909,[117,803]},
+ {7807,[118,803]},
+ {7817,[119,803]},
+ {7925,[121,803]},
+ {7827,[122,803]},
+ {7906,[79,795,803]},
+ {7920,[85,795,803]},
+ {7907,[111,795,803]},
+ {7921,[117,795,803]},
+ {7794,[85,804]},
+ {7795,[117,804]},
+ {7680,[65,805]},
+ {7681,[97,805]},
+ {199,[67,807]},
+ {7696,[68,807]},
+ {290,[71,807]},
+ {7720,[72,807]},
+ {310,[75,807]},
+ {315,[76,807]},
+ {325,[78,807]},
+ {342,[82,807]},
+ {350,[83,807]},
+ {354,[84,807]},
+ {231,[99,807]},
+ {7697,[100,807]},
+ {291,[103,807]},
+ {7721,[104,807]},
+ {311,[107,807]},
+ {316,[108,807]},
+ {326,[110,807]},
+ {343,[114,807]},
+ {351,[115,807]},
+ {355,[116,807]},
+ {260,[65,808]},
+ {280,[69,808]},
+ {302,[73,808]},
+ {490,[79,808]},
+ {370,[85,808]},
+ {261,[97,808]},
+ {281,[101,808]},
+ {303,[105,808]},
+ {491,[111,808]},
+ {371,[117,808]},
+ {7698,[68,813]},
+ {7704,[69,813]},
+ {7740,[76,813]},
+ {7754,[78,813]},
+ {7792,[84,813]},
+ {7798,[85,813]},
+ {7699,[100,813]},
+ {7705,[101,813]},
+ {7741,[108,813]},
+ {7755,[110,813]},
+ {7793,[116,813]},
+ {7799,[117,813]},
+ {7722,[72,814]},
+ {7723,[104,814]},
+ {7706,[69,816]},
+ {7724,[73,816]},
+ {7796,[85,816]},
+ {7707,[101,816]},
+ {7725,[105,816]},
+ {7797,[117,816]},
+ {7686,[66,817]},
+ {7694,[68,817]},
+ {7732,[75,817]},
+ {7738,[76,817]},
+ {7752,[78,817]},
+ {7774,[82,817]},
+ {7790,[84,817]},
+ {7828,[90,817]},
+ {7687,[98,817]},
+ {7695,[100,817]},
+ {7830,[104,817]},
+ {7733,[107,817]},
+ {7739,[108,817]},
+ {7753,[110,817]},
+ {7775,[114,817]},
+ {7791,[116,817]},
+ {7829,[122,817]},
+ {8129,[168,834]},
+ {8151,[953,776,834]},
+ {8167,[965,776,834]},
+ {8078,[913,837,787,834]},
+ {8094,[919,837,787,834]},
+ {8110,[937,837,787,834]},
+ {8070,[945,837,787,834]},
+ {8086,[951,837,787,834]},
+ {8102,[969,837,787,834]},
+ {7950,[913,787,834]},
+ {7982,[919,787,834]},
+ {7998,[921,787,834]},
+ {8046,[937,787,834]},
+ {7942,[945,787,834]},
+ {7974,[951,787,834]},
+ {7990,[953,787,834]},
+ {8022,[965,787,834]},
+ {8038,[969,787,834]},
+ {8079,[913,837,788,834]},
+ {8095,[919,837,788,834]},
+ {8111,[937,837,788,834]},
+ {8071,[945,837,788,834]},
+ {8087,[951,837,788,834]},
+ {8103,[969,837,788,834]},
+ {7951,[913,788,834]},
+ {7983,[919,788,834]},
+ {7999,[921,788,834]},
+ {8031,[933,788,834]},
+ {8047,[937,788,834]},
+ {7943,[945,788,834]},
+ {7975,[951,788,834]},
+ {7991,[953,788,834]},
+ {8023,[965,788,834]},
+ {8039,[969,788,834]},
+ {8119,[945,837,834]},
+ {8135,[951,837,834]},
+ {8183,[969,837,834]},
+ {8118,[945,834]},
+ {8134,[951,834]},
+ {8150,[953,834]},
+ {8166,[965,834]},
+ {8182,[969,834]},
+ {8143,[8127,834]},
+ {8159,[8190,834]},
+ {8124,[913,837]},
+ {8140,[919,837]},
+ {8188,[937,837]},
+ {8115,[945,837]},
+ {8131,[951,837]},
+ {8179,[969,837]},
+ {64302,[1488,1463]},
+ {64287,[1522,1463]},
+ {64303,[1488,1464]},
+ {64331,[1493,1465]},
+ {64304,[1488,1468]},
+ {64305,[1489,1468]},
+ {64306,[1490,1468]},
+ {64307,[1491,1468]},
+ {64308,[1492,1468]},
+ {64309,[1493,1468]},
+ {64310,[1494,1468]},
+ {64312,[1496,1468]},
+ {64313,[1497,1468]},
+ {64314,[1498,1468]},
+ {64315,[1499,1468]},
+ {64316,[1500,1468]},
+ {64318,[1502,1468]},
+ {64320,[1504,1468]},
+ {64321,[1505,1468]},
+ {64323,[1507,1468]},
+ {64324,[1508,1468]},
+ {64326,[1510,1468]},
+ {64327,[1511,1468]},
+ {64328,[1512,1468]},
+ {64329,[1513,1468]},
+ {64330,[1514,1468]},
+ {64332,[1489,1471]},
+ {64333,[1499,1471]},
+ {64334,[1508,1471]},
+ {64300,[1513,1468,1473]},
+ {64298,[1513,1473]},
+ {64301,[1513,1468,1474]},
+ {64299,[1513,1474]},
+ {2392,[2325,2364]},
+ {2393,[2326,2364]},
+ {2394,[2327,2364]},
+ {2395,[2332,2364]},
+ {2396,[2337,2364]},
+ {2397,[2338,2364]},
+ {2345,[2344,2364]},
+ {2398,[2347,2364]},
+ {2399,[2351,2364]},
+ {2353,[2352,2364]},
+ {2356,[2355,2364]},
+ {2524,[2465,2492]},
+ {2525,[2466,2492]},
+ {2480,[2476,2492]},
+ {2527,[2479,2492]},
+ {2507,[2503,2494]},
+ {2508,[2503,2519]},
+ {2649,[2582,2620]},
+ {2650,[2583,2620]},
+ {2651,[2588,2620]},
+ {2652,[2593,2620]},
+ {2654,[2603,2620]},
+ {2908,[2849,2876]},
+ {2909,[2850,2876]},
+ {2911,[2863,2876]},
+ {2891,[2887,2878]},
+ {2888,[2887,2902]},
+ {2892,[2887,2903]},
+ {3018,[3014,3006]},
+ {3019,[3015,3006]},
+ {2964,[2962,3031]},
+ {3020,[3014,3031]},
+ {3144,[3142,3158]},
+ {3274,[3270,3266]},
+ {3264,[3263,3285]},
+ {3275,[3270,3266,3285]},
+ {3271,[3270,3285]},
+ {3272,[3270,3286]},
+ {3402,[3398,3390]},
+ {3403,[3399,3390]},
+ {3404,[3398,3415]},
+ {3635,[3661,3634]},
+ {3763,[3789,3762]},
+ {3955,[3954,3953]},
+ {3957,[3956,3953]},
+ {3959,[4018,3968,3953]},
+ {3961,[4019,3968,3953]},
+ {3958,[4018,3968]},
+ {3960,[4019,3968]},
+ {3945,[3904,4021]},
+ {4025,[3984,4021]},
+ {3907,[3906,4023]},
+ {3917,[3916,4023]},
+ {3922,[3921,4023]},
+ {3927,[3926,4023]},
+ {3932,[3931,4023]},
+ {3987,[3986,4023]},
+ {3997,[3996,4023]},
+ {4002,[4001,4023]},
+ {4007,[4006,4023]},
+ {4012,[4011,4023]},
+ {12436,[12358,12441]},
+ {12364,[12363,12441]},
+ {12366,[12365,12441]},
+ {12368,[12367,12441]},
+ {12370,[12369,12441]},
+ {12372,[12371,12441]},
+ {12374,[12373,12441]},
+ {12376,[12375,12441]},
+ {12378,[12377,12441]},
+ {12380,[12379,12441]},
+ {12382,[12381,12441]},
+ {12384,[12383,12441]},
+ {12386,[12385,12441]},
+ {12389,[12388,12441]},
+ {12391,[12390,12441]},
+ {12393,[12392,12441]},
+ {12400,[12399,12441]},
+ {12403,[12402,12441]},
+ {12406,[12405,12441]},
+ {12409,[12408,12441]},
+ {12412,[12411,12441]},
+ {12446,[12445,12441]},
+ {12532,[12454,12441]},
+ {12460,[12459,12441]},
+ {12462,[12461,12441]},
+ {12464,[12463,12441]},
+ {12466,[12465,12441]},
+ {12468,[12467,12441]},
+ {12470,[12469,12441]},
+ {12472,[12471,12441]},
+ {12474,[12473,12441]},
+ {12476,[12475,12441]},
+ {12478,[12477,12441]},
+ {12480,[12479,12441]},
+ {12482,[12481,12441]},
+ {12485,[12484,12441]},
+ {12487,[12486,12441]},
+ {12489,[12488,12441]},
+ {12496,[12495,12441]},
+ {12499,[12498,12441]},
+ {12502,[12501,12441]},
+ {12505,[12504,12441]},
+ {12508,[12507,12441]},
+ {12535,[12527,12441]},
+ {12536,[12528,12441]},
+ {12537,[12529,12441]},
+ {12538,[12530,12441]},
+ {12542,[12541,12441]},
+ {12401,[12399,12442]},
+ {12404,[12402,12442]},
+ {12407,[12405,12442]},
+ {12410,[12408,12442]},
+ {12413,[12411,12442]},
+ {12497,[12495,12442]},
+ {12500,[12498,12442]},
+ {12503,[12501,12442]},
+ {12506,[12504,12442]},
+ {12509,[12507,12442]}}.
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 bbdfbd3cb0..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.
@@ -423,40 +442,46 @@ connect(Config) when is_list(Config) ->
?line ok = gen_udp:close(S1),
?line ok = gen_udp:connect(S2, Addr, P1),
?line ok = gen_udp:send(S2, <<16#deadbeef:32>>),
- ?line {error,econnrefused} = gen_udp:recv(S2, 0, 5),
+ ?line ok = case gen_udp:recv(S2, 0, 5) of
+ {error,econnrefused} -> ok;
+ {error,econnreset} -> ok;
+ Other -> Other
+ end,
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.
@@ -477,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 f4f27933a5..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]).
+ 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].
+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) ->
@@ -873,6 +925,14 @@ getif(suite) ->
getif(doc) ->
["Tests basic functionality of getiflist, getif, and ifget"];
getif(Config) when is_list(Config) ->
+ ?line case os:type() of
+ {unix,Osname} ->
+ ?line do_getif(Osname);
+ {_,_} ->
+ {skip,"inet:getif/0 probably not supported"}
+ end.
+
+do_getif(Osname) ->
?line {ok,Hostname} = inet:gethostname(),
?line {ok,Address} = inet:getaddr(Hostname, inet),
?line {ok,Loopback} = inet:getaddr("localhost", inet),
@@ -887,7 +947,8 @@ getif(Config) when is_list(Config) ->
end
end, [], Interfaces)),
?line io:format("HWAs = ~p~n", [HWAs]),
- ?line length(HWAs) > 0 orelse ?t:fail(no_HWAs),
+ ?line (Osname =/= sunos)
+ andalso ((length(HWAs) > 0) orelse (?t:fail(no_HWAs))),
?line Addresses =
lists:sort(
lists:foldl(
@@ -906,6 +967,14 @@ getif(Config) when is_list(Config) ->
getif_ifr_name_overflow(doc) ->
"Test long interface names do not overrun buffer";
getif_ifr_name_overflow(Config) when is_list(Config) ->
+ ?line case os:type() of
+ {unix,Osname} ->
+ ?line do_getif_ifr_name_overflow(Osname);
+ {_,_} ->
+ {skip,"inet:ifget/2 probably not supported"}
+ end.
+
+do_getif_ifr_name_overflow(_) ->
%% emulator should not crash
?line {ok,[]} = inet:ifget(lists:duplicate(128, "x"), [addr]),
ok.
@@ -917,6 +986,112 @@ getservbyname_overflow(Config) when is_list(Config) ->
?line {error,einval} = inet:getservbyname(list_to_atom(lists:flatten(lists:duplicate(128, "x"))), tcp),
ok.
+getifaddrs(doc) ->
+ "Test inet:gifaddrs/0";
+getifaddrs(Config) when is_list (Config) ->
+ ?line {ok,IfAddrs} = inet:getifaddrs(),
+ ?line ?t:format("IfAddrs = ~p.~n", [IfAddrs]),
+ ?line
+ case
+ {os:type(),
+ [If ||
+ {If,Opts} <- IfAddrs,
+ lists:keymember(hwaddr, 1, Opts)]} of
+ {{unix,sunos},[]} -> ok;
+ {OT,[]} ->
+ ?t:fail({should_have_hwaddr,OT});
+ _ -> ok
+ end,
+ ?line Addrs =
+ [element(1, A) || A <- ifaddrs(IfAddrs)],
+ ?line ?t:format("Addrs = ~p.~n", [Addrs]),
+ ?line [check_addr(Addr) || Addr <- Addrs],
+ ok.
+
+check_addr(Addr)
+ when tuple_size(Addr) =:= 8,
+ element(1, Addr) band 16#FFC0 =:= 16#FE80 ->
+ ?line ?t:format("Addr: ~p link local; SKIPPED!~n", [Addr]),
+ ok;
+check_addr(Addr) ->
+ ?line ?t:format("Addr: ~p.~n", [Addr]),
+ ?line Ping = "ping",
+ ?line Pong = "pong",
+ ?line {ok,L} = gen_tcp:listen(0, [{ip,Addr},{active,false}]),
+ ?line {ok,P} = inet:port(L),
+ ?line {ok,S1} = gen_tcp:connect(Addr, P, [{active,false}]),
+ ?line {ok,S2} = gen_tcp:accept(L),
+ ?line ok = gen_tcp:send(S2, Ping),
+ ?line {ok,Ping} = gen_tcp:recv(S1, length(Ping)),
+ ?line ok = gen_tcp:send(S1, Pong),
+ ?line ok = gen_tcp:close(S1),
+ ?line {ok,Pong} = gen_tcp:recv(S2, length(Pong)),
+ ?line ok = gen_tcp:close(S2),
+ ?line ok = gen_tcp:close(L),
+ ok.
+
+-record(ifopts, {name,flags,addrs=[],hwaddr}).
+
+ifaddrs([]) -> [];
+ifaddrs([{If,Opts}|IOs]) ->
+ ?line #ifopts{flags=Flags} = Ifopts =
+ check_ifopts(Opts, #ifopts{name=If}),
+ ?line case Flags =/= undefined andalso lists:member(up, Flags) of
+ true ->
+ Ifopts#ifopts.addrs;
+ false ->
+ []
+ end++ifaddrs(IOs).
+
+check_ifopts([], #ifopts{name=If,flags=Flags,addrs=Raddrs}=Ifopts) ->
+ Addrs = lists:reverse(Raddrs),
+ R = Ifopts#ifopts{addrs=Addrs},
+ ?t:format("~p.~n", [R]),
+ %% See how we did...
+ if is_list(Flags) -> ok;
+ true ->
+ ?t:fail({flags_undefined,If})
+ end,
+ case lists:member(broadcast, Flags) of
+ true ->
+ [case A of
+ {_,_,_} -> A;
+ {T,_} when tuple_size(T) =:= 8 -> A;
+ _ ->
+ ?t:fail({broaddr_missing,If,A})
+ end || A <- Addrs];
+ false ->
+ [case A of {_,_} -> A;
+ _ ->
+ ?t:fail({should_have_netmask,If,A})
+ end || A <- Addrs]
+ end,
+ R;
+check_ifopts([{flags,Flags}|Opts], #ifopts{flags=undefined}=Ifopts) ->
+ check_ifopts(Opts, Ifopts#ifopts{flags=Flags});
+check_ifopts([{flags,Fs}|Opts], #ifopts{flags=Flags}=Ifopts) ->
+ case Fs of
+ Flags ->
+ check_ifopts(Opts, Ifopts#ifopts{});
+ _ ->
+ ?t:fail({multiple_flags,Fs,Ifopts})
+ end;
+check_ifopts(
+ [{addr,Addr},{netmask,Netmask},{broadaddr,Broadaddr}|Opts],
+ #ifopts{addrs=Addrs}=Ifopts) ->
+ check_ifopts(Opts, Ifopts#ifopts{addrs=[{Addr,Netmask,Broadaddr}|Addrs]});
+check_ifopts(
+ [{addr,Addr},{netmask,Netmask}|Opts],
+ #ifopts{addrs=Addrs}=Ifopts) ->
+ check_ifopts(Opts, Ifopts#ifopts{addrs=[{Addr,Netmask}|Addrs]});
+check_ifopts([{addr,Addr}|Opts], #ifopts{addrs=Addrs}=Ifopts) ->
+ check_ifopts(Opts, Ifopts#ifopts{addrs=[{Addr}|Addrs]});
+check_ifopts([{hwaddr,Hwaddr}|Opts], #ifopts{hwaddr=undefined}=Ifopts)
+ when is_list(Hwaddr) ->
+ check_ifopts(Opts, Ifopts#ifopts{hwaddr=Hwaddr});
+check_ifopts([{hwaddr,HwAddr}|_], #ifopts{}=Ifopts) ->
+ ?t:fail({multiple_hwaddrs,HwAddr,Ifopts}).
+
%% Works just like lists:member/2, except that any {127,_,_,_} tuple
%% matches any other {127,_,_,_}. We do this to handle Linux systems
%% that use (for instance) 127.0.1.1 as the IP address for the hostname.
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 ace9501d18..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
@@ -204,8 +238,9 @@ evil(Config) when is_list(Config) ->
evil_loop(Parent, ?EVIL_LOOPS,N)
end)
end, lists:seq(1, ?EVIL_PROCS)),
- Devil = spawn(fun () -> devil(hd(Ps), hd(lists:reverse(Ps))) end),
+ Devil = spawn_link(fun () -> devil(hd(Ps), hd(lists:reverse(Ps))) end),
lists:foreach(fun (P) -> receive {P, done} -> ok end end, Ps),
+ unlink(Devil),
exit(Devil, kill),
test_server:timetrap_cancel(Dog),
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 03fe63e385..e7b71cc168 100644
--- a/lib/kernel/vsn.mk
+++ b/lib/kernel/vsn.mk
@@ -1 +1 @@
-KERNEL_VSN = 2.14.2
+KERNEL_VSN = 2.14.4