4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
19
19
-module(tar_SUITE).
21
-export([all/1, borderline/1, atomic/1, long_names/1,
21
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
22
init_per_group/2,end_per_group/2, borderline/1, atomic/1, long_names/1,
22
23
create_long_names/1, bad_tar/1, errors/1, extract_from_binary/1,
23
24
extract_from_binary_compressed/1,
24
25
extract_from_open_file/1, symlinks/1, open_add_close/1, cooked_compressed/1,
27
-include("test_server.hrl").
28
-include_lib("test_server/include/test_server.hrl").
28
29
-include_lib("kernel/include/file.hrl").
30
all(suite) -> [borderline, atomic, long_names, create_long_names,
32
extract_from_binary, extract_from_binary_compressed,
33
extract_from_open_file,
34
symlinks, open_add_close, cooked_compressed,
31
suite() -> [{ct_hooks,[ts_install_cth]}].
34
[borderline, atomic, long_names, create_long_names,
35
bad_tar, errors, extract_from_binary,
36
extract_from_binary_compressed, extract_from_open_file,
37
symlinks, open_add_close, cooked_compressed, memory].
42
init_per_suite(Config) ->
45
end_per_suite(_Config) ->
48
init_per_group(_GroupName, Config) ->
51
end_per_group(_GroupName, Config) ->
38
56
["Test creating, listing and extracting one file from an archive",
183
201
"and uncompressed archives."
184
202
"Also test the 'cooked' option."];
185
203
atomic(suite) -> [];
186
atomic(Config) when list(Config) ->
204
atomic(Config) when is_list(Config) ->
187
205
?line ok = file:set_cwd(?config(priv_dir, Config)),
188
206
?line DataFiles = data_files(),
189
207
?line Names = [Name || {Name,_,_} <- DataFiles],
369
387
case catch erl_tar:format_error(Reason) of
370
388
{'EXIT', CrashReason} ->
371
389
test_server:fail({format_error, crashed, CrashReason});
372
String when list(String) ->
390
String when is_list(String) ->
373
391
io:format("format_error(~p) -> ~s", [Reason, String]);
375
393
test_server:fail({format_error, returned, Other})
413
431
case catch erl_tar:format_error(Error) of
414
432
{'EXIT', FReason} ->
415
433
test_server:fail({format_error, crashed, FReason});
416
String when list(String) ->
434
String when is_list(String) ->
417
435
io:format("format_error(~p) -> ~s", [Error, String]);
419
437
test_server:fail({format_error, returned, Other})
432
450
extract_from_binary(doc) ->
433
451
"Test extracting a tar archive from a binary.";
434
extract_from_binary(Config) when list(Config) ->
452
extract_from_binary(Config) when is_list(Config) ->
435
453
?line DataDir = ?config(data_dir, Config),
436
454
?line PrivDir = ?config(priv_dir, Config),
437
455
?line Long = filename:join(DataDir, "no_fancy_stuff.tar"),