aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-12-21 14:01:32 +0100
committerHans Nilsson <[email protected]>2015-12-21 14:01:32 +0100
commitc449cba9ae8b322595ebad5a9c2725cc9952efab (patch)
tree213a28583300d864bd953e5b5f034ce8f89ae51c /lib/ssh/test/ssh_test_lib.erl
parentaeb26c12c13dde2ab87298ae7aa4f625b10f0cf6 (diff)
parentb35e3c4d3ce7bfecbb4f93a8d5101e83bac7e606 (diff)
downloadotp-c449cba9ae8b322595ebad5a9c2725cc9952efab.tar.gz
otp-c449cba9ae8b322595ebad5a9c2725cc9952efab.tar.bz2
otp-c449cba9ae8b322595ebad5a9c2725cc9952efab.zip
Merge branch 'maint'
* maint: ssh: benchmark all common kex and cipher algorithms New structure of the report ssh: ssh_benchmark_SUITE re-organized ssh: Add first version of ssh_benchmark_SUITE
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index ed76f4f795..2db55b97b4 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -541,7 +541,6 @@ default_algorithms(sshc, DaemonOptions) ->
ct:fail("No server respons 2")
end.
-
run_fake_ssh({ok,InitialState}) ->
KexInitPattern =
#ssh_msg_kexinit{
@@ -583,6 +582,40 @@ run_fake_ssh({ok,InitialState}) ->
{server2client, to_atoms(CompS2C)}]}].
+%%%----------------------------------------------------------------
+extract_algos(Spec) ->
+ [{Tag,get_atoms(List)} || {Tag,List} <- Spec].
+
+get_atoms(L) ->
+ lists:usort(
+ [ A || X <- L,
+ A <- case X of
+ {_,L1} when is_list(L1) -> L1;
+ Y when is_atom(Y) -> [Y]
+ end]).
+
+
+intersection(AlgoSpec1, AlgoSpec2) -> intersect(sort_spec(AlgoSpec1), sort_spec(AlgoSpec2)).
+
+intersect([{Tag,S1}|Ss1], [{Tag,S2}|Ss2]) ->
+ [{Tag,intersect(S1,S2)} | intersect(Ss1,Ss2)];
+intersect(L1=[A1|_], L2=[A2|_]) when is_atom(A1),is_atom(A2) ->
+ Diff = L1 -- L2,
+ L1 -- Diff;
+intersect(_, _) ->
+ [].
+
+intersect_bi_dir([{Tag,[{client2server,L1},{server2client,L2}]}|T]) ->
+ [{Tag,intersect(L1,L2)} | intersect_bi_dir(T)];
+intersect_bi_dir([H={_,[A|_]}|T]) when is_atom(A) ->
+ [H | intersect_bi_dir(T)];
+intersect_bi_dir([]) ->
+ [].
+
+
+sort_spec(L = [{_,_}|_] ) -> [{Tag,sort_spec(Es)} || {Tag,Es} <- L];
+sort_spec(L) -> lists:usort(L).
+
%%--------------------------------------------------------------------
sshc(Tag) ->
to_atoms(