aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-12-21 14:00:23 +0100
committerHans Nilsson <[email protected]>2015-12-21 14:00:23 +0100
commitb35e3c4d3ce7bfecbb4f93a8d5101e83bac7e606 (patch)
tree394bdfa86280163b905bc216e2237ab5a096b3bd /lib/ssh/test/ssh_test_lib.erl
parent21d6192389a04024f7a41ced9d0911a9cce6f4e8 (diff)
parent74faca0ac7e9e4f1d44ec43749aafe125d8a6371 (diff)
downloadotp-b35e3c4d3ce7bfecbb4f93a8d5101e83bac7e606.tar.gz
otp-b35e3c4d3ce7bfecbb4f93a8d5101e83bac7e606.tar.bz2
otp-b35e3c4d3ce7bfecbb4f93a8d5101e83bac7e606.zip
Merge branch 'hans/ssh/ssh_benchmark_SUITE' into maint
* hans/ssh/ssh_benchmark_SUITE: 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(