From 2c0bd506cb99362635ebc0aafae36a95dc0a08b3 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 24 Jan 2011 13:33:13 +0100 Subject: Update init_per_suite so that tests are skipped if crypto/ssh cannot be started. --- lib/ssh/test/ssh_basic_SUITE.erl | 14 +++++++++----- lib/ssh/test/ssh_sftp_SUITE.erl | 22 +++++++++++++++------- lib/ssh/test/ssh_sftpd_SUITE.erl | 13 ++++++++++--- lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl | 25 ++++++++++++++----------- lib/ssh/test/ssh_to_openssh_SUITE.erl | 8 ++++++-- 5 files changed, 54 insertions(+), 28 deletions(-) (limited to 'lib/ssh/test') diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index 6062e2d789..cb0d5483ab 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -39,11 +39,15 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - Dir = ?config(priv_dir, Config), - ssh_test_lib:save_known_hosts(Dir), - {ok, _} = ssh_test_lib:get_id_keys(Dir), - Config. + case catch crypto:start() of + ok -> + Dir = ?config(priv_dir, Config), + ssh_test_lib:save_known_hosts(Dir), + {ok, _} = ssh_test_lib:get_id_keys(Dir), + Config; + _Else -> + {skip, "Crypto could not be started!"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl index 4cc157ebd4..ec2010e15a 100644 --- a/lib/ssh/test/ssh_sftp_SUITE.erl +++ b/lib/ssh/test/ssh_sftp_SUITE.erl @@ -46,13 +46,21 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - ssh:start(), - Dir = ?config(priv_dir, Config), - ssh_test_lib:save_known_hosts(Dir), - %% More like copy_id_keys!!! - {ok, _} = ssh_test_lib:get_id_keys(Dir), - Config. + case {catch crypto:start(),catch ssh:start()} of + {ok,ok} -> + Dir = ?config(priv_dir, Config), + ssh_test_lib:save_known_hosts(Dir), + %% More like copy_id_keys!!! + {ok, _} = ssh_test_lib:get_id_keys(Dir), + Config; + {ok,_} -> + {skip,"Could not start ssh!"}; + {_,ok} -> + {skip,"Could not start crypto!"}; + {_,_} -> + {skip,"Could not start crypto and ssh!"} + end. + %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ %% Config - [tuple()] diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl index 263eeefe66..59445135b4 100644 --- a/lib/ssh/test/ssh_sftpd_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_SUITE.erl @@ -53,9 +53,16 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - ssh:stop(), - crypto:start(), - Config. + case {catch ssh:stop(),catch crypto:start()} of + {ok,ok} -> + Config; + {ok,_} -> + {skip,"Could not start ssh!"}; + {_,ok} -> + {skip,"Could not start crypto!"}; + {_,_} -> + {skip,"Could not start crypto and ssh!"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ diff --git a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl index 7e9b6024e5..6ad462deab 100644 --- a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl @@ -44,17 +44,20 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - ssh:stop(), - crypto:start(), - DataDir = ?config(data_dir, Config), - FileAlt = filename:join(DataDir, "ssh_sftpd_file_alt.erl"), - c:c(FileAlt), - FileName = filename:join(DataDir, "test.txt"), - {ok, FileInfo} = file:read_file_info(FileName), - ok = file:write_file_info(FileName, - FileInfo#file_info{mode = 8#400}), - - Config. + catch ssh:stop(), + case catch crypto:start() of + ok -> + DataDir = ?config(data_dir, Config), + FileAlt = filename:join(DataDir, "ssh_sftpd_file_alt.erl"), + c:c(FileAlt), + FileName = filename:join(DataDir, "test.txt"), + {ok, FileInfo} = file:read_file_info(FileName), + ok = file:write_file_info(FileName, + FileInfo#file_info{mode = 8#400}), + Config; + _Else -> + {skip,"Could not start ssh!"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl index 12a350903a..69a57aad1b 100644 --- a/lib/ssh/test/ssh_to_openssh_SUITE.erl +++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl @@ -40,8 +40,12 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - crypto:start(), - Config. + case catch crypto:start() of + ok -> + Config; + _Else -> + {skip,"Could not start crypto!"} + end. %%-------------------------------------------------------------------- %% Function: end_per_suite(Config) -> _ -- cgit v1.2.3