From ca09b09dff13a70ff07c835c2ae951f3d7a2ac07 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 15 Dec 2010 15:45:55 +0100 Subject: Convert ssh test cases to common test stardard --- lib/ssh/test/ssh.spec | 13 +++++++------ lib/ssh/test/ssh_SUITE.erl | 24 ++++++++++++++++-------- lib/ssh/test/ssh_basic_SUITE.erl | 20 ++++++++++++++------ lib/ssh/test/ssh_sftp_SUITE.erl | 26 ++++++++++++++++---------- lib/ssh/test/ssh_sftpd_SUITE.erl | 22 +++++++++++++++------- lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl | 17 ++++++++++++----- lib/ssh/test/ssh_to_openssh_SUITE.erl | 20 +++++++++++++------- 7 files changed, 93 insertions(+), 49 deletions(-) (limited to 'lib/ssh/test') diff --git a/lib/ssh/test/ssh.spec b/lib/ssh/test/ssh.spec index d99250654e..8de0fe44e4 100644 --- a/lib/ssh/test/ssh.spec +++ b/lib/ssh/test/ssh.spec @@ -1,6 +1,7 @@ -{topcase, {dir, "../ssh_test"}}. -{require_nodenames, 1}. -{skip, {ssh_ssh_SUITE, ssh, "Current implementation is timingdependent and -hence will succeed/fail on a whim"}}. -{skip, {ssh_ssh_SUITE, ssh_compressed, -"Current implementation is timingdependent hence will succeed/fail on a whim"}}. +{suites,"../ssh_test",all}. +{skip_cases,"../ssh_test",ssh_ssh_SUITE, + [ssh], + "Current implementation is timingdependent and\nhence will succeed/fail on a whim"}. +{skip_cases,"../ssh_test",ssh_ssh_SUITE, + [ssh_compressed], + "Current implementation is timingdependent hence will succeed/fail on a whim"}. diff --git a/lib/ssh/test/ssh_SUITE.erl b/lib/ssh/test/ssh_SUITE.erl index dd4571febe..aa321527b8 100644 --- a/lib/ssh/test/ssh_SUITE.erl +++ b/lib/ssh/test/ssh_SUITE.erl @@ -22,7 +22,7 @@ %%% Purpose:ssh application test suite. %%%----------------------------------------------------------------- -module(ssh_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). % Default timetrap timeout (set in init_per_testcase). @@ -30,8 +30,8 @@ -define(application, ssh). % Test server specific exports --export([all/1]). --export([init_per_testcase/2, fin_per_testcase/2]). +-export([all/0,groups/0,init_per_group/2,end_per_group/2]). +-export([init_per_testcase/2, end_per_testcase/2]). % Test cases must be exported. -export([app_test/1]). @@ -40,15 +40,23 @@ %% %% all/1 %% -all(doc) -> - []; -all(suite) -> - [?cases]. +all() -> + [app_test]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) -> Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Dog=?config(watchdog, Config), test_server:timetrap_cancel(Dog), ok. diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index d5eb5367e6..6062e2d789 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -21,7 +21,7 @@ -module(ssh_basic_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Note: This directive should only be used in test suites. @@ -97,12 +97,20 @@ end_per_testcase(_TestCase, _Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ssh API"]; - -all(suite) -> +all() -> [exec, exec_compressed, shell, daemon_allready_started, - server_password_option, server_userpassword_option, known_hosts]. + server_password_option, server_userpassword_option, + known_hosts]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl index eb7fbd6998..4cc157ebd4 100644 --- a/lib/ssh/test/ssh_sftp_SUITE.erl +++ b/lib/ssh/test/ssh_sftp_SUITE.erl @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/file.hrl"). @@ -137,15 +137,21 @@ end_per_testcase(_Case, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test the sftp client"]; - -all(suite) -> - [ - open_close_file, open_close_dir, read_file, read_dir, write_file, - rename_file, mk_rm_dir, remove_file, links, retrieve_attributes, - set_attributes, async_read, async_write, position, pos_read, pos_write - ]. +all() -> + [open_close_file, open_close_dir, read_file, read_dir, + write_file, rename_file, mk_rm_dir, remove_file, links, + retrieve_attributes, set_attributes, async_read, + async_write, position, pos_read, pos_write]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl index 4ce6bd45b3..263eeefe66 100644 --- a/lib/ssh/test/ssh_sftpd_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_SUITE.erl @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("ssh_xfer.hrl"). -include("ssh.hrl"). @@ -143,13 +143,21 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test the sftp server"]; +all() -> + [open_close_file, open_close_dir, read_file, read_dir, + write_file, rename_file, mk_rm_dir, remove_file, + real_path, retrieve_attributes, set_attributes, links, + ver3_rename_OTP_6352, seq10670, sshd_read_file]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all(suite) -> - [open_close_file, open_close_dir, read_file, read_dir, write_file, - rename_file, mk_rm_dir, remove_file, real_path, retrieve_attributes, - set_attributes, links, ver3_rename_OTP_6352, seq10670, sshd_read_file]. %% Test cases starts here. %%-------------------------------------------------------------------- diff --git a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl index 6ae5e73dcb..7e9b6024e5 100644 --- a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl @@ -23,7 +23,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include_lib("kernel/include/file.hrl"). @@ -147,13 +147,20 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ssh_sftpd"]; - -all(suite) -> +all() -> [close_file_OTP_6350, quit_OTP_6349, file_cb_OTP_6356, root_dir, list_dir_limited]. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% Test cases starts here. %%-------------------------------------------------------------------- close_file_OTP_6350(doc) -> diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl index 1b7a9b23ed..12a350903a 100644 --- a/lib/ssh/test/ssh_to_openssh_SUITE.erl +++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl @@ -20,7 +20,7 @@ %% -module(ssh_to_openssh_SUITE). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). %% Note: This directive should only be used in test suites. @@ -90,13 +90,9 @@ end_per_testcase(_TestCase, _Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test ssh API"]; - -all(suite) -> +all() -> case os:find_executable("ssh") of - false -> - {skip, "openSSH not installed on host"}; + false -> {skip, "openSSH not installed on host"}; _ -> [erlang_shell_client_openssh_server, erlang_client_openssh_server_exec, @@ -110,6 +106,16 @@ all(suite) -> erlang_client_openssh_server_password] end. +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %% TEST cases starts here. %%-------------------------------------------------------------------- erlang_shell_client_openssh_server(doc) -> -- cgit v1.2.3