diff options
Diffstat (limited to 'lib/inets/test')
33 files changed, 1311 insertions, 2352 deletions
diff --git a/lib/inets/test/Makefile b/lib/inets/test/Makefile index dfa86906fd..f18db273ec 100644 --- a/lib/inets/test/Makefile +++ b/lib/inets/test/Makefile @@ -151,22 +151,8 @@ MODULES =                 		\  	inets_test_lib    		\  	erl_make_certs                  \  	ftp_SUITE 	  		\ +	ftp_suite_lib			\  	ftp_format_SUITE  		\ -	ftp_solaris8_sparc_test		\ -	ftp_solaris9_sparc_test		\ -	ftp_solaris10_sparc_test	\ -	ftp_solaris10_x86_test		\ -	ftp_linux_x86_test		\ -	ftp_linux_ppc_test		\ -	ftp_macosx_x86_test		\ -	ftp_macosx_ppc_test		\ -	ftp_openbsd_x86_test		\ -	ftp_freebsd_x86_test		\ -	ftp_netbsd_x86_test		\ -	ftp_windows_xp_test		\ -	ftp_windows_2003_server_test	\ -	ftp_suite_lib	  		\ -	ftp_ticket_test			\  	http_format_SUITE 		\  	httpc_SUITE	  		\  	httpc_cookie_SUITE		\ @@ -215,7 +201,7 @@ INETS_FILES = inets.config $(INETS_SPECS)  # 	inets_tftp_suite  INETS_DATADIRS = inets_SUITE_data inets_sup_SUITE_data  -HTTPD_DATADIRS = httpd_test_data httpd_SUITE_data +HTTPD_DATADIRS = httpd_test_data httpd_SUITE_data httpd_basic_SUITE_data  HTTPC_DATADIRS = httpc_SUITE_data httpc_proxy_SUITE_data  FTP_DATADIRS   = ftp_SUITE_data   diff --git a/lib/inets/test/erl_make_certs.erl b/lib/inets/test/erl_make_certs.erl index 5b92e551a5..22dc951ac1 100644 --- a/lib/inets/test/erl_make_certs.erl +++ b/lib/inets/test/erl_make_certs.erl @@ -45,7 +45,7 @@  %%      {dnQualifer, DnQ}  %%   issuer = {Issuer, IssuerKey}                   true (i.e. a ca cert is created)   %%                                                  (obs IssuerKey migth be {Key, Password} -%%   key = KeyFile|KeyBin|rsa|dsa                   Subject PublicKey rsa or dsa generates key +%%   key = KeyFile|KeyBin|rsa|dsa|ec                Subject PublicKey rsa, dsa or ec generates key  %%     %%  %%   (OBS: The generated keys are for testing only) @@ -91,6 +91,16 @@ gen_dsa(LSize,NSize) when is_integer(LSize), is_integer(NSize) ->      {Key, encode_key(Key)}.  %%-------------------------------------------------------------------- +%% @doc Creates a ec key (OBS: for testing only) +%%   the sizes are in bytes +%% @spec (::integer()) -> {::atom(), ::binary(), ::opaque()} +%% @end +%%-------------------------------------------------------------------- +gen_ec(Curve) when is_atom(Curve) -> +    Key = gen_ec2(Curve), +    {Key, encode_key(Key)}. + +%%--------------------------------------------------------------------  %% @doc Verifies cert signatures  %% @spec (::binary(), ::tuple()) -> ::boolean()  %% @end @@ -102,7 +112,10 @@ verify_signature(DerEncodedCert, DerKey, _KeyParams) ->  	    public_key:pkix_verify(DerEncodedCert,   				   #'RSAPublicKey'{modulus=Mod, publicExponent=Exp});  	#'DSAPrivateKey'{p=P, q=Q, g=G, y=Y} -> -	    public_key:pkix_verify(DerEncodedCert, {Y, #'Dss-Parms'{p=P, q=Q, g=G}}) +	    public_key:pkix_verify(DerEncodedCert, {Y, #'Dss-Parms'{p=P, q=Q, g=G}}); +	#'ECPrivateKey'{version = _Version, privateKey = _PrivKey, +			parameters = Params, publicKey = {0, PubKey}} -> +	    public_key:pkix_verify(DerEncodedCert, {#'ECPoint'{point = PubKey}, Params})      end.  %%%%%%%%%%%%%%%%%%%%%%%%% Implementation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,6 +125,7 @@ get_key(Opts) ->  	undefined -> make_key(rsa, Opts);  	rsa ->       make_key(rsa, Opts);  	dsa ->       make_key(dsa, Opts); +	ec ->        make_key(ec, Opts);  	Key ->  	    Password = proplists:get_value(password, Opts, no_passwd),  	    decode_key(Key, Password) @@ -129,6 +143,8 @@ decode_key(#'RSAPrivateKey'{} = Key,_) ->      Key;  decode_key(#'DSAPrivateKey'{} = Key,_) ->      Key; +decode_key(#'ECPrivateKey'{} = Key,_) -> +    Key;  decode_key(PemEntry = {_,_,_}, Pw) ->      public_key:pem_entry_decode(PemEntry, Pw);  decode_key(PemBin, Pw) -> @@ -140,7 +156,10 @@ encode_key(Key = #'RSAPrivateKey'{}) ->      {'RSAPrivateKey', Der, not_encrypted};  encode_key(Key = #'DSAPrivateKey'{}) ->      {ok, Der} = 'OTP-PUB-KEY':encode('DSAPrivateKey', Key), -    {'DSAPrivateKey', Der, not_encrypted}. +    {'DSAPrivateKey', Der, not_encrypted}; +encode_key(Key = #'ECPrivateKey'{}) -> +    {ok, Der} = 'OTP-PUB-KEY':encode('ECPrivateKey', Key), +    {'ECPrivateKey', Der, not_encrypted}.  make_tbs(SubjectKey, Opts) ->          Version = list_to_atom("v"++integer_to_list(proplists:get_value(version, Opts, 3))), @@ -277,7 +296,14 @@ publickey(#'RSAPrivateKey'{modulus=N, publicExponent=E}) ->  publickey(#'DSAPrivateKey'{p=P, q=Q, g=G, y=Y}) ->      Algo = #'PublicKeyAlgorithm'{algorithm= ?'id-dsa',   				 parameters={params, #'Dss-Parms'{p=P, q=Q, g=G}}}, -    #'OTPSubjectPublicKeyInfo'{algorithm = Algo, subjectPublicKey = Y}. +    #'OTPSubjectPublicKeyInfo'{algorithm = Algo, subjectPublicKey = Y}; +publickey(#'ECPrivateKey'{version = _Version, +			  privateKey = _PrivKey, +			  parameters = Params, +			  publicKey = {0, PubKey}}) -> +    Algo = #'PublicKeyAlgorithm'{algorithm= ?'id-ecPublicKey', parameters=Params}, +    #'OTPSubjectPublicKeyInfo'{algorithm = Algo, +			       subjectPublicKey = #'ECPoint'{point = PubKey}}.  validity(Opts) ->      DefFrom0 = calendar:gregorian_days_to_date(calendar:date_to_gregorian_days(date())-1), @@ -298,13 +324,24 @@ sign_algorithm(#'RSAPrivateKey'{}, Opts) ->  	   end,      {Type, 'NULL'};  sign_algorithm(#'DSAPrivateKey'{p=P, q=Q, g=G}, _Opts) -> -    {?'id-dsa-with-sha1', {params,#'Dss-Parms'{p=P, q=Q, g=G}}}. +    {?'id-dsa-with-sha1', {params,#'Dss-Parms'{p=P, q=Q, g=G}}}; +sign_algorithm(#'ECPrivateKey'{}, Opts) -> +    Type = case proplists:get_value(digest, Opts, sha1) of +	       sha1 ->   ?'ecdsa-with-SHA1'; +	       sha512 -> ?'ecdsa-with-SHA512'; +	       sha384 -> ?'ecdsa-with-SHA384'; +	       sha256 -> ?'ecdsa-with-SHA256' +	   end, +    {Type, 'NULL'}.  make_key(rsa, _Opts) ->      %% (OBS: for testing only)      gen_rsa2(64);  make_key(dsa, _Opts) -> -    gen_dsa2(128, 20).  %% Bytes i.e. {1024, 160}  +    gen_dsa2(128, 20);  %% Bytes i.e. {1024, 160} +make_key(ec, _Opts) -> +    %% (OBS: for testing only) +    gen_ec2(secp256k1).  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% RSA key generation  (OBS: for testing only) @@ -349,24 +386,37 @@ gen_dsa2(LSize, NSize) ->      X0 = prime(LSize),      P0 = prime((LSize div 2) +1), -    %% Choose L-bit prime modulus P such that p–1 is a multiple of q. +    %% Choose L-bit prime modulus P such that p-1 is a multiple of q.      case dsa_search(X0 div (2*Q*P0), P0, Q, 1000) of  	error ->   	    gen_dsa2(LSize, NSize);  	P ->	     -	    G = crypto:mod_exp(2, (P-1) div Q, P), % Choose G a number whose multiplicative order modulo p is q. -	    %%                 such that This may be done by setting g = h^(p–1)/q mod p, commonly h=2 is used. +	    G = crypto:mod_pow(2, (P-1) div Q, P), % Choose G a number whose multiplicative order modulo p is q. +	    %%                 such that This may be done by setting g = h^(p-1)/q mod p, commonly h=2 is used.  	    X = prime(20),               %% Choose x by some random method, where 0 < x < q. -	    Y = crypto:mod_exp(G, X, P), %% Calculate y = g^x mod p. +	    Y = crypto:mod_pow(G, X, P), %% Calculate y = g^x mod p. -	    #'DSAPrivateKey'{version=0, p=P, q=Q, g=G, y=Y, x=X} +	    #'DSAPrivateKey'{version=0, p = P, q = Q,  +			     g = crypto:bytes_to_integer(G), y = crypto:bytes_to_integer(Y), x = X}      end. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EC key generation  (OBS: for testing only) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +gen_ec2(CurveId) -> +     {PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId), + +    #'ECPrivateKey'{version = 1, +		    privateKey = binary_to_list(PrivKey), +		    parameters = {namedCurve, pubkey_cert_records:namedCurves(CurveId)}, +		    publicKey = {0, PubKey}}. +  %% See fips_186-3.pdf  dsa_search(T, P0, Q, Iter) when Iter > 0 ->      P = 2*T*Q*P0 + 1, -    case is_prime(crypto:mpint(P), 50) of +    case is_prime(P, 50) of  	true -> P;  	false -> dsa_search(T+1, P0, Q, Iter-1)      end; @@ -377,38 +427,40 @@ dsa_search(_,_,_,_) ->  %%%%%%% Crypto Math %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  prime(ByteSize) ->      Rand = odd_rand(ByteSize), -    crypto:erlint(prime_odd(Rand, 0)). +    prime_odd(Rand, 0).  prime_odd(Rand, N) ->      case is_prime(Rand, 50) of  	true ->   	    Rand;  	false ->  -	    NotPrime = crypto:erlint(Rand), -	    prime_odd(crypto:mpint(NotPrime+2), N+1) +	    prime_odd(Rand+2, N+1)      end.  %% see http://en.wikipedia.org/wiki/Fermat_primality_test  is_prime(_, 0) -> true;  is_prime(Candidate, Test) ->  -    CoPrime = odd_rand(<<0,0,0,4, 10000:32>>, Candidate), -    case crypto:mod_exp(CoPrime, Candidate, Candidate) of -	CoPrime -> is_prime(Candidate, Test-1); -	_       -> false -    end. +    CoPrime = odd_rand(10000, Candidate), +    Result = crypto:mod_pow(CoPrime, Candidate, Candidate) , +    is_prime(CoPrime, crypto:bytes_to_integer(Result), Candidate, Test). + +is_prime(CoPrime, CoPrime, Candidate, Test) -> +    is_prime(Candidate, Test-1); +is_prime(_,_,_,_) -> +    false.  odd_rand(Size) ->      Min = 1 bsl (Size*8-1),      Max = (1 bsl (Size*8))-1, -    odd_rand(crypto:mpint(Min), crypto:mpint(Max)). +    odd_rand(Min, Max).  odd_rand(Min,Max) -> -    Rand = <<Sz:32, _/binary>> = crypto:rand_uniform(Min,Max), -    BitSkip = (Sz+4)*8-1, -    case Rand of -	Odd  = <<_:BitSkip,  1:1>> -> Odd; -	Even = <<_:BitSkip,  0:1>> ->  -	    crypto:mpint(crypto:erlint(Even)+1) +    Rand = crypto:rand_uniform(Min,Max), +    case Rand rem 2 of +	0 ->  +	    Rand + 1; +	_ ->  +	    Rand      end.  extended_gcd(A, B) -> @@ -427,3 +479,4 @@ pem_to_der(File) ->  der_to_pem(File, Entries) ->      PemBin = public_key:pem_encode(Entries),      file:write_file(File, PemBin). + diff --git a/lib/inets/test/ftp_SUITE.erl b/lib/inets/test/ftp_SUITE.erl index 17e5f6777e..e39f9f1eb6 100644 --- a/lib/inets/test/ftp_SUITE.erl +++ b/lib/inets/test/ftp_SUITE.erl @@ -1,7 +1,7 @@  %%  %% %CopyrightBegin%  %%  -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. 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,110 +18,803 @@  %%  %% +%%  +%% ct:run("../inets_test", ftp_SUITE). +%% +  -module(ftp_SUITE). +-include_lib("kernel/include/file.hrl").  -include_lib("common_test/include/ct.hrl"). --include("test_server_line.hrl"). +-include("inets_test_lib.hrl"). -%% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). -% -export([init_per_testcase/2, end_per_testcase/2]). --export([init_per_suite/1, end_per_suite/1]). +%% Note: This directive should only be used in test suites. +-compile(export_all).  -define(FTP_USER, "anonymous"). --define(FTP_PASS, passwd()). --define(FTP_PORT, 21). +-define(FTP_PASS(Cmnt), (fun({ok,__H}) -> "ftp_SUITE_"++Cmnt++"@" ++ __H; +			    (_) -> "ftp_SUITE_"++Cmnt++"@localhost" +			 end)(inet:gethostname()) +       ).  -define(BAD_HOST, "badhostname").  -define(BAD_USER, "baduser").  -define(BAD_DIR,  "baddirectory"). --ifdef(ftp_debug_client). --define(ftp_open(Host, Flags), do_ftp_open(Host, [debug] ++ Flags)). --else. --ifdef(ftp_trace_client). --define(ftp_open(Host, Flags), do_ftp_open(Host, [trace] ++ Flags)). --else. --define(ftp_open(Host, Flags), do_ftp_open(Host, [verbose] ++ Flags)). --endif. --endif. - +go() -> ct:run_test([{suite,"ftp_SUITE"}, {logdir,"LOG"}]). +gos() -> ct:run_test([{suite,"ftp_SUITE"}, {group,ftps_passive}, {logdir,"LOG"}]).  %%-------------------------------------------------------------------- -%% all(Arg) -> [Doc] | [Case] | {skip, Comment} -%% Arg - doc | suite -%% Doc - string() -%% Case - atom()  -%%	Name of a test case function.  -%% Comment - string() -%% Description: Returns documentation/test cases in this test suite -%%		or a skip tuple if the platform is not supported.   +%% Common Test interface functions -----------------------------------  %%-------------------------------------------------------------------- -suite() -> [{ct_hooks, [ts_install_cth]}]. +all() -> +    [ +     {group, ftp_passive}, +     {group, ftp_active}, +     {group, ftps_passive}, +     {group, ftps_active} +    ]. -all() ->  +groups() ->      [ -     {group, solaris8_test},    -     {group, solaris9_test}, -     {group, solaris10_test},  -     {group, linux_x86_test}, -     {group, linux_ppc_test},  -     {group, macosx_x86_test}, -     {group, macosx_ppc_test},  -     {group, openbsd_test}, -     {group, freebsd_test},  -     {group, netbsd_test}, -     {group, windows_xp_test}, -     {group, windows_2003_server_test}, -     {group, ticket_tests} +     {ftp_passive, [], ftp_tests()}, +     {ftp_active, [], ftp_tests()}, +     {ftps_passive, [], ftp_tests()}, +     {ftps_active, [], ftp_tests()}      ]. -groups() ->  +ftp_tests()->      [ -     {solaris8_test,            [], [{ftp_solaris8_sparc_test, all}]}, -     {solaris9_test,            [], [{ftp_solaris9_sparc_test, all}]}, -     {solaris10_test,           [], [{ftp_solaris10_sparc_test, all}, -				     {ftp_solaris10_x86_test, all}]}, -     {linux_x86_test,           [], [{ftp_linux_x86_test, all}]}, -     {linux_ppc_test,           [], [{ftp_linux_ppc_test, all}]}, -     {macosx_x86_test,          [], [{ftp_macosx_x86_test, all}]}, -     {macosx_ppc_test,          [], [{ftp_macosx_ppc_test, all}]}, -     {openbsd_test,             [], [{ftp_openbsd_x86_test, all}]}, -     {freebsd_test,             [], [{ftp_freebsd_x86_test, all}]}, -     {netbsd_test,              [], [{ftp_netbsd_x86_test, all}]}, -     {windows_xp_test,          [], [{ftp_windows_xp_test, all}]}, -     {windows_2003_server_test, [], [{ftp_windows_2003_server_test, all}]}, -     {ticket_tests,             [], [{ftp_ticket_test, all}]} +     user, +     bad_user, +     pwd,  +     cd,  +     lcd, +     ls,  +     nlist,  +     rename,  +     delete,  +     mkdir,  +     rmdir, +     send,  +     send_3, +     send_bin,  +     send_chunk,  +     append,  +     append_bin, +     append_chunk,  +     recv,  +     recv_3,  +     recv_bin,  +     recv_chunk,  +     type,  +     quote,  +     ip_v6_disabled      ]. -init_per_group(_GroupName, Config) -> -	Config. +%%-------------------------------------------------------------------- + +%%% Config +%%% key			meaning +%%% ................................................................ +%%% ftpservers		list of servers to check if they are available +%%%			The element is: +%%%			  {Name,         % string(). The os command name +%%%			   StartCommand, % fun()->{ok,start_result()} | {error,string()}. +%%%			                 % The command to start the daemon with. +%%%			   ChkUp,        % fun(start_result()) -> string(). Os command to check +%%%			                 %       if the server is running. [] if not running. +%%%			                 %       The string in string() is suitable for logging. +%%%			   StopCommand,  % fun(start_result()) -> void(). The command to stop the daemon with. +%%%			   AugmentFun,   % fun(config()) -> config() Adds two funs for transforming names of files +%%%			                 %       and directories to the form they are returned from this server +%%%			   ServerHost,   % string(). Mostly "localhost" +%%%			   ServerPort    % pos_integer() +%%%			  } +%%%			   + +-define(default_ftp_servers, +	[{"vsftpd", +	  fun(__CONF__) ->  +		  DataDir = ?config(data_dir,__CONF__), +		  ConfFile = filename:join(DataDir, "vsftpd.conf"), +		  PrivDir = ?config(priv_dir,__CONF__), +		  AnonRoot = PrivDir, +		  Cmd = ["vsftpd "++filename:join(DataDir,"vsftpd.conf"), +			 " -oftpd_banner=erlang_otp_testing", +			 " -oanon_root=\"",AnonRoot,"\"", +			 " -orsa_cert_file=\"",filename:join(DataDir,"server-cert.pem"),"\"", +			 " -orsa_private_key_file=\"",filename:join(DataDir,"server-key.pem"),"\"" +			], +		  Result = os:cmd(Cmd), +		  ct:log("Config file:~n~s~n~nServer start command:~n  ~s~nResult:~n  ~p", +			 [case file:read_file(ConfFile) of +			      {ok,X} -> X; +			      _ -> "" +			  end, +			  Cmd, Result +			 ]), +		  case Result of +		      [] -> {ok,'dont care'}; +		      [Msg] -> {error,Msg} +		  end +	  end, +	  fun(_StartResult) -> os:cmd("ps ax | grep erlang_otp_testing | grep -v grep") +	  end, +	  fun(_StartResult) -> os:cmd("kill `ps ax | grep erlang_otp_testing | awk '/vsftpd/{print $1}'`") +	  end, +	  fun(__CONF__) -> +		  AnonRoot = ?config(priv_dir,__CONF__), +		  [{id2ftp, fun(Id) -> filename:join(AnonRoot,Id) end}, +		   {id2ftp_result,fun(Id) -> filename:join(AnonRoot,Id) end} | __CONF__] +	  end, +	  "localhost", +	  9999 +	 } +	] +       ). -end_per_group(_GroupName, Config) -> -	Config. +init_per_suite(Config) -> +    case find_executable(Config) of +	false ->  +	    {skip, "No ftp server found"}; +	{ok,Data} ->  +	    TstDir = filename:join(?config(priv_dir,Config), "test"), +	    file:make_dir(TstDir), +	    make_cert_files(dsa, rsa, "server-", ?config(data_dir,Config)), +	    start_ftpd([{test_dir,TstDir}, +			{ftpd_data,Data} +			| Config]) +    end. + +end_per_suite(Config) -> +    ps_ftpd(Config), +    stop_ftpd(Config), +    ps_ftpd(Config), +    ok. + +%%-------------------------------------------------------------------- +init_per_group(_Group, Config) -> Config. +     +end_per_group(_Group, Config) -> Config. +%%-------------------------------------------------------------------- +init_per_testcase(Case, Config0) ->  +    Group = proplists:get_value(name,?config(tc_group_properties,Config0)), +    try ?MODULE:Case(doc) of +	Msg -> ct:comment(Msg) +    catch +	_:_-> ok +    end, +    TLS = [{tls,[{reuse_sessions,true}]}], +    ACTIVE = [{mode,active}], +    PASSIVE = [{mode,passive}], +    ExtraOpts = [verbose], +    Config = +	case Group of +	    ftp_active   -> ftp__open(Config0,       ACTIVE  ++ExtraOpts); +	    ftps_active  -> ftp__open(Config0, TLS++ ACTIVE  ++ExtraOpts); +	    ftp_passive  -> ftp__open(Config0,      PASSIVE  ++ExtraOpts); +	    ftps_passive -> ftp__open(Config0, TLS++PASSIVE  ++ExtraOpts) +	end, +    case Case of +	user -> Config; +	bad_user -> Config; +	_ -> +	    Pid = ?config(ftp,Config), +	    ok = ftp:user(Pid, ?FTP_USER, ?FTP_PASS(atom_to_list(Group)++"-"++atom_to_list(Case)) ), +	    ok = ftp:cd(Pid, ?config(priv_dir,Config)), +	    Config +    end. +     +end_per_testcase(user, _Config) -> ok; +end_per_testcase(bad_user, _Config) -> ok; +end_per_testcase(_Case, Config) ->  +    case ?config(tc_status,Config) of +	ok -> ok; +	_ -> +	    try ftp:latest_ctrl_response(?config(ftp,Config)) +	    of +		{ok,S} -> ct:log("***~n*** Latest ctrl channel response:~n***     ~p~n***",[S]) +	    catch +		_:_ -> ok +	    end +    end, +    ftp__close(Config).  %%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite +%% Test Cases -------------------------------------------------------- +%%-------------------------------------------------------------------- +user(doc) -> ["Open an ftp connection to a host, and logon as anonymous ftp, then logoff"]; +user(Config) -> +    Pid = ?config(ftp, Config), +    ok = ftp:user(Pid, ?FTP_USER, ?FTP_PASS("")),% logon +    ok = ftp:close(Pid),			% logoff +    {error,eclosed} = ftp:pwd(Pid),		% check logoff result +    ok. + +%%------------------------------------------------------------------------- +bad_user(doc) -> ["Open an ftp connection to a host, and logon with bad user."]; +bad_user(Config) -> +    Pid = ?config(ftp, Config), +    {error, euser} = ftp:user(Pid, ?BAD_USER, ?FTP_PASS("")), +    ok. + +%%------------------------------------------------------------------------- +pwd(doc) -> ["Test ftp:pwd/1 & ftp:lpwd/1"]; +pwd(Config0) -> +    Config = set_state([reset], Config0), +    Pid = ?config(ftp, Config), +    {ok, PWD} = ftp:pwd(Pid), +    {ok, PathLpwd} = ftp:lpwd(Pid), +    PWD = id2ftp_result("", Config), +    PathLpwd = id2ftp_result("", Config). + +%%------------------------------------------------------------------------- +cd(doc) -> ["Open an ftp connection, log on as anonymous ftp, and cd to a" +	    "directory and to a non-existent directory."]; +cd(Config0) -> +    Dir = "test", +    Config = set_state([reset,{mkdir,Dir}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:cd(Pid, id2ftp(Dir,Config)), +    {ok, PWD} = ftp:pwd(Pid), +    ExpectedPWD = id2ftp_result(Dir, Config), +    PWD = ExpectedPWD, +    {error, epath} = ftp:cd(Pid, ?BAD_DIR). + +%%------------------------------------------------------------------------- +lcd(doc) -> +    ["Test api function ftp:lcd/2"]; +lcd(Config0) -> +    Dir = "test", +    Config = set_state([reset,{mkdir,Dir}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:lcd(Pid, id2ftp(Dir,Config)), +    {ok, PWD} = ftp:lpwd(Pid), +    ExpectedPWD = id2ftp_result(Dir, Config), +    PWD = ExpectedPWD, +    {error, epath} = ftp:lcd(Pid, ?BAD_DIR). + +%%------------------------------------------------------------------------- +ls(doc) -> ["Open an ftp connection; ls the current directory, and the " +	    "\"test\" directory. We assume that ls never fails, since " +	    "it's output is meant to be read by humans. "]; +ls(Config0) -> +    Config = set_state([reset,{mkdir,"test"}], Config0), +    Pid = ?config(ftp, Config), +    {ok, _R1} = ftp:ls(Pid), +    {ok, _R2} = ftp:ls(Pid, id2ftp("test",Config)), +    %% neither nlist nor ls operates on a directory +    %% they operate on a pathname, which *can* be a  +    %% directory, but can also be a filename or a group  +    %% of files (including wildcards). +    case ?config(wildcard_support, Config) of +	true -> +	    {ok, _R3} = ftp:ls(Pid, id2ftp("te*",Config)); +	_ -> +	    ok +    end. + +%%------------------------------------------------------------------------- +nlist(doc) -> ["Open an ftp connection; nlist the current directory, and the " +	       "\"test\" directory. Nlist does not behave consistenly over " +	       "operating systems. On some it is an error to have an empty " +	       "directory."]; +nlist(Config0) -> +    Config = set_state([reset,{mkdir,"test"}], Config0), +    Pid = ?config(ftp, Config), +    {ok, _R1} = ftp:nlist(Pid), +    {ok, _R2} = ftp:nlist(Pid, id2ftp("test",Config)), +    %% neither nlist nor ls operates on a directory +    %% they operate on a pathname, which *can* be a  +    %% directory, but can also be a filename or a group  +    %% of files (including wildcards). +    case ?config(wildcard_support, Config) of +	true -> +	    {ok, _R3} = ftp:nlist(Pid, id2ftp("te*",Config)); +	_ -> +	    ok +    end. + +%%------------------------------------------------------------------------- +rename(doc) -> ["Rename a file."]; +rename(Config0) -> +    Contents = <<"ftp_SUITE test ...">>, +    OldFile = "old.txt", +    NewFile = "new.txt", +    Config = set_state([reset,{mkfile,OldFile,Contents}], Config0), +    Pid = ?config(ftp, Config), + +    ok = ftp:rename(Pid,  +		    id2ftp(OldFile,Config), +		    id2ftp(NewFile,Config)), + +    true = (chk_file(NewFile,Contents,Config)  +	    and chk_no_file([OldFile],Config)). + + +%%------------------------------------------------------------------------- +send(doc) -> ["Transfer a file with ftp using send/2."]; +send(Config0) -> +    Contents = <<"ftp_SUITE test ...">>, +    SrcDir = "data", +    File = "file.txt", +    Config = set_state([reset,{mkfile,[SrcDir,File],Contents}], Config0), +    Pid = ?config(ftp, Config), + +chk_no_file([File],Config), +chk_file([SrcDir,File],Contents,Config), + +    ok = ftp:lcd(Pid, id2ftp(SrcDir,Config)), +    ok = ftp:cd(Pid, id2ftp("",Config)), +    ok = ftp:send(Pid, File), + +    chk_file(File, Contents, Config). + +%%------------------------------------------------------------------------- +send_3(doc) -> ["Transfer a file with ftp using send/3."]; +send_3(Config0) -> +    Contents = <<"ftp_SUITE test ...">>, +    Dir = "incoming", +    File = "file.txt", +    RemoteFile = "remfile.txt", +    Config = set_state([reset,{mkfile,File,Contents},{mkdir,Dir}], Config0), +    Pid = ?config(ftp, Config), + +    ok = ftp:cd(Pid, id2ftp(Dir,Config)), +    ok = ftp:lcd(Pid, id2ftp("",Config)), +    ok = ftp:send(Pid, File, RemoteFile), + +    chk_file([Dir,RemoteFile], Contents, Config). + +%%-------------------------------------------------------------------------  +send_bin(doc) -> ["Send a binary."]; +send_bin(Config0) -> +    BinContents = <<"ftp_SUITE test ...">>, +    File = "file.txt", +    Config = set_state([reset], Config0), +    Pid = ?config(ftp, Config), +    {error, enotbinary} = ftp:send_bin(Pid, "some string", id2ftp(File,Config)), +    ok = ftp:send_bin(Pid, BinContents, id2ftp(File,Config)), +    chk_file(File, BinContents, Config). + +%%-------------------------------------------------------------------------     +send_chunk(doc) -> ["Send a binary using chunks."]; +send_chunk(Config0) -> +    Contents = <<"ftp_SUITE test ...">>, +    File = "file.txt", +    Config = set_state([reset,{mkdir,"incoming"}], Config0), +    Pid = ?config(ftp, Config), + +    ok = ftp:send_chunk_start(Pid, id2ftp(File,Config)), +    {error, echunk} = ftp:cd(Pid, "incoming"), +    {error, enotbinary} = ftp:send_chunk(Pid, "some string"), +    ok = ftp:send_chunk(Pid, Contents), +    ok = ftp:send_chunk(Pid, Contents), +    ok = ftp:send_chunk_end(Pid), +    chk_file(File, <<Contents/binary,Contents/binary>>, Config). + +%%------------------------------------------------------------------------- +delete(doc) -> ["Delete a file."]; +delete(Config0) -> +    Contents = <<"ftp_SUITE test ...">>, +    File = "file.txt", +    Config = set_state([reset,{mkfile,File,Contents}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:delete(Pid, id2ftp(File,Config)), +    chk_no_file([File], Config). + +%%------------------------------------------------------------------------- +mkdir(doc) -> ["Make a remote directory."]; +mkdir(Config0) -> +    NewDir = "new_dir", +    Config = set_state([reset], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:mkdir(Pid, id2ftp(NewDir,Config)), +    chk_dir([NewDir], Config). + +%%------------------------------------------------------------------------- +rmdir(doc) -> ["Remove a directory."]; +rmdir(Config0) -> +    Dir = "dir", +    Config = set_state([reset,{mkdir,Dir}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:rmdir(Pid, id2ftp(Dir,Config)), +    chk_no_dir([Dir], Config). + +%%------------------------------------------------------------------------- +append(doc) -> ["Append a local file twice to a remote file"]; +append(Config0) -> +    SrcFile = "f_src.txt", +    DstFile = "f_dst.txt", +    Contents = <<"ftp_SUITE test ...">>, +    Config = set_state([reset,{mkfile,SrcFile,Contents}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:append(Pid, id2ftp(SrcFile,Config), id2ftp(DstFile,Config)), +    ok = ftp:append(Pid, id2ftp(SrcFile,Config), id2ftp(DstFile,Config)), +    chk_file(DstFile, <<Contents/binary,Contents/binary>>, Config). +		 +%%------------------------------------------------------------------------- +append_bin(doc) -> ["Append a local file twice to a remote file using append_bin"]; +append_bin(Config0) -> +    DstFile = "f_dst.txt", +    Contents = <<"ftp_SUITE test ...">>, +    Config = set_state([reset], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:append_bin(Pid, Contents, id2ftp(DstFile,Config)), +    ok = ftp:append_bin(Pid, Contents, id2ftp(DstFile,Config)), +    chk_file(DstFile, <<Contents/binary,Contents/binary>>, Config). + +%%------------------------------------------------------------------------- +append_chunk(doc) -> ["Append chunks."]; +append_chunk(Config0) -> +    File = "f_dst.txt", +    Contents = [<<"ER">>,<<"LE">>,<<"RL">>], +    Config = set_state([reset], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:append_chunk_start(Pid, id2ftp(File,Config)), +    {error, enotbinary} = ftp:append_chunk(Pid, binary_to_list(lists:nth(1,Contents))), +    ok = ftp:append_chunk(Pid,lists:nth(1,Contents)), +    ok = ftp:append_chunk(Pid,lists:nth(2,Contents)), +    ok = ftp:append_chunk(Pid,lists:nth(3,Contents)), +    ok = ftp:append_chunk_end(Pid), +    chk_file(File, <<"ERLERL">>, Config). + +%%------------------------------------------------------------------------- +recv(doc) -> ["Receive a file using recv/2"]; +recv(Config0) -> +    File = "f_dst.txt", +    SrcDir = "a_dir", +    Contents = <<"ftp_SUITE test ...">>, +    Config = set_state([reset, {mkfile,[SrcDir,File],Contents}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:cd(Pid, id2ftp(SrcDir,Config)), +    ok = ftp:lcd(Pid, id2ftp("",Config)), +    ok = ftp:recv(Pid, File), +    chk_file(File, Contents, Config). + +%%------------------------------------------------------------------------- +recv_3(doc) -> ["Receive a file using recv/3"]; +recv_3(Config0) -> +    DstFile = "f_src.txt", +    SrcFile = "f_dst.txt", +    Contents = <<"ftp_SUITE test ...">>, +    Config = set_state([reset, {mkfile,SrcFile,Contents}], Config0), +    Pid = ?config(ftp, Config), +    ok = ftp:cd(Pid, id2ftp("",Config)), +    ok = ftp:recv(Pid, SrcFile, id2abs(DstFile,Config)), +    chk_file(DstFile, Contents, Config). + +%%------------------------------------------------------------------------- +recv_bin(doc) -> ["Receive a file as a binary."]; +recv_bin(Config0) -> +    File = "f_dst.txt", +    Contents = <<"ftp_SUITE test ...">>, +    Config = set_state([reset, {mkfile,File,Contents}], Config0), +    Pid = ?config(ftp, Config), +    {ok,Received} = ftp:recv_bin(Pid, id2ftp(File,Config)), +    find_diff(Received, Contents). + +%%------------------------------------------------------------------------- +recv_chunk(doc) -> ["Receive a file using chunk-wise."]; +recv_chunk(Config0) -> +    File = "big_file.txt", +    Contents = list_to_binary( lists:duplicate(1000, lists:seq(0,255)) ), +    Config = set_state([reset, {mkfile,File,Contents}], Config0), +    Pid = ?config(ftp, Config), +    {{error, "ftp:recv_chunk_start/2 not called"},_} = recv_chunk(Pid, <<>>), +    ok = ftp:recv_chunk_start(Pid, id2ftp(File,Config)), +    {ok, ReceivedContents, _Ncunks} = recv_chunk(Pid, <<>>), +    find_diff(ReceivedContents, Contents). + +recv_chunk(Pid, Acc) -> recv_chunk(Pid, Acc, 0). + +recv_chunk(Pid, Acc, N) -> +    case ftp:recv_chunk(Pid) of +	ok -> {ok, Acc, N}; +	{ok, Bin} -> recv_chunk(Pid, <<Acc/binary, Bin/binary>>, N+1); +	Error -> {Error, N} +    end. + +%%------------------------------------------------------------------------- +type(doc) -> ["Test that we can change btween ASCCI and binary transfer mode"]; +type(Config) -> +    Pid = ?config(ftp, Config), +    ok = ftp:type(Pid, ascii), +    ok = ftp:type(Pid, binary), +    ok = ftp:type(Pid, ascii), +    {error, etype} = ftp:type(Pid, foobar). + +%%------------------------------------------------------------------------- +quote(doc) -> [""]; +quote(Config) -> +    Pid = ?config(ftp, Config), +    ["257 \""++_Rest] = ftp:quote(Pid, "pwd"), %% 257 +    [_| _] = ftp:quote(Pid, "help"), +    %% This negativ test causes some ftp servers to hang. This test +    %% is not important for the client, so we skip it for now. +    %%["425 Can't build data connection: Connection refused."]  +    %% = ftp:quote(Pid, "list"),  +    ok. + + +%%------------------------------------------------------------------------- +ip_v6_disabled(doc) -> ["Test ipv4 command PORT"]; +ip_v6_disabled(_Config) -> +    %%% FIXME!!!! What is this??? +    ok.%% send(Config). + +%%------------------------------------------------------------------------- +%% big_one(doc) -> +%%     ["Create a local file and transfer it to the remote host into the " +%%      "the \"incoming\" directory, remove " +%%      "the local file. Then open a new connection; cd to \"incoming\", " +%%      "lcd to the private directory; receive the file; delete the " +%%      "remote file; close connection; check that received file is in " +%%      "the correct directory; cleanup." ]; +%% big_one(Config) -> +%%     Pid = ?config(ftp, Config), +%%     do_recv(Pid, Config). +  +%% do_recv(Pid, Config) -> +%%     PrivDir = ?config(priv_dir, Config), +%%     File  = ?config(file, Config), +%%     Newfile = ?config(new_file, Config), +%%     AbsFile = filename:absname(File, PrivDir), +%%     Contents = "ftp_SUITE:recv test ...", +%%     ok = file:write_file(AbsFile, list_to_binary(Contents)), +%%     ok = ftp:cd(Pid, "incoming"), +%%     ftp:delete(Pid, File),		% reset +%%     ftp:lcd(Pid, PrivDir), +%%     ok = ftp:send(Pid, File), +%%     ok = file:delete(AbsFile),		% cleanup +%%     test_server:sleep(100), +%%     ok = ftp:lcd(Pid, PrivDir), +%%     ok = ftp:recv(Pid, File), +%%     {ok, Files} = file:list_dir(PrivDir), +%%     true = lists:member(File, Files), +%%     ok = file:delete(AbsFile), % cleanup +%%     ok = ftp:recv(Pid, File, Newfile),  +%%     ok = ftp:delete(Pid, File),		% cleanup +%%     ok. + + +%%-------------------------------------------------------------------- +%% Internal functions  ----------------------------------------------- +%%-------------------------------------------------------------------- + +make_cert_files(Alg1, Alg2, Prefix, Dir) -> +    CaInfo = {CaCert,_} = erl_make_certs:make_cert([{key,Alg1}]), +    {Cert,CertKey} = erl_make_certs:make_cert([{key,Alg2},{issuer,CaInfo}]), +    CaCertFile = filename:join(Dir, Prefix++"cacerts.pem"), +    CertFile = filename:join(Dir, Prefix++"cert.pem"), +    KeyFile = filename:join(Dir, Prefix++"key.pem"), +    der_to_pem(CaCertFile, [{'Certificate', CaCert, not_encrypted}]), +    der_to_pem(CertFile, [{'Certificate', Cert, not_encrypted}]), +    der_to_pem(KeyFile, [CertKey]), +    ok. + +der_to_pem(File, Entries) -> +    PemBin = public_key:pem_encode(Entries), +    file:write_file(File, PemBin). + +%%-------------------------------------------------------------------- +chk_file(Path=[C|_], ExpectedContents, Config) when 0<C,C=<255 -> +    chk_file([Path], ExpectedContents, Config); + +chk_file(PathList, ExpectedContents, Config) -> +    Path = filename:join(PathList), +    AbsPath = id2abs(Path,Config), +    case file:read_file(AbsPath) of +	{ok,ExpectedContents} ->  +	    true; +	{ok,ReadContents} ->  +	    {error,{diff,Pos,RC,LC}} = find_diff(ReadContents, ExpectedContents, 1), +	    ct:log("Bad contents of ~p.~nGot:~n~p~nExpected:~n~p~nDiff at pos ~p ~nRead: ~p~nExp : ~p", +		   [AbsPath,ReadContents,ExpectedContents,Pos,RC,LC]), +	    ct:fail("Bad contents of ~p", [Path]); +	{error,Error} -> +	    try begin +		    {ok,CWD} = file:get_cwd(), +		    ct:log("file:get_cwd()=~p~nfiles:~n~p",[CWD,file:list_dir(CWD)]) +		end +	    of _ -> ok +	    catch _:_ ->ok +	    end, +	    ct:fail("Error reading ~p: ~p",[Path,Error]) +    end. + + +chk_no_file(Path=[C|_], Config) when 0<C,C=<255 -> +    chk_no_file([Path], Config); + +chk_no_file(PathList, Config) -> +    Path = filename:join(PathList), +    AbsPath = id2abs(Path,Config), +    case file:read_file(AbsPath) of +	{error,enoent} ->  +	    true; +	{ok,Contents} ->  +	    ct:log("File ~p exists although it shouldn't. Contents:~n~p", +		   [AbsPath,Contents]), +	    ct:fail("File exists: ~p", [Path]); +	{error,Error} -> +	    ct:fail("Unexpected error reading ~p: ~p",[Path,Error]) +    end. + + +chk_dir(Path=[C|_], Config) when 0<C,C=<255 -> +    chk_dir([Path], Config); + +chk_dir(PathList, Config) -> +    Path = filename:join(PathList), +    AbsPath = id2abs(Path,Config), +    case file:read_file_info(AbsPath) of +	{ok, #file_info{type=directory}} -> +	    true; +	{ok, #file_info{type=Type}} -> +	    ct:fail("Expected dir ~p is a ~p",[Path,Type]); +	{error,Error} -> +	    ct:fail("Expected dir ~p: ~p",[Path,Error]) +    end. + +chk_no_dir(PathList, Config) -> +    Path = filename:join(PathList), +    AbsPath = id2abs(Path,Config), +    case file:read_file_info(AbsPath) of +	{error,enoent} -> +	    true; +	{ok, #file_info{type=directory}} -> +	    ct:fail("Dir ~p erroneously exists",[Path]); +	{ok, #file_info{type=Type}} -> +	    ct:fail("~p ~p erroneously exists",[Type,Path]); +	{error,Error} -> +	    ct:fail("Unexpected error for ~p: ~p",[Path,Error]) +    end. + + +%%-------------------------------------------------------------------- +%%-------------------------------------------------------------------- +%% find a suitable ftpd  %% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. +find_executable(Config) -> +    FTPservers = case ?config(ftpservers,Config) of +		     undefined -> ?default_ftp_servers; +		     L -> L +		 end, +    case lists:dropwhile(fun not_available/1, FTPservers) of +	[] -> false; +	[FTPD_data|_] -> {ok, FTPD_data} +    end. + +not_available({Name,_StartCmd,_ChkUp,_StopCommand,_ConfigUpd,_Host,_Port}) -> +    os:find_executable(Name) == false. +  %%-------------------------------------------------------------------- -init_per_suite(Config) -> -    inets:start(), +%% start/stop of ftpd +%% +start_ftpd(Config) -> +    {Name,StartCmd,_ChkUp,_StopCommand,ConfigRewrite,Host,Port} = ?config(ftpd_data, Config), +    case StartCmd(Config) of +	{ok,StartResult} -> +	    [{ftpd_host,Host}, +	     {ftpd_port,Port}, +	     {ftpd_start_result,StartResult} | ConfigRewrite(Config)]; +	{error,Msg} -> +	    {skip, [Name," not started: ",Msg]} +    end. + +stop_ftpd(Config) -> +    {_Name,_StartCmd,_ChkUp,StopCommand,_ConfigUpd,_Host,_Port} = ?config(ftpd_data, Config), +    StopCommand(?config(ftpd_start_result,Config)). + +ps_ftpd(Config) -> +    {_Name,_StartCmd,ChkUp,_StopCommand,_ConfigUpd,_Host,_Port} = ?config(ftpd_data, Config), +    ct:log( ChkUp(?config(ftpd_start_result,Config)) ). + + +ftpd_running(Config) -> +    {_Name,_StartCmd,ChkUp,_StopCommand,_ConfigUpd,_Host,_Port} = ?config(ftpd_data, Config), +    ChkUp(?config(ftpd_start_result,Config)). + +%%-------------------------------------------------------------------- +%% start/stop of ftpc +%% +ftp__open(Config, Options) -> +    Host = ?config(ftpd_host,Config), +    Port = ?config(ftpd_port,Config), +    ct:log("Host=~p, Port=~p",[Host,Port]), +    {ok,Pid} = ftp:open(Host, [{port,Port} | Options]), +    [{ftp,Pid}|Config]. + +ftp__close(Config) -> +    ok = ftp:close(?config(ftp,Config)),      Config.  %%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite +%% +split(Cs) -> string:tokens(Cs, "\r\n"). + +%%-------------------------------------------------------------------- +%% +find_diff(Bin1, Bin2) ->  +    case find_diff(Bin1, Bin2, 1) of +	{error, {diff,Pos,RC,LC}} -> +	    ct:log("Contents differ at position ~p.~nOp1: ~p~nOp2: ~p",[Pos,RC,LC]), +	    ct:fail("Contents differ at pos ~p",[Pos]); +	Other -> +	    Other +    end. + +find_diff(A, A, _) -> true; +find_diff(<<H,T1/binary>>, <<H,T2/binary>>, Pos) -> find_diff(T1, T2, Pos+1); +find_diff(RC, LC, Pos) -> {error, {diff, Pos, RC, LC}}.  %%-------------------------------------------------------------------- -end_per_suite(_Config) -> -    inets:stop(), -    ok. +%% +set_state(Ops, Config) when is_list(Ops) -> lists:foldl(fun set_state/2, Config, Ops); + +set_state(reset, Config) ->  +    rm('*', id2abs("",Config)), +    PrivDir = ?config(priv_dir,Config), +    file:set_cwd(PrivDir), +    ftp:lcd(?config(ftp,Config),PrivDir), +    set_state({mkdir,""},Config); +set_state({mkdir,Id}, Config) -> +    Abs = id2abs(Id, Config), +    mk_path(Abs), +    file:make_dir(Abs), +    Config; +set_state({mkfile,Id,Contents}, Config) -> +    Abs = id2abs(Id, Config), +    mk_path(Abs), +    ok = file:write_file(Abs, Contents), +    Config. + +mk_path(Abs) -> lists:foldl(fun mk_path/2, [], filename:split(filename:dirname(Abs))). + +mk_path(F, Pfx) -> +    case file:read_file_info(AbsName=filename:join(Pfx,F)) of +	{ok,#file_info{type=directory}} -> +	    AbsName; +	{error,eexist} -> +	    AbsName; +	{error,enoent} -> +	    ok = file:make_dir(AbsName), +	    AbsName +    end. +     + +rm('*', Pfx) -> +    {ok,Fs} = file:list_dir(Pfx), +    lists:foreach(fun(F) -> rm(F, Pfx) end, Fs); +rm(F, Pfx) ->  +    case file:read_file_info(AbsName=filename:join(Pfx,F)) of +	{ok,#file_info{type=directory}} -> +	    {ok,Fs} = file:list_dir(AbsName), +	    lists:foreach(fun(F1) -> rm(F1,AbsName) end, Fs), +	    ok = file:del_dir(AbsName); + +	{ok,#file_info{type=regular}} -> +	    ok = file:delete(AbsName); + +	{error,enoent} -> +	    ok +    end. + +%%-------------------------------------------------------------------- +%% + +id2abs(Id, Conf) -> filename:join(?config(priv_dir,Conf),ids(Id)). +id2ftp(Id, Conf) -> (?config(id2ftp,Conf))(ids(Id)). +id2ftp_result(Id, Conf) -> (?config(id2ftp_result,Conf))(ids(Id)). + +ids([[_|_]|_]=Ids) -> filename:join(Ids); +ids(Id) -> Id. + + +is_expected_absName(Id, File, Conf) -> File = (?config(id2abs,Conf))(Id). +is_expected_ftpInName(Id, File, Conf) -> File = (?config(id2ftp,Conf))(Id). +is_expected_ftpOutName(Id, File, Conf) -> File = (?config(id2ftp_result,Conf))(Id). diff --git a/lib/inets/test/ftp_SUITE_data/vsftpd.conf b/lib/inets/test/ftp_SUITE_data/vsftpd.conf new file mode 100644 index 0000000000..a5584f5916 --- /dev/null +++ b/lib/inets/test/ftp_SUITE_data/vsftpd.conf @@ -0,0 +1,26 @@ + +### +### Some parameters are given in the vsftpd start command. +###  +### Typical command-line paramters are such that has a file path +### component like cert files. +### + + +listen=YES +listen_port=9999 +run_as_launching_user=YES +ssl_enable=YES +allow_anon_ssl=YES + +background=YES + +write_enable=YES +anonymous_enable=YES +anon_upload_enable=YES +anon_mkdir_write_enable=YES +anon_other_write_enable=YES +anon_world_readable_only=NO + +### Shouldn't be necessary.... +require_ssl_reuse=NO diff --git a/lib/inets/test/ftp_freebsd_x86_test.erl b/lib/inets/test/ftp_freebsd_x86_test.erl deleted file mode 100644 index 1d66779882..0000000000 --- a/lib/inets/test/ftp_freebsd_x86_test.erl +++ /dev/null @@ -1,160 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_freebsd_x86_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Freebsd x86 "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(freebsd_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_linux_ppc_test.erl b/lib/inets/test/ftp_linux_ppc_test.erl deleted file mode 100644 index bba97237f1..0000000000 --- a/lib/inets/test/ftp_linux_ppc_test.erl +++ /dev/null @@ -1,158 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_linux_ppc_test). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Linux ppc "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(linux_ppc, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). diff --git a/lib/inets/test/ftp_linux_x86_test.erl b/lib/inets/test/ftp_linux_x86_test.erl deleted file mode 100644 index bbefd8231e..0000000000 --- a/lib/inets/test/ftp_linux_x86_test.erl +++ /dev/null @@ -1,160 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_linux_x86_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Linux x86 "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(linux_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_macosx_ppc_test.erl b/lib/inets/test/ftp_macosx_ppc_test.erl deleted file mode 100644 index c9f33b8beb..0000000000 --- a/lib/inets/test/ftp_macosx_ppc_test.erl +++ /dev/null @@ -1,159 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_macosx_ppc_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Macosx ppc "). - - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(macosx_ppc, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -[open, open_port, {group, passive}, {group, active}, - api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, - {active, [], ftp_suite_lib:active(suite)}, - {progress_report, [], -  ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -	Config. - -end_per_group(_GroupName, Config) -> -	Config. - - - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(_X) -> {skipped,"unknown error"}.%?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(_X) -> {skipped,"unknown error"}.%%?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_macosx_x86_test.erl b/lib/inets/test/ftp_macosx_x86_test.erl deleted file mode 100644 index 17b7160b95..0000000000 --- a/lib/inets/test/ftp_macosx_x86_test.erl +++ /dev/null @@ -1,159 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_macosx_x86_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Macosx x86 "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(macosx_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -[open, open_port, {group, passive}, {group, active}, - api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, - {active, [], ftp_suite_lib:active(suite)}, - {progress_report, [], -  ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -	Config. - -end_per_group(_GroupName, Config) -> -	Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist([{wildcard_support, false} | X]). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist([{wildcard_support, false} | X]).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_netbsd_x86_test.erl b/lib/inets/test/ftp_netbsd_x86_test.erl deleted file mode 100644 index bb474852c5..0000000000 --- a/lib/inets/test/ftp_netbsd_x86_test.erl +++ /dev/null @@ -1,159 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_netbsd_x86_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Netbsd x86 "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(netbsd_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_openbsd_x86_test.erl b/lib/inets/test/ftp_openbsd_x86_test.erl deleted file mode 100644 index 54fce702a0..0000000000 --- a/lib/inets/test/ftp_openbsd_x86_test.erl +++ /dev/null @@ -1,158 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_openbsd_x86_test). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Openbsd x86 "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(openbsd_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). diff --git a/lib/inets/test/ftp_solaris10_sparc_test.erl b/lib/inets/test/ftp_solaris10_sparc_test.erl deleted file mode 100644 index 0da50dc91b..0000000000 --- a/lib/inets/test/ftp_solaris10_sparc_test.erl +++ /dev/null @@ -1,161 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_solaris10_sparc_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Solaris 10 sparc "). - - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(solaris10_sparc, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_solaris10_x86_test.erl b/lib/inets/test/ftp_solaris10_x86_test.erl deleted file mode 100644 index 3e7045bb4d..0000000000 --- a/lib/inets/test/ftp_solaris10_x86_test.erl +++ /dev/null @@ -1,162 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 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 -%% 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% -%% -%% - --module(ftp_solaris10_x86_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD, ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_), ?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM, "Solaris 10 x86 "). - - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(solaris10_x86, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. -%%-------------------------------------------------------------------- - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_solaris8_sparc_test.erl b/lib/inets/test/ftp_solaris8_sparc_test.erl deleted file mode 100644 index 23dbfc8fe3..0000000000 --- a/lib/inets/test/ftp_solaris8_sparc_test.erl +++ /dev/null @@ -1,159 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_solaris8_sparc_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Solaris 8 sparc "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(solaris8_sparc, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X).  -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_solaris9_sparc_test.erl b/lib/inets/test/ftp_solaris9_sparc_test.erl deleted file mode 100644 index 896e2f497f..0000000000 --- a/lib/inets/test/ftp_solaris9_sparc_test.erl +++ /dev/null @@ -1,158 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_solaris9_sparc_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Solaris 9 sparc "). -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(solaris9_sparc, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_ticket_test.erl b/lib/inets/test/ftp_ticket_test.erl deleted file mode 100644 index fe4ab35728..0000000000 --- a/lib/inets/test/ftp_ticket_test.erl +++ /dev/null @@ -1,61 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-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 -%% 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% -%% -%% - --module(ftp_ticket_test). - --compile(export_all). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Solaris 8 sparc "). - - -%% Test server callbacks -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). - -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - - -all() ->  -    tickets(). - -groups() ->  -    []. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -init_per_suite(Config) -> -    ?LIB_MOD:ftpd_init(ticket_test, Config). - -tickets() ->  -    [ticket_6035]. - - -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -ticket_6035(X) -> ?LIB_MOD:ticket_6035(X). diff --git a/lib/inets/test/ftp_windows_2003_server_test.erl b/lib/inets/test/ftp_windows_2003_server_test.erl deleted file mode 100644 index 32f25713f8..0000000000 --- a/lib/inets/test/ftp_windows_2003_server_test.erl +++ /dev/null @@ -1,167 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% 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 -%% 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% -%% -%% - --module(ftp_windows_2003_server_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Windows 2003 server "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(windows_2003_server, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [ -     open,  -     open_port,  -     {group, passive},  -     {group, active}, -     api_missuse,  -     not_owner,  -     {group, progress_report} -    ]. - -groups() ->  -    [ -     {passive,         [], ftp_suite_lib:passive(suite)}, -     {active,          [], ftp_suite_lib:active(suite)}, -     {progress_report, [], ftp_suite_lib:progress_report(suite)} -    ]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -%% Test cases starts here. - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/ftp_windows_xp_test.erl b/lib/inets/test/ftp_windows_xp_test.erl deleted file mode 100644 index 06d919ba00..0000000000 --- a/lib/inets/test/ftp_windows_xp_test.erl +++ /dev/null @@ -1,157 +0,0 @@ -%% -%% %CopyrightBegin% -%%  -%% Copyright Ericsson AB 2005-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 -%% 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% -%% -%% - --module(ftp_windows_xp_test). - --compile(export_all). - --include_lib("common_test/include/ct.hrl"). - --define(LIB_MOD,ftp_suite_lib). --define(CASE_WRAPPER(_A_,_B_,_C_),?LIB_MOD:wrapper(_A_,_B_,_C_)). --define(PLATFORM,"Windows xp "). - -%% Test server callback functions -%%-------------------------------------------------------------------- -%% Function: init_per_suite(Config) -> Config -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Initiation before the whole suite -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%%-------------------------------------------------------------------- -init_per_suite(Config) -> -    {File, NewFile} = ?LIB_MOD:test_filenames(), -    NewConfig = [{file, File}, {new_file, NewFile} | Config], -    ?LIB_MOD:ftpd_init(windows_xp, NewConfig). - -%%-------------------------------------------------------------------- -%% Function: end_per_suite(Config) -> _ -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after the whole suite -%%-------------------------------------------------------------------- -end_per_suite(Config) -> -    ?LIB_MOD:ftpd_fin(Config). - -%%-------------------------------------------------------------------- -%% Function: init_per_testcase(TestCase, Config) -> Config -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% -%% Description: Initiation before each test case -%% -%% Note: This function is free to add any key/value pairs to the Config -%% variable, but should NOT alter/remove any existing entries. -%% Description: Initiation before each test case -%%-------------------------------------------------------------------- -init_per_testcase(Case, Config) -> -    ftp_suite_lib:init_per_testcase(Case, Config). -%%-------------------------------------------------------------------- -%% Function: end_per_testcase(TestCase, Config) -> _ -%% Case - atom() -%%   Name of the test case that is about to be run. -%% Config - [tuple()] -%%   A list of key/value pairs, holding the test case configuration. -%% Description: Cleanup after each test case -%%-------------------------------------------------------------------- -end_per_testcase(Case, Config) -> -    ftp_suite_lib:end_per_testcase(Case, Config). - -%%-------------------------------------------------------------------- -%% Function: all(Clause) -> TestCases -%% Clause - atom() - suite | doc -%% TestCases - [Case]  -%% Case - atom() -%%   Name of a test case. -%% Description: Returns a list of all test cases in this test suite -%%-------------------------------------------------------------------- -all() ->  -    [open, open_port, {group, passive}, {group, active}, -     api_missuse, not_owner, {group, progress_report}]. - -groups() ->  -    [{passive, [], ftp_suite_lib:passive(suite)}, -     {active, [], ftp_suite_lib:active(suite)}, -     {progress_report, [], -      ftp_suite_lib:progress_report(suite)}]. - -init_per_group(_GroupName, Config) -> -    Config. - -end_per_group(_GroupName, Config) -> -    Config. - - -open(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open/1). -open_port(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:open_port/1). -api_missuse(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:api_missuse/1). -not_owner(X) -> ?CASE_WRAPPER(?PLATFORM,X,fun ?LIB_MOD:not_owner/1). - -passive_user(X) -> ?LIB_MOD:passive_user(X). -passive_pwd(X) -> ?LIB_MOD:passive_pwd(X). -passive_cd(X) -> ?LIB_MOD:passive_cd(X). -passive_lcd(X) -> ?LIB_MOD:passive_lcd(X). -passive_ls(X) -> ?LIB_MOD:passive_ls(X). -passive_nlist(X) -> ?LIB_MOD:passive_nlist(X). -passive_rename(X) -> ?LIB_MOD:passive_rename(X). -passive_delete(X) -> ?LIB_MOD:passive_delete(X). -passive_mkdir(X) -> ?LIB_MOD:passive_mkdir(X). -passive_send(X) -> ?LIB_MOD:passive_send(X). -passive_send_bin(X) -> ?LIB_MOD:passive_send_bin(X). -passive_send_chunk(X) -> ?LIB_MOD:passive_send_chunk(X). -passive_append(X) -> ?LIB_MOD:passive_append(X). -passive_append_bin(X) -> ?LIB_MOD:passive_append_bin(X). -passive_append_chunk(X) -> ?LIB_MOD:passive_append_chunk(X). -passive_recv(X) -> ?LIB_MOD:passive_recv(X). -passive_recv_bin(X) -> ?LIB_MOD:passive_recv_bin(X). -passive_recv_chunk(X) -> ?LIB_MOD:passive_recv_chunk(X). -passive_type(X) -> ?LIB_MOD:passive_type(X). -passive_quote(X) -> ?LIB_MOD:passive_quote(X). -passive_ip_v6_disabled(X) -> ?LIB_MOD:passive_ip_v6_disabled(X). -active_user(X) -> ?LIB_MOD:active_user(X).  -active_pwd(X) -> ?LIB_MOD:active_pwd(X).  -active_cd(X) -> ?LIB_MOD:active_cd(X). -active_lcd(X) -> ?LIB_MOD:active_lcd(X).  -active_ls(X) -> ?LIB_MOD:active_ls(X).  -active_nlist(X) -> ?LIB_MOD:active_nlist(X).  -active_rename(X) -> ?LIB_MOD:active_rename(X).  -active_delete(X) -> ?LIB_MOD:active_delete(X).  -active_mkdir(X) -> ?LIB_MOD:active_mkdir(X).  -active_send(X) -> ?LIB_MOD:active_send(X).  -active_send_bin(X) -> ?LIB_MOD:active_send_bin(X).  -active_send_chunk(X) -> ?LIB_MOD:active_send_chunk(X).  -active_append(X) -> ?LIB_MOD:active_append(X).  -active_append_bin(X) -> ?LIB_MOD:active_append_bin(X).  -active_append_chunk(X) -> ?LIB_MOD:active_append_chunk(X).  -active_recv(X) -> ?LIB_MOD:active_recv(X).  -active_recv_bin(X) -> ?LIB_MOD:active_recv_bin(X).  -active_recv_chunk(X) -> ?LIB_MOD:active_recv_chunk(X).  -active_type(X) -> ?LIB_MOD:active_type(X).  -active_quote(X) -> ?LIB_MOD:active_quote(X).  -active_ip_v6_disabled(X) -> ?LIB_MOD:active_ip_v6_disabled(X). -progress_report_send(X) -> ?LIB_MOD:progress_report_send(X). -progress_report_recv(X) -> ?LIB_MOD:progress_report_recv(X). - -fin(Config) -> -    ?LIB_MOD:ftpd_fin(Config). diff --git a/lib/inets/test/http_format_SUITE.erl b/lib/inets/test/http_format_SUITE.erl index 04c7358715..c5920a3968 100644 --- a/lib/inets/test/http_format_SUITE.erl +++ b/lib/inets/test/http_format_SUITE.erl @@ -1,7 +1,7 @@  %%  %% %CopyrightBegin%  %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2013. 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 @@ -35,14 +35,15 @@  	  chunk_decode_trailer/1,  	  http_response/1, http_request/1, validate_request_line/1,  	  esi_parse_headers/1, cgi_parse_headers/1, -	  is_absolut_uri/1, convert_netscapecookie_date/1]). +	  is_absolut_uri/1, convert_netscapecookie_date/1, +	  check_content_length_encoding/1]).  suite() -> [{ct_hooks,[ts_install_cth]}].  all() ->       [{group, chunk}, http_response, http_request,       validate_request_line, {group, script}, is_absolut_uri, -     convert_netscapecookie_date]. +     convert_netscapecookie_date, check_content_length_encoding].  groups() ->       [{script, [], [esi_parse_headers, cgi_parse_headers]}, @@ -456,6 +457,25 @@ validate_request_line(Config) when is_list(Config) ->  	httpd_request:validate("GET", NewForbiddenUri1, "HTTP/1.1"),      ok. + +%%------------------------------------------------------------------------- +check_content_length_encoding(doc) -> +    ["Test http_request:headers/2. Check that the content-length is" +     " encoded even when it is zero." ]; +check_content_length_encoding(suite) -> +    []; +check_content_length_encoding(Config) when is_list(Config) -> + +    %% Check that the content-length is preserved. +    %% Sanity check. +    Header1 = http_request:http_headers(#http_request_h{'content-length'="123"}), +    true = (string:str(Header1, "content-length: 123\r\n") > 0), +    %% Check that content-length=0 is handled correctly. +    Header2 = http_request:http_headers(#http_request_h{'content-length'="0"}), +    true = (string:str(Header2, "content-length: 0\r\n") > 0), + +    ok. +  %%-------------------------------------------------------------------------  esi_parse_headers(doc) ->      ["Test httpd_esi:*. All header values are received in the same" diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 8df5964193..fe6edd504e 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -83,12 +83,14 @@ real_requests()->       stream_through_fun,       stream_through_mfa,       streaming_error, -     inet_opts +     inet_opts, +     invalid_headers      ].  only_simulated() ->      [       cookie, +     cookie_profile,       trace,       stream_once,       no_content_204, @@ -143,6 +145,22 @@ init_per_group(misc = Group, Config) ->      ok = httpc:set_options([{ipfamily, Inet}]),      Config; +init_per_group(Group, Config0) when Group =:= sim_https; Group =:= https-> +    start_apps(Group), +    StartSsl = try ssl:start() +    catch +	Error:Reason -> +	    {skip, lists:flatten(io_lib:format("Failed to start apps for https Error=~p Reason=~p", [Error, Reason]))} +    end, +    case StartSsl of +	{error, {already_started, _}} -> +	    do_init_per_group(Group, Config0); +	ok -> +	    do_init_per_group(Group, Config0); +	_ -> +	    StartSsl +    end; +  init_per_group(Group, Config0) ->      start_apps(Group),      Config = proplists:delete(port, Config0), @@ -151,7 +169,10 @@ init_per_group(Group, Config0) ->  end_per_group(_, _Config) ->      ok. - +do_init_per_group(Group, Config0) -> +    Config = proplists:delete(port, Config0), +    Port = server_start(Group, server_config(Group, Config)), +    [{port, Port} | Config].  %%--------------------------------------------------------------------  init_per_testcase(pipeline, Config) ->      inets:start(httpc, [{profile, pipeline}]), @@ -275,9 +296,6 @@ trace(Config) when is_list(Config) ->  pipeline(Config) when is_list(Config) ->      Request  = {url(group_name(Config), "/dummy.html", Config), []},      {ok, _} = httpc:request(get, Request, [], [], pipeline), -     -    %% Make sure pipeline session is registerd -    test_server:sleep(4000),      keep_alive_requests(Request, pipeline).  %%-------------------------------------------------------------------- @@ -285,9 +303,6 @@ pipeline(Config) when is_list(Config) ->  persistent_connection(Config) when is_list(Config) ->      Request  = {url(group_name(Config), "/dummy.html", Config), []},      {ok, _} = httpc:request(get, Request, [], [], persistent), - -    %% Make sure pipeline session is registerd -    test_server:sleep(4000),      keep_alive_requests(Request, persistent).  %%------------------------------------------------------------------------- @@ -309,13 +324,8 @@ async(Config) when is_list(Config) ->      {ok, NewRequestId} =  	httpc:request(get, Request, [], [{sync, false}]), -    ok = httpc:cancel_request(NewRequestId), -    receive -	{http, {NewRequestId, _}} -> -	    ct:fail(http_cancel_request_failed) -    after 3000 -> -	    ok -    end. +    ok = httpc:cancel_request(NewRequestId). +  %%-------------------------------------------------------------------------  save_to_file() ->      [{doc, "Test to save the http body to a file"}]. @@ -488,9 +498,37 @@ cookie(Config) when is_list(Config) ->      {ok, {{_,200,_}, [_ | _], [_|_]}}  	= httpc:request(get, Request1, [], []), +   [{session_cookies, [_|_]}] = httpc:which_cookies(httpc:default_profile()), +      ets:delete(cookie),      ok = httpc:set_options([{cookies, disabled}]). + + +%%------------------------------------------------------------------------- +cookie_profile() -> +    [{doc, "Test cookies on a non default profile."}]. +cookie_profile(Config) when is_list(Config) ->    +    inets:start(httpc, [{profile, cookie_test}]), +    ok = httpc:set_options([{cookies, enabled}], cookie_test), + +    Request0 = {url(group_name(Config), "/cookie.html", Config), []}, + +    {ok, {{_,200,_}, [_ | _], [_|_]}} +	= httpc:request(get, Request0, [], [], cookie_test), + +    %% Populate table to be used by the "dummy" server +    ets:new(cookie, [named_table, public, set]), +    ets:insert(cookie, {cookies, true}), + +    Request1 = {url(group_name(Config), "/", Config), []}, + +    {ok, {{_,200,_}, [_ | _], [_|_]}} +	= httpc:request(get, Request1, [], [], cookie_test), + +    ets:delete(cookie), +    inets:stop(httpc, cookie_test). +  %%-------------------------------------------------------------------------  headers_as_is(doc) ->      ["Test the option headers_as_is"]; @@ -795,6 +833,10 @@ headers_dummy(Config) when is_list(Config) ->  %%------------------------------------------------------------------------- +invalid_headers(Config) -> +    Request  = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]}, +    {error, _} = httpc:request(get, Request, [], []). +  remote_socket_close(Config) when is_list(Config) ->      URL = url(group_name(Config), "/just_close.html", Config),      {error, socket_closed_remotely} = httpc:request(URL). @@ -1046,6 +1088,8 @@ server_config(_, _) ->  start_apps(https) ->      inets_test_lib:start_apps([crypto, public_key, ssl]); +start_apps(sim_https) -> +    inets_test_lib:start_apps([crypto, public_key, ssl]);  start_apps(_) ->      ok. @@ -1115,7 +1159,7 @@ receive_replys([ID|IDs]) ->  	{http, {ID, {{_, 200, _}, [_|_], _}}} ->  	    receive_replys(IDs);  	{http, {Other, {{_, 200, _}, [_|_], _}}} -> -	    ct:fail({recived_canceld_id, Other}) +	    ct:pal({recived_canceld_id, Other})      end.  %% Perform a synchronous stop @@ -1659,6 +1703,15 @@ receive_streamed_body(RequestId, Body, Pid) ->      ct:print("~p:receive_streamed_body -> requested next stream ~n", [?MODULE]),      receive  	{http, {RequestId, stream, BinBodyPart}} -> +	    %% Make sure the httpc hasn't sent us the next 'stream' +	    %% without our request. +	    receive +		{http, {RequestId, stream, _}} = Msg -> +		    ct:fail({unexpected_flood_of_stream, Msg}) +	    after +		1000 -> +		    ok +	    end,  	    receive_streamed_body(RequestId,  				  <<Body/binary, BinBodyPart/binary>>,  				  Pid); diff --git a/lib/inets/test/httpc_SUITE_data/ssl_client_cert.pem b/lib/inets/test/httpc_SUITE_data/ssl_client_cert.pem index f274d2021d..427447958d 100644 --- a/lib/inets/test/httpc_SUITE_data/ssl_client_cert.pem +++ b/lib/inets/test/httpc_SUITE_data/ssl_client_cert.pem @@ -1,22 +1,31 @@  -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBANz7eFvORmJDi1XJMM2U3uHC5wmp/DXTLMw08XaEvtZ73wgVg84E -V0oyX3Kh1thRE3Hch9AyrHjgpizCj9/Ra38CAwEAAQJACzpz2SZYCTIpaEh6xFdm -I86FcsZCXHHIeu/NvRntoHQ+nfM7Np379+z6XNJWIcWh/QgG/jNJalR1BO+eyc6/ -YQIhAP3m8M0LDxJwSgHFtGAGatQqaqw9l48Kq5xdMFqvdpiHAiEA3s7lld6yCJYu -6q7fZjTH+eKUwgg0vpgJutP7Fsok60kCIHHesQBEhW3vjkFdOZgXSLH+k/jLZr1w -O6bU5GrHZpjhAiEAyTvGYcjDtTunXjDY9l+fadK6FlEBCk8ZIpNIiTnDhHkCIQDr -QxxLLuNHRj8iWNbuVVZ99SJy8zC33pMgPFaFKaZesQ== +MIICXQIBAAKBgQCTFBPkOO98fDY3j6MIxIGKp+rampfIay50Lx4+EnCnRSSVwC+n +0VVmP7V5SGFJpuXJzN0hvqPUWOOjiMTNlNRaGy0pqu2oMXWAPLOxHWL1wT53h2Zr +3FUNU/N0Rvnkttse1KZJ9uYCLKUiuXXsv2rR62nH3OhRIiBHSAcSv0NRWwIDAQAB +AoGACdIVYe/LTeydUihtInC8lZ2QuPgJmoBNocRjqJFipEihoL4scHAx25n1bBvB +I0HZphffzBkGp28oBAtl2LRPWXqu527unc/RWRfLMqSK1xNSq1DxD1a30zkrZPna +QiV65vEJuNSJTtlDy/Zqc/BVZXCpxWlzYQedZgkmf0Qse8ECQQCmaz02Yur8zC9f +eSQKU5OSzGw3bSIumEzziCfHdTheK6MEoccf5TCAyLXhZwA7QlKja4tFXfeyVxws +/LlnUJN9AkEA4j+xnOeYUyGKXL5i+BAbnqpI4MzPiq+IoCYkaRlD/wAws24r5HNI +ZQmEHWqD/NNzOf/A2XuyLtMiTGJPW/DftwJBAKKpJP6Ytuh6xz8BUCnLwO12Y7vV +LtjuQiCzD3aUa5EYA9HOMqxJPxxRkf0LyR0i2VUkE8+sZiPpov+R0cJa7p0CQQCj +40GUiArGRSiF7/+e84QeVfl+pb29F1QftiFv5DZmFEwy3Z572KpbTh5edJbxYHY6 +UDHxGHJFCvnwXNJhpkVXAkBJqfEfiMJ3Q/E5Gpf3sQizacouW92iiN8ojlF1oB80 +t34RysJH7SgI3gdMhTribCo2UUaV0StjR6yodPN+TB2J  -----END RSA PRIVATE KEY-----  -----BEGIN CERTIFICATE----- -MIIB7jCCAZgCAQAwDQYJKoZIhvcNAQEEBQAwgYExCzAJBgNVBAYTAlNFMRIwEAYD -VQQHEwlTdG9ja2hvbG0xETAPBgNVBAoTCEVyaWNzc29uMQwwCgYDVQQLEwNFVFgx -FjAUBgNVBAMTDUhlbGVuIEFpcml5YW4xJTAjBgkqhkiG9w0BCQEWFmhlbGVuQGVy -aXguZXJpY3Nzb24uc2UwHhcNOTcwNzI4MDcxNDI1WhcNOTgxMjEwMDcxNDI1WjCB -gTELMAkGA1UEBhMCU0UxEjAQBgNVBAcTCVN0b2NraG9sbTERMA8GA1UEChMIRXJp -Y3Nzb24xDDAKBgNVBAsTA0VUWDEWMBQGA1UEAxMNSGVsZW4gQWlyaXlhbjElMCMG -CSqGSIb3DQEJARYWaGVsZW5AZXJpeC5lcmljc3Nvbi5zZTBcMA0GCSqGSIb3DQEB -AQUAA0sAMEgCQQDc+3hbzkZiQ4tVyTDNlN7hwucJqfw10yzMNPF2hL7We98IFYPO -BFdKMl9yodbYURNx3IfQMqx44KYswo/f0Wt/AgMBAAEwDQYJKoZIhvcNAQEEBQAD -QQC2++hLIaQJ4ChCjFE9UCfXO9cZ3Vq/FT9VjE+G4MRBDo4LQ5mBKNXcPF6EFZmi -7XrlvopXkVPlRguTi2SLRPkY +MIIChzCCAfCgAwIBAgIGAIsapa8BMA0GCSqGSIb3DQEBBQUAMHoxDjAMBgNVBAMT +BW90cENBMSAwHgYJKoZIhvcNAQkBFhF0ZXN0ZXJAZXJsYW5nLm9yZzESMBAGA1UE +BxMJU3RvY2tob2xtMQswCQYDVQQGEwJTRTEPMA0GA1UEChMGZXJsYW5nMRQwEgYD +VQQLEwt0ZXN0aW5nIGRlcDAiGA8yMDEwMDkwMTAwMDAwMFoYDzIwMjUwODI4MDAw +MDAwWjB7MQ8wDQYDVQQDEwZjbGllbnQxIDAeBgkqhkiG9w0BCQEWEXRlc3RlckBl +cmxhbmcub3JnMRIwEAYDVQQHEwlTdG9ja2hvbG0xCzAJBgNVBAYTAlNFMQ8wDQYD +VQQKEwZlcmxhbmcxFDASBgNVBAsTC3Rlc3RpbmcgZGVwMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCTFBPkOO98fDY3j6MIxIGKp+rampfIay50Lx4+EnCnRSSV +wC+n0VVmP7V5SGFJpuXJzN0hvqPUWOOjiMTNlNRaGy0pqu2oMXWAPLOxHWL1wT53 +h2Zr3FUNU/N0Rvnkttse1KZJ9uYCLKUiuXXsv2rR62nH3OhRIiBHSAcSv0NRWwID +AQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAG8t6f1A +PF7xayGxtUpG2r6W5ETylC3ZIKPS2kfJk9aYi7AZNTp7/xTU6SgqvFBN8aBPzxCD +4jHrSNC8DSb4X1x9uimarb6qdZDHEdij+DRAd2eygJHZxEf7+8B4Fx34thQeU9hZ +S1Izke5AlsyFMkvB7h0anE4k9BfuU70vl6v5  -----END CERTIFICATE----- diff --git a/lib/inets/test/httpc_SUITE_data/ssl_server_cert.pem b/lib/inets/test/httpc_SUITE_data/ssl_server_cert.pem index f01b6c992b..4aac86db49 100644 --- a/lib/inets/test/httpc_SUITE_data/ssl_server_cert.pem +++ b/lib/inets/test/httpc_SUITE_data/ssl_server_cert.pem @@ -1,22 +1,31 @@  -----BEGIN RSA PRIVATE KEY----- -MIIBOQIBAAJBAMe2WhP6s+JeKOwWPEjI9susfN4Vjn2dd1X4QUlOETcWVLoF916m -M4JU+ms7+ciMR8GRNCsIeqZGY8/GSqm74ccCAwEAAQJAF08YKlbLYfM9cXiS5qfV -7iWemUkIzW5wfC8yZ3zeE4Cp6R9ViUfs/dadQ/23Cw0Bpo2t8UdTUdCa4KpmqOem -cQIhAOnxTWZ5eo6h6PXDp7L5FZUACg8+wT3qf5f2is2mbSZPAiEA2orUY8JZDTSk -Rm7q9WxLiLNtORsXdTCmnCWhqBOYpwkCIErdowRxScxNekz0IT3AQqzdR1rbnWHg -IpcSGhd39CQ3AiA1XvQxjLP8wp9fyBS/bPwhXVhOOuyGpSP7PEF3b5m3KQIgGQWc -/a5wuWx3pc3mLx0ILwNoJr2ubFEuW1PJPsPJPv0= +MIICXQIBAAKBgQCf4Htxr99lLs5W8QQw7jdakqyAkIjOW4aqH8sr4va4SvZ9Adq6 +7k8jMHefCVZo+F8x4cwsBgB4aWzFIGBnvFTi6YsH27XW7f9O9IPCej8fdhRZ4UAt +NHa253buOWpDGla2JmIdkmfFvXFJycMIKbG5tYilVXoWKBMKmCwWaXz0nQIDAQAB +AoGAQIlma0r6W6bcRj4+Wd4fXCFvHuq5Psu1fYEeC5Yvz8761xVjjSfbrDHJZ9pm +FjOEgedK+s5lbDXqYVyjbdyZSugStBRocSmbG8SQHcAsxR2ZIkNzX2hYzB+lslWo +T3YJojDyB134O7XJznCu+ZFXP86jyJ1JT6k6a+OIHcwnJ+ECQQDYn57dY4Px3mEd +VBLStN3YkRF5oFyT+xk7IaKeLLB6n4gCnoVbBoHut7PFbPYPzoNzEwPk3MQKDIHb +Kig3S5CpAkEAvPA1VmoJWAlN6kUi+F2L8HXEArzE8x7vwdsslrwMKUe4dFS+ZC/7 +5iDOaxcZ7TYkCgwzBt341++DCgP6j3fY1QJBALB6AcOcwi52m6l4B8mu3ZkEPjdX +BHTuONTqhv/TqoaLlxODL2NDvvDKqeMp7KBd/srt79swW2lQXS4+fvrlTdkCQQCm +zxj4O1QWkthkfje6ubSkTwUIOatUzrp1F9GNH2dJRtX2dx9FCwxGCC7WY6XzRXqa +GF0wsedSllbGD+82nWQlAkAicMGqCqRq4hKR/cVmFatOqKVWCVkx6OFF2FhuiI5Z +h5eIOPGCt8dVRs1P9DNSld/D98Sfm65m85z8BtXovvYV  -----END RSA PRIVATE KEY-----  -----BEGIN CERTIFICATE----- -MIIB7jCCAZgCAQAwDQYJKoZIhvcNAQEEBQAwgYExCzAJBgNVBAYTAlNFMRIwEAYD -VQQHEwlTdG9ja2hvbG0xETAPBgNVBAoTCEVyaWNzc29uMQwwCgYDVQQLEwNFVFgx -FjAUBgNVBAMTDUhlbGVuIEFpcml5YW4xJTAjBgkqhkiG9w0BCQEWFmhlbGVuQGVy -aXguZXJpY3Nzb24uc2UwHhcNOTcwNzI4MDcyMTAwWhcNOTgxMjEwMDcyMTAwWjCB -gTELMAkGA1UEBhMCU0UxEjAQBgNVBAcTCVN0b2NraG9sbTERMA8GA1UEChMIRXJp -Y3Nzb24xDDAKBgNVBAsTA0VUWDEWMBQGA1UEAxMNSGVsZW4gQWlyaXlhbjElMCMG -CSqGSIb3DQEJARYWaGVsZW5AZXJpeC5lcmljc3Nvbi5zZTBcMA0GCSqGSIb3DQEB -AQUAA0sAMEgCQQDHtloT+rPiXijsFjxIyPbLrHzeFY59nXdV+EFJThE3FlS6Bfde -pjOCVPprO/nIjEfBkTQrCHqmRmPPxkqpu+HHAgMBAAEwDQYJKoZIhvcNAQEEBQAD -QQCnU1TkxmfbLdUwjdECb5x9QHCevAR7AmTms4Csn2oOEyPX+bgF2d94xhrV1sxO -Rs0yigk1PtN17Ci0Dey0LYkR +MIIChzCCAfCgAwIBAgIGANUxXM9BMA0GCSqGSIb3DQEBBQUAMHoxDjAMBgNVBAMT +BW90cENBMSAwHgYJKoZIhvcNAQkBFhF0ZXN0ZXJAZXJsYW5nLm9yZzESMBAGA1UE +BxMJU3RvY2tob2xtMQswCQYDVQQGEwJTRTEPMA0GA1UEChMGZXJsYW5nMRQwEgYD +VQQLEwt0ZXN0aW5nIGRlcDAiGA8yMDEwMDkwMTAwMDAwMFoYDzIwMjUwODI4MDAw +MDAwWjB7MQ8wDQYDVQQDEwZzZXJ2ZXIxIDAeBgkqhkiG9w0BCQEWEXRlc3RlckBl +cmxhbmcub3JnMRIwEAYDVQQHEwlTdG9ja2hvbG0xCzAJBgNVBAYTAlNFMQ8wDQYD +VQQKEwZlcmxhbmcxFDASBgNVBAsTC3Rlc3RpbmcgZGVwMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCf4Htxr99lLs5W8QQw7jdakqyAkIjOW4aqH8sr4va4SvZ9 +Adq67k8jMHefCVZo+F8x4cwsBgB4aWzFIGBnvFTi6YsH27XW7f9O9IPCej8fdhRZ +4UAtNHa253buOWpDGla2JmIdkmfFvXFJycMIKbG5tYilVXoWKBMKmCwWaXz0nQID +AQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAGF5Pfwk +QDdwJup/mVITPxbBls4Yl7anDooUQsq8066lA1g54H/PRfXscGkyCFGh1ifXvf1L +psMRoBAdDHL/wSJplk3rRavkC94eBgnTFZmfKL6844g1j53yameiYL8IEVExYMBg +/XGyc0qwq57WT8B/K4aElrvlBlQ0wF3wN54M  -----END CERTIFICATE----- diff --git a/lib/inets/test/httpc_proxy_SUITE.erl b/lib/inets/test/httpc_proxy_SUITE.erl index 84db39e76b..ddd23d0c65 100644 --- a/lib/inets/test/httpc_proxy_SUITE.erl +++ b/lib/inets/test/httpc_proxy_SUITE.erl @@ -69,6 +69,7 @@ local_proxy_cases() ->       http_post,       http_put,       http_delete, +     http_delete_body,       http_headers,       http_proxy_auth,       http_doesnotexist, @@ -262,6 +263,22 @@ http_delete(Config) when is_list(Config) ->  %%-------------------------------------------------------------------- +http_delete_body(doc) -> +    ["Perform a DELETE request with a content body. The server will not allow it " +     "but we only test sending the request."]; +http_delete_body(Config) when is_list(Config) -> +    Method = delete, +    URL = url("/delete.html", Config), +    Content = "foo=bar", +    Request = {URL,[],"application/x-www-form-urlencoded",Content}, +    HttpOpts = [], +    Opts = [], +    {ok,{{_,405,_},[_|_],[_|_]}} = +    httpc:request(Method, Request, HttpOpts, Opts), +    ok. + +%%-------------------------------------------------------------------- +  http_headers(doc) ->      ["Use as many request headers as possible"];  http_headers(Config) when is_list(Config) -> diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl index 1efa78a63e..ef801f91c7 100644 --- a/lib/inets/test/httpd_SUITE.erl +++ b/lib/inets/test/httpd_SUITE.erl @@ -222,6 +222,15 @@ init_per_group(ipv6 = _GroupName, Config) ->  	_ ->  	    {skip, "Host does not support IPv6"}      end; +init_per_group(essl, Config) -> +    catch crypto:stop(), +    case (catch crypto:start()) of +	ok -> +	    Config; +	_ -> +	    {skip, "Crypto not startable"} +    end; +  init_per_group(_GroupName, Config) ->      Config. @@ -1919,7 +1928,7 @@ ticket_5865(Config) ->  					       " HTTP/1.1\r\nHost:"  					       ++Host++"\r\n\r\n",   					       [{statuscode, 200}, -						{no_last_modified, +						{no_header,  						 "last-modified"}]),  	    ok;  	{error, Reason} -> diff --git a/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_client.pem b/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_client.pem index 8221139eb4..427447958d 100644 --- a/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_client.pem +++ b/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_client.pem @@ -1,22 +1,31 @@  -----BEGIN RSA PRIVATE KEY----- -MIIBPAIBAAJBAL6Ym/bgUvhhnPkw08sggGg8Tnp759ThGMEjkmDzhuJ3w3PfnF65 -mgHcgunku4G6LxAQfEUougJWf9Phmjj3oRUCAwEAAQJBAKMjvVvzZxFzfAlP4flc -OI0AEayFokp04dtvtzuFN09f+aBo2dP18xHmKLCZvxrBOaRAROoQYscALiIVpN07 -GAECIQDfi+sSfAFaDlT3vzpL3xE5UEH6IzY8jWpaZfM1QaToJQIhANpEF50H4wGO -8Sbh7dUutNd+s+NYUjsMySW2DjLKMsoxAiEAzzb2ftrdsempD0F+O0gZwiPIFKLB -Kp33YLYyHEKuJtUCIDGi+pvDh2R7VWw6RRQOIyI+tjolg83aAoSI+oGiahqBAiEA -xzmNNajwoaokvWvlaz0na8rhxu45grOvDrflBT9XvSQ= +MIICXQIBAAKBgQCTFBPkOO98fDY3j6MIxIGKp+rampfIay50Lx4+EnCnRSSVwC+n +0VVmP7V5SGFJpuXJzN0hvqPUWOOjiMTNlNRaGy0pqu2oMXWAPLOxHWL1wT53h2Zr +3FUNU/N0Rvnkttse1KZJ9uYCLKUiuXXsv2rR62nH3OhRIiBHSAcSv0NRWwIDAQAB +AoGACdIVYe/LTeydUihtInC8lZ2QuPgJmoBNocRjqJFipEihoL4scHAx25n1bBvB +I0HZphffzBkGp28oBAtl2LRPWXqu527unc/RWRfLMqSK1xNSq1DxD1a30zkrZPna +QiV65vEJuNSJTtlDy/Zqc/BVZXCpxWlzYQedZgkmf0Qse8ECQQCmaz02Yur8zC9f +eSQKU5OSzGw3bSIumEzziCfHdTheK6MEoccf5TCAyLXhZwA7QlKja4tFXfeyVxws +/LlnUJN9AkEA4j+xnOeYUyGKXL5i+BAbnqpI4MzPiq+IoCYkaRlD/wAws24r5HNI +ZQmEHWqD/NNzOf/A2XuyLtMiTGJPW/DftwJBAKKpJP6Ytuh6xz8BUCnLwO12Y7vV +LtjuQiCzD3aUa5EYA9HOMqxJPxxRkf0LyR0i2VUkE8+sZiPpov+R0cJa7p0CQQCj +40GUiArGRSiF7/+e84QeVfl+pb29F1QftiFv5DZmFEwy3Z572KpbTh5edJbxYHY6 +UDHxGHJFCvnwXNJhpkVXAkBJqfEfiMJ3Q/E5Gpf3sQizacouW92iiN8ojlF1oB80 +t34RysJH7SgI3gdMhTribCo2UUaV0StjR6yodPN+TB2J  -----END RSA PRIVATE KEY-----  -----BEGIN CERTIFICATE----- -MIICDDCCAbYCAQAwDQYJKoZIhvcNAQEEBQAwgZAxCzAJBgNVBAYTAlNFMRIwEAYD -VQQIEwlTdG9ja2hvbG0xDzANBgNVBAcTBkFsdnNqbzEMMAoGA1UEChMDRVRYMQ4w -DAYDVQQLEwVETi9TUDEXMBUGA1UEAxMOSm9ha2ltIEdyZWJlbm8xJTAjBgkqhkiG -9w0BCQEWFmpvY2tlQGVyaXguZXJpY3Nzb24uc2UwHhcNOTcwNzE1MTUzNDM2WhcN -MDMwMjIyMTUzNDM2WjCBkDELMAkGA1UEBhMCU0UxEjAQBgNVBAgTCVN0b2NraG9s -bTEPMA0GA1UEBxMGQWx2c2pvMQwwCgYDVQQKEwNFVFgxDjAMBgNVBAsTBUROL1NQ -MRcwFQYDVQQDEw5Kb2FraW0gR3JlYmVubzElMCMGCSqGSIb3DQEJARYWam9ja2VA -ZXJpeC5lcmljc3Nvbi5zZTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC+mJv24FL4 -YZz5MNPLIIBoPE56e+fU4RjBI5Jg84bid8Nz35xeuZoB3ILp5LuBui8QEHxFKLoC -Vn/T4Zo496EVAgMBAAEwDQYJKoZIhvcNAQEEBQADQQBYxQVfTydyZCE0UXvZd7Ei -josNsAaWJk9fFIJaG9uyXCEfg2dVgoT2eBk3D9DI+7OB+78isM5CVlFbL7hilvP8 +MIIChzCCAfCgAwIBAgIGAIsapa8BMA0GCSqGSIb3DQEBBQUAMHoxDjAMBgNVBAMT +BW90cENBMSAwHgYJKoZIhvcNAQkBFhF0ZXN0ZXJAZXJsYW5nLm9yZzESMBAGA1UE +BxMJU3RvY2tob2xtMQswCQYDVQQGEwJTRTEPMA0GA1UEChMGZXJsYW5nMRQwEgYD +VQQLEwt0ZXN0aW5nIGRlcDAiGA8yMDEwMDkwMTAwMDAwMFoYDzIwMjUwODI4MDAw +MDAwWjB7MQ8wDQYDVQQDEwZjbGllbnQxIDAeBgkqhkiG9w0BCQEWEXRlc3RlckBl +cmxhbmcub3JnMRIwEAYDVQQHEwlTdG9ja2hvbG0xCzAJBgNVBAYTAlNFMQ8wDQYD +VQQKEwZlcmxhbmcxFDASBgNVBAsTC3Rlc3RpbmcgZGVwMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCTFBPkOO98fDY3j6MIxIGKp+rampfIay50Lx4+EnCnRSSV +wC+n0VVmP7V5SGFJpuXJzN0hvqPUWOOjiMTNlNRaGy0pqu2oMXWAPLOxHWL1wT53 +h2Zr3FUNU/N0Rvnkttse1KZJ9uYCLKUiuXXsv2rR62nH3OhRIiBHSAcSv0NRWwID +AQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAG8t6f1A +PF7xayGxtUpG2r6W5ETylC3ZIKPS2kfJk9aYi7AZNTp7/xTU6SgqvFBN8aBPzxCD +4jHrSNC8DSb4X1x9uimarb6qdZDHEdij+DRAd2eygJHZxEf7+8B4Fx34thQeU9hZ +S1Izke5AlsyFMkvB7h0anE4k9BfuU70vl6v5  -----END CERTIFICATE----- diff --git a/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_server.pem b/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_server.pem index fe739c15f7..4aac86db49 100644 --- a/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_server.pem +++ b/lib/inets/test/httpd_SUITE_data/server_root/ssl/ssl_server.pem @@ -1,22 +1,31 @@  -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAL9Bozj3BIjL5Cy8b3rjMT2kPZRychX4wz9bHoIIiKnKo1xXHYjw -g3N9zWM1f1ZzMADwVry1uAInA8q09+7hL20CAwEAAQJACwu2ao7RozjrV64WXimK -6X131P/7GMvCMwGHNIlbozqoOqmZcYrbKaF61l+XuwA2QvTo3ywW1Ivxcyr6TeAr -PQIhAOX+WXT6yiqqwjt08kjBCJyMgfZtdAO6pc/6pKjNWiZfAiEA1OH1iPW/OQe5 -tlQXpiRVdLyneNsPygPRJc4Bdwu3hbMCIQDbI5pA56QxOzqOREOGJsb5wrciAfAE -jZbnr72sSN2YqQIgAWFpvzagw9Tp/mWzNY+cwkIK7/yzsIKv04fveH8p9IMCIQCr -td4IiukeUwXmPSvYM4uCE/+J89wEL9qU8Mlc3gDLXA== +MIICXQIBAAKBgQCf4Htxr99lLs5W8QQw7jdakqyAkIjOW4aqH8sr4va4SvZ9Adq6 +7k8jMHefCVZo+F8x4cwsBgB4aWzFIGBnvFTi6YsH27XW7f9O9IPCej8fdhRZ4UAt +NHa253buOWpDGla2JmIdkmfFvXFJycMIKbG5tYilVXoWKBMKmCwWaXz0nQIDAQAB +AoGAQIlma0r6W6bcRj4+Wd4fXCFvHuq5Psu1fYEeC5Yvz8761xVjjSfbrDHJZ9pm +FjOEgedK+s5lbDXqYVyjbdyZSugStBRocSmbG8SQHcAsxR2ZIkNzX2hYzB+lslWo +T3YJojDyB134O7XJznCu+ZFXP86jyJ1JT6k6a+OIHcwnJ+ECQQDYn57dY4Px3mEd +VBLStN3YkRF5oFyT+xk7IaKeLLB6n4gCnoVbBoHut7PFbPYPzoNzEwPk3MQKDIHb +Kig3S5CpAkEAvPA1VmoJWAlN6kUi+F2L8HXEArzE8x7vwdsslrwMKUe4dFS+ZC/7 +5iDOaxcZ7TYkCgwzBt341++DCgP6j3fY1QJBALB6AcOcwi52m6l4B8mu3ZkEPjdX +BHTuONTqhv/TqoaLlxODL2NDvvDKqeMp7KBd/srt79swW2lQXS4+fvrlTdkCQQCm +zxj4O1QWkthkfje6ubSkTwUIOatUzrp1F9GNH2dJRtX2dx9FCwxGCC7WY6XzRXqa +GF0wsedSllbGD+82nWQlAkAicMGqCqRq4hKR/cVmFatOqKVWCVkx6OFF2FhuiI5Z +h5eIOPGCt8dVRs1P9DNSld/D98Sfm65m85z8BtXovvYV  -----END RSA PRIVATE KEY-----  -----BEGIN CERTIFICATE----- -MIICDDCCAbYCAQAwDQYJKoZIhvcNAQEEBQAwgZAxCzAJBgNVBAYTAlNFMRIwEAYD -VQQIEwlTdG9ja2hvbG0xDzANBgNVBAcTBkFsdnNqbzEMMAoGA1UEChMDRVRYMQ4w -DAYDVQQLEwVETi9TUDEXMBUGA1UEAxMOSm9ha2ltIEdyZWJlbm8xJTAjBgkqhkiG -9w0BCQEWFmpvY2tlQGVyaXguZXJpY3Nzb24uc2UwHhcNOTcwNzE1MTUzMzQxWhcN -MDMwMjIyMTUzMzQxWjCBkDELMAkGA1UEBhMCU0UxEjAQBgNVBAgTCVN0b2NraG9s -bTEPMA0GA1UEBxMGQWx2c2pvMQwwCgYDVQQKEwNFVFgxDjAMBgNVBAsTBUROL1NQ -MRcwFQYDVQQDEw5Kb2FraW0gR3JlYmVubzElMCMGCSqGSIb3DQEJARYWam9ja2VA -ZXJpeC5lcmljc3Nvbi5zZTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC/QaM49wSI -y+QsvG964zE9pD2UcnIV+MM/Wx6CCIipyqNcVx2I8INzfc1jNX9WczAA8Fa8tbgC -JwPKtPfu4S9tAgMBAAEwDQYJKoZIhvcNAQEEBQADQQAmXDY1CyJjzvQZX442kkHG -ic9QFY1UuVfzokzNMwlHYl1Qx9zaodx0cJCrcH5GF9O9LJbhhV77LzoxT1Q5wZp5 +MIIChzCCAfCgAwIBAgIGANUxXM9BMA0GCSqGSIb3DQEBBQUAMHoxDjAMBgNVBAMT +BW90cENBMSAwHgYJKoZIhvcNAQkBFhF0ZXN0ZXJAZXJsYW5nLm9yZzESMBAGA1UE +BxMJU3RvY2tob2xtMQswCQYDVQQGEwJTRTEPMA0GA1UEChMGZXJsYW5nMRQwEgYD +VQQLEwt0ZXN0aW5nIGRlcDAiGA8yMDEwMDkwMTAwMDAwMFoYDzIwMjUwODI4MDAw +MDAwWjB7MQ8wDQYDVQQDEwZzZXJ2ZXIxIDAeBgkqhkiG9w0BCQEWEXRlc3RlckBl +cmxhbmcub3JnMRIwEAYDVQQHEwlTdG9ja2hvbG0xCzAJBgNVBAYTAlNFMQ8wDQYD +VQQKEwZlcmxhbmcxFDASBgNVBAsTC3Rlc3RpbmcgZGVwMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCf4Htxr99lLs5W8QQw7jdakqyAkIjOW4aqH8sr4va4SvZ9 +Adq67k8jMHefCVZo+F8x4cwsBgB4aWzFIGBnvFTi6YsH27XW7f9O9IPCej8fdhRZ +4UAtNHa253buOWpDGla2JmIdkmfFvXFJycMIKbG5tYilVXoWKBMKmCwWaXz0nQID +AQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAGF5Pfwk +QDdwJup/mVITPxbBls4Yl7anDooUQsq8066lA1g54H/PRfXscGkyCFGh1ifXvf1L +psMRoBAdDHL/wSJplk3rRavkC94eBgnTFZmfKL6844g1j53yameiYL8IEVExYMBg +/XGyc0qwq57WT8B/K4aElrvlBlQ0wF3wN54M  -----END CERTIFICATE----- diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl index 523cf9d38c..2d06f3e70c 100644 --- a/lib/inets/test/httpd_basic_SUITE.erl +++ b/lib/inets/test/httpd_basic_SUITE.erl @@ -19,6 +19,7 @@  %%  -module(httpd_basic_SUITE). +-include_lib("kernel/include/file.hrl").  -include_lib("common_test/include/ct.hrl").  -include("inets_test_lib.hrl"). @@ -33,9 +34,13 @@ suite() -> [{ct_hooks,[ts_install_cth]}].  all() ->       [       uri_too_long_414,  -     header_too_long_413,  +     header_too_long_413, +     erl_script_nocache_opt, +     script_nocache,       escaped_url_in_error_body, -     slowdose +     script_timeout, +     slowdose, +     keep_alive_timeout      ].  groups() ->  @@ -62,6 +67,7 @@ init_per_suite(Config) ->  	"~n   Config: ~p", [Config]),      ok = inets:start(),      PrivDir = ?config(priv_dir, Config), +    DataDir = ?config(data_dir, Config),       Dummy =   "<HTML> @@ -74,6 +80,21 @@ DUMMY  </HTML>",      DummyFile = filename:join([PrivDir,"dummy.html"]), +    CgiDir =  filename:join(PrivDir, "cgi-bin"), +    ok = file:make_dir(CgiDir), +    {CgiPrintEnv, CgiSleep} = case test_server:os_type() of +				  {win32, _} -> +				      {"printenv.bat", "cgi_sleep.exe"}; +				  _ -> +				      {"printenv.sh", "cgi_sleep"} +			      end, +    lists:foreach( +      fun(Cgi) -> +	      inets_test_lib:copy_file(Cgi, DataDir, CgiDir), +	      AbsCgi = filename:join([CgiDir, Cgi]), +	      {ok, FileInfo} = file:read_file_info(AbsCgi), +	      ok = file:write_file_info(AbsCgi, FileInfo#file_info{mode = 8#00755}) +      end, [CgiPrintEnv, CgiSleep]),      {ok, Fd}  = file:open(DummyFile, [write]),      ok        = file:write(Fd, Dummy),      ok        = file:close(Fd),  @@ -84,7 +105,8 @@ DUMMY  		 {document_root, PrivDir},   		 {bind_address,  "localhost"}], -    [{httpd_conf, HttpdConf} |  Config]. +    [{httpd_conf, HttpdConf}, {cgi_dir, CgiDir}, +     {cgi_printenv, CgiPrintEnv}, {cgi_sleep, CgiSleep} |  Config].  %%--------------------------------------------------------------------  %% Function: end_per_suite(Config) -> _ @@ -178,6 +200,74 @@ header_too_long_413(Config) when is_list(Config) ->   				        {version, "HTTP/1.1"}]),      inets:stop(httpd, Pid). +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- + +erl_script_nocache_opt(doc) -> +    ["Test that too long headers's get 413 HTTP code"]; +erl_script_nocache_opt(suite) -> +    []; +erl_script_nocache_opt(Config) when is_list(Config) -> +    HttpdConf   = ?config(httpd_conf, Config), +    {ok, Pid}   = inets:start(httpd, [{port, 0}, {erl_script_nocache, true} | HttpdConf]), +    Info        = httpd:info(Pid), +    Port        = proplists:get_value(port,         Info), +    _Address    = proplists:get_value(bind_address, Info), +    URL1        = ?URL_START ++ integer_to_list(Port), +    case httpc:request(get, {URL1 ++ "/dummy.html", []}, +		       [{url_encode,  false},  +			{version,     "HTTP/1.0"}], +		       [{full_result, false}]) of +	{ok, {200, _}} -> +	    ok +    end, +    inets:stop(httpd, Pid). + +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- + +script_nocache(doc) -> +    ["Test nocache option for mod_cgi and mod_esi"]; +script_nocache(suite) -> +    []; +script_nocache(Config) when is_list(Config) -> +    Normal = {no_header, "cache-control"}, +    NoCache = {header, "cache-control", "no-cache"}, +    verify_script_nocache(Config, false, false, Normal, Normal), +    verify_script_nocache(Config, true, false, NoCache, Normal), +    verify_script_nocache(Config, false, true, Normal, NoCache), +    verify_script_nocache(Config, true, true, NoCache, NoCache), +    ok. + +verify_script_nocache(Config, CgiNoCache, EsiNoCache, CgiOption, EsiOption) -> +    HttpdConf = ?config(httpd_conf, Config), +    CgiScript = ?config(cgi_printenv, Config), +    CgiDir = ?config(cgi_dir, Config), +    {ok, Pid} = inets:start(httpd, [{port, 0}, +				    {script_alias, +				     {"/cgi-bin/", CgiDir ++ "/"}}, +				    {script_nocache, CgiNoCache}, +				    {erl_script_alias, +				     {"/cgi-bin/erl", [httpd_example,io]}}, +				    {erl_script_nocache, EsiNoCache} +				    | HttpdConf]), +    Info = httpd:info(Pid), +    Port = proplists:get_value(port, Info), +    Address = proplists:get_value(bind_address, Info), +    ok = httpd_test_lib:verify_request(ip_comm, Address, Port, node(), +				       "GET /cgi-bin/" ++ CgiScript ++ +					   " HTTP/1.0\r\n\r\n", +				       [{statuscode, 200}, +					CgiOption, +					{version, "HTTP/1.0"}]), +    ok = httpd_test_lib:verify_request(ip_comm, Address, Port, node(), +				       "GET /cgi-bin/erl/httpd_example:get " +				       "HTTP/1.0\r\n\r\n", +				       [{statuscode, 200}, +					EsiOption, +					{version, "HTTP/1.0"}]), +    inets:stop(httpd, Pid). +  %%-------------------------------------------------------------------------  %%------------------------------------------------------------------------- @@ -279,6 +369,63 @@ escaped_url_in_error_body(Config) when is_list(Config) ->      inets:stop(httpd, Pid),      tsp("escaped_url_in_error_body -> done"),          ok. + + +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- + +keep_alive_timeout(doc) -> +    ["Test the keep_alive_timeout option"]; +keep_alive_timeout(suite) -> +    []; +keep_alive_timeout(Config) when is_list(Config) -> +    HttpdConf   = ?config(httpd_conf, Config), +    {ok, Pid}   = inets:start(httpd, [{port, 0}, {keep_alive, true}, {keep_alive_timeout, 2} | HttpdConf]), +    Info        = httpd:info(Pid), +    Port        = proplists:get_value(port,         Info), +    _Address    = proplists:get_value(bind_address, Info), +    {ok, S} = gen_tcp:connect("localhost", Port, []), +    receive +    after 3000 -> +	    {error, closed} = gen_tcp:send(S, "hey") +    end, +    inets:stop(httpd, Pid). + +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- + +script_timeout(doc) -> +    ["Test the httpd script_timeout option"]; +script_timeout(suite) -> +    []; +script_timeout(Config) when is_list(Config) -> +    verify_script_timeout(Config, 20, 200), +    verify_script_timeout(Config, 5, 403), +    ok. + +verify_script_timeout(Config, ScriptTimeout, StatusCode) -> +    HttpdConf = ?config(httpd_conf, Config), +    CgiScript = ?config(cgi_sleep, Config), +    CgiDir = ?config(cgi_dir, Config), +    {ok, Pid} = inets:start(httpd, [{port, 0}, +				    {script_alias, +				     {"/cgi-bin/", CgiDir ++ "/"}}, +				    {script_timeout, ScriptTimeout} +				    | HttpdConf]), +    Info = httpd:info(Pid), +    Port = proplists:get_value(port, Info), +    Address = proplists:get_value(bind_address, Info), +    ok = httpd_test_lib:verify_request(ip_comm, Address, Port, node(), +				       "GET /cgi-bin/" ++ CgiScript ++ +					   " HTTP/1.0\r\n\r\n", +				       [{statuscode, StatusCode}, +					{version, "HTTP/1.0"}]), +    inets:stop(httpd, Pid). + + +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- +  slowdose(doc) ->      ["Testing minimum bytes per second option"];  slowdose(Config) when is_list(Config) -> diff --git a/lib/inets/test/httpd_basic_SUITE_data/Makefile.src b/lib/inets/test/httpd_basic_SUITE_data/Makefile.src new file mode 100644 index 0000000000..9da2ed583f --- /dev/null +++ b/lib/inets/test/httpd_basic_SUITE_data/Makefile.src @@ -0,0 +1,14 @@ +CC = @CC@ +LD = @LD@ +CFLAGS = @CFLAGS@ -I@erl_include@ @DEFS@ +CROSSLDFLAGS = @CROSSLDFLAGS@ + +PROGS = cgi_sleep@exe@ + +all: $(PROGS) + +cgi_sleep@exe@: cgi_sleep@obj@ +	$(LD) $(CROSSLDFLAGS) -o cgi_sleep cgi_sleep@obj@ @LIBS@ + +cgi_sleep@obj@: cgi_sleep.c +	$(CC) -c -o cgi_sleep@obj@ $(CFLAGS) cgi_sleep.c diff --git a/lib/inets/test/httpd_basic_SUITE_data/cgi_sleep.c b/lib/inets/test/httpd_basic_SUITE_data/cgi_sleep.c new file mode 100644 index 0000000000..126bb23987 --- /dev/null +++ b/lib/inets/test/httpd_basic_SUITE_data/cgi_sleep.c @@ -0,0 +1,26 @@ +#include <stdlib.h> +#include <stdio.h> + +#ifdef __WIN32__ +#include <windows.h> +#include <fcntl.h> +#include <io.h> +#else +#include <unistd.h> +#endif + +int main(void) +{ +    unsigned int seconds = 10; + +#ifdef __WIN32__ +    Sleep(seconds * 1000); +    _setmode(_fileno(stdout), _O_BINARY); +#else +    sleep(seconds); +#endif + +    printf("Content-type: text/plain\r\n\r\n"); +    printf("Slept for %u seconds.\r\n", seconds); +    exit(EXIT_SUCCESS); +} diff --git a/lib/inets/test/httpd_basic_SUITE_data/printenv.bat b/lib/inets/test/httpd_basic_SUITE_data/printenv.bat new file mode 120000 index 0000000000..1bc8e52059 --- /dev/null +++ b/lib/inets/test/httpd_basic_SUITE_data/printenv.bat @@ -0,0 +1 @@ +../httpd_SUITE_data/server_root/cgi-bin/printenv.bat
\ No newline at end of file diff --git a/lib/inets/test/httpd_basic_SUITE_data/printenv.sh b/lib/inets/test/httpd_basic_SUITE_data/printenv.sh new file mode 120000 index 0000000000..0136a3fa23 --- /dev/null +++ b/lib/inets/test/httpd_basic_SUITE_data/printenv.sh @@ -0,0 +1 @@ +../httpd_SUITE_data/server_root/cgi-bin/printenv.sh
\ No newline at end of file diff --git a/lib/inets/test/httpd_mod.erl b/lib/inets/test/httpd_mod.erl index df4ed6b179..7d3326fb65 100644 --- a/lib/inets/test/httpd_mod.erl +++ b/lib/inets/test/httpd_mod.erl @@ -842,6 +842,14 @@ cgi(Type, Port, Host, Node) ->  				       {version, "HTTP/1.0"}]),  %%     tsp("cgi -> done"), + +    %% Check "ScriptNoCache" directive (default: false) +    ok = httpd_test_lib:verify_request(Type, Host, Port, Node, +				       "GET /cgi-bin/" ++ Script ++ +				       " HTTP/1.0\r\n\r\n", +				       [{statuscode, 200}, +					{no_header, "cache-control"}, +					{version, "HTTP/1.0"}]),      ok. @@ -899,6 +907,13 @@ esi(Type, Port, Host, Node) ->  					" HTTP/1.0\r\n\r\n",  					[{statuscode, 302},  					{version, "HTTP/1.0"}]), +    %% Check "ErlScriptNoCache" directive (default: false) +    ok = httpd_test_lib:verify_request(Type, Host, Port, Node, +				       "GET /cgi-bin/erl/httpd_example:get" +				       " HTTP/1.0\r\n\r\n", +				       [{statuscode, 200}, +					{no_header, "cache-control"}, +					{version, "HTTP/1.0"}]),      ok. diff --git a/lib/inets/test/httpd_test_lib.erl b/lib/inets/test/httpd_test_lib.erl index 13584c50f6..3e82324a30 100644 --- a/lib/inets/test/httpd_test_lib.erl +++ b/lib/inets/test/httpd_test_lib.erl @@ -361,7 +361,7 @@ do_validate(Header, [{header, HeaderField, Value}|Rest],N,P) ->  	    tsf({wrong_header_field_value, LowerHeaderField, Header})      end,      do_validate(Header, Rest, N, P); -do_validate(Header,[{no_last_modified, HeaderField}|Rest],N,P) -> +do_validate(Header,[{no_header, HeaderField}|Rest],N,P) ->      case lists:keysearch(HeaderField,1,Header) of  	{value,_} ->  	    tsf({wrong_header_field_value, HeaderField, Header});  | 
