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(erlc_SUITE).
21
21
%% Tests the erlc command by compiling various types of files.
23
-export([all/1, compile_erl/1, compile_yecc/1, compile_script/1,
24
compile_mib/1, good_citizen/1, deep_cwd/1]).
26
-include("test_server.hrl").
23
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
24
init_per_group/2,end_per_group/2, compile_erl/1,
25
compile_yecc/1, compile_script/1,
26
compile_mib/1, good_citizen/1, deep_cwd/1, arg_overflow/1]).
28
-include_lib("test_server/include/test_server.hrl").
30
suite() -> [{ct_hooks,[ts_install_cth]}].
29
33
[compile_erl, compile_yecc, compile_script, compile_mib,
30
good_citizen, deep_cwd].
34
good_citizen, deep_cwd, arg_overflow].
39
init_per_suite(Config) ->
42
end_per_suite(_Config) ->
45
init_per_group(_GroupName, Config) ->
48
end_per_group(_GroupName, Config) ->
32
51
%% Copy from erlc_SUITE_data/include/erl_test.hrl.
57
76
?line run(Config, Cmd, FileName, "-W0", ["_OK_"]),
78
%% Try treating warnings as errors.
80
?line run(Config, Cmd, FileName, "-Werror",
81
["compile: warnings being treated as errors\$",
82
"Warning: function foo/0 is unused\$",
59
85
%% Check a bad file.
61
87
?line BadFile = filename:join(SrcDir, "erl_test_bad.erl"),
117
143
?line case test_server:os_type() of
119
145
?line run(Config, Cmd, FileName, "-W +'{verbosity,info}'",
120
["GOOD-MIB.mib: Info. No accessfunction for 'sysDescr'",
146
["\\[GOOD-MIB[.]mib\\]\\[INF\\]: No accessfunction for 'sysDescr' => using default",
122
148
?line true = exists(Output),
123
149
?line ok = file:delete(Output);
182
208
?line true = filelib:is_file("test.beam"),
211
%% Test that a large number of command line switches does not
212
%% overflow the argument buffer
213
arg_overflow(Config) when is_list(Config) ->
214
?line {SrcDir, _OutDir, Cmd} = get_cmd(Config),
215
?line FileName = filename:join(SrcDir, "erl_test_ok.erl"),
216
?line Args = lists:flatten([ ["-D", integer_to_list(N), "=1 "] ||
217
N <- lists:seq(1,10000) ]),
218
?line run(Config, Cmd, FileName, Args,
219
["Warning: function foo/0 is unused\$",
186
224
case os:find_executable("erlc") of