aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/test/asn1_SUITE.erl34
-rw-r--r--lib/asn1/test/asn1_SUITE_data/test_records.erl16
-rw-r--r--lib/asn1/test/asn1_app_test.erl24
-rw-r--r--lib/asn1/test/asn1_appup_test.erl4
-rw-r--r--lib/asn1/test/asn1_test_lib.erl8
-rw-r--r--lib/asn1/test/error_SUITE.erl4
-rw-r--r--lib/asn1/test/syntax_SUITE.erl2
-rw-r--r--lib/asn1/test/testContextSwitchingTypes.erl2
-rw-r--r--lib/asn1/test/testMegaco.erl4
-rw-r--r--lib/asn1/test/testMergeCompile.erl14
-rw-r--r--lib/asn1/test/testNBAPsystem.erl16
-rw-r--r--lib/asn1/test/testParameterizedInfObj.erl6
-rw-r--r--lib/asn1/test/testRfcs.erl4
-rw-r--r--lib/asn1/test/testSSLspecs.erl50
-rw-r--r--lib/asn1/test/testSeqOfIndefinite.erl14
-rw-r--r--lib/asn1/test/testTCAP.erl16
-rw-r--r--lib/asn1/test/test_compile_options.erl83
-rw-r--r--lib/asn1/test/test_modified_x420.erl2
-rw-r--r--lib/asn1/test/test_partial_incomplete_decode.erl58
-rw-r--r--lib/asn1/test/test_special_decode_performance.erl22
-rw-r--r--lib/asn1/test/test_undecoded_rest.erl2
-rw-r--r--lib/compiler/src/compile.erl44
-rw-r--r--lib/compiler/test/compile_SUITE.erl114
-rw-r--r--lib/eldap/src/Makefile2
-rw-r--r--lib/kernel/src/code_server.erl4
-rw-r--r--lib/kernel/test/code_SUITE.erl21
-rw-r--r--lib/kernel/test/error_logger_warn_SUITE.erl8
-rw-r--r--lib/percept/src/percept.erl6
-rw-r--r--lib/percept/test/egd_SUITE.erl336
-rw-r--r--lib/percept/test/ipc_tree.erl2
-rw-r--r--lib/percept/test/percept_SUITE.erl128
-rw-r--r--lib/percept/test/percept_db_SUITE.erl36
-rw-r--r--lib/public_key/doc/src/public_key.xml9
-rw-r--r--lib/public_key/src/public_key.erl10
-rw-r--r--lib/public_key/test/public_key_SUITE.erl53
-rw-r--r--lib/public_key/test/public_key_SUITE_data/ec_key.pem8
-rw-r--r--lib/public_key/test/public_key_SUITE_data/ec_pubkey.pem4
-rw-r--r--lib/sasl/src/systools_make.erl39
-rw-r--r--lib/ssh/src/ssh_info.erl193
-rw-r--r--lib/ssh/test/ssh_algorithms_SUITE.erl8
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_connection_SUITE.erl8
-rw-r--r--lib/ssh/test/ssh_options_SUITE.erl14
-rw-r--r--lib/ssh/test/ssh_protocol_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_renegotiate_SUITE.erl7
-rw-r--r--lib/ssh/test/ssh_sftp_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_sftpd_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_sup_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_to_openssh_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_upgrade_SUITE.erl2
-rw-r--r--lib/stdlib/src/filename.erl39
52 files changed, 857 insertions, 637 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl
index 7214c4b300..77f78b2716 100644
--- a/lib/asn1/test/asn1_SUITE.erl
+++ b/lib/asn1/test/asn1_SUITE.erl
@@ -34,7 +34,9 @@
%% Suite definition
%%------------------------------------------------------------------------------
-suite() -> [{ct_hooks, [ts_install_cth]}].
+suite() ->
+ [{ct_hooks, [ts_install_cth]},
+ {timetrap,{minutes,60}}].
all() ->
[{group, compile},
@@ -194,18 +196,13 @@ end_per_group(_GroupName, Config) ->
Config.
init_per_testcase(Func, Config) ->
- CaseDir = filename:join(?config(priv_dir, Config), Func),
+ CaseDir = filename:join(proplists:get_value(priv_dir, Config), Func),
ok = filelib:ensure_dir(filename:join([CaseDir, dummy_file])),
true = code:add_patha(CaseDir),
-
- Dog = case Func of
- testRfcs -> ct:timetrap({minutes, 90});
- _ -> ct:timetrap({minutes, 60})
- end,
- [{case_dir, CaseDir}, {watchdog, Dog}|Config].
+ [{case_dir, CaseDir}|Config].
end_per_testcase(_Func, Config) ->
- code:del_path(?config(case_dir, Config)).
+ code:del_path(proplists:get_value(case_dir, Config)).
%%------------------------------------------------------------------------------
%% Test runners
@@ -243,7 +240,7 @@ opts(Rule) when is_atom(Rule) -> [];
opts({_Rule, Opts}) -> Opts.
run_case(Config, Fun, Rule, Opts) ->
- CaseDir = ?config(case_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
Dir = filename:join([CaseDir, join(Rule, Opts)]),
ok = filelib:ensure_dir(filename:join([Dir, dummy_file])),
replace_path(CaseDir, Dir),
@@ -465,7 +462,7 @@ testSeqExtension(Config, Rule, Opts) ->
"SeqExtension2"],
Config,
[Rule|Opts]),
- DataDir = ?config(data_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
testSeqExtension:main(Rule, DataDir, [Rule|Opts]).
testSeqOptional(Config) -> test(Config, fun testSeqOptional/3).
@@ -585,8 +582,8 @@ constraint_equivalence(Config, Rule, Opts) ->
asn1_test_lib:compile(M, Config, [Rule|Opts]).
constraint_equivalence_abs(Config) ->
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
Asn1Spec = "ConstraintEquivalence",
Asn1Src = filename:join(DataDir, Asn1Spec),
ok = asn1ct:compile(Asn1Src, [abs,{outdir,CaseDir}]),
@@ -637,7 +634,7 @@ module_test(M0, Config, Rule, Opts) ->
%% value for 'Filter' is not guaranteed to terminate.
ok;
M ->
- TestOpts = [{i, ?config(case_dir, Config)}],
+ TestOpts = [{i, proplists:get_value(case_dir, Config)}],
case asn1ct:test(M, TestOpts) of
ok ->
ok;
@@ -768,7 +765,7 @@ testInfObjectClass(Config, Rule, Opts) ->
testUniqueObjectSets(Config) -> test(Config, fun testUniqueObjectSets/3).
testUniqueObjectSets(Config, Rule, Opts) ->
- CaseDir = ?config(case_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
testUniqueObjectSets:main(CaseDir, Rule, Opts).
testInfObjExtract(Config) -> test(Config, fun testInfObjExtract/3).
@@ -993,6 +990,9 @@ testS1AP(Config, Rule, Opts) ->
ok
end.
+testRfcs() ->
+ [{timetrap,{minutes,90}}].
+
testRfcs(Config) -> test(Config, fun testRfcs/3, [{ber,[der]}]).
testRfcs(Config, Rule, Opts) ->
case erlang:system_info(system_architecture) of
@@ -1136,7 +1136,7 @@ test_modules() ->
"CCSNARG3"].
test_OTP_9688(Config) ->
- PrivDir = ?config(case_dir, Config),
+ PrivDir = proplists:get_value(case_dir, Config),
Data = "
OTP-9688 DEFINITIONS ::= BEGIN
@@ -1172,12 +1172,10 @@ testTimer_uper(Config) ->
testTimer:go().
%% Test of multiple-line comment, OTP-8043
-testComment(suite) -> [];
testComment(Config) ->
asn1_test_lib:compile("Comment", Config, []),
asn1_test_lib:roundtrip('Comment', 'Seq', {'Seq',12,true}).
-testName2Number(suite) -> [];
testName2Number(Config) ->
N2NOptions = [{n2n,Type} || Type <- ['CauseMisc', 'CauseProtocol',
'CauseRadioNetwork',
diff --git a/lib/asn1/test/asn1_SUITE_data/test_records.erl b/lib/asn1/test/asn1_SUITE_data/test_records.erl
index 65716bb0dc..8f65d887c9 100644
--- a/lib/asn1/test/asn1_SUITE_data/test_records.erl
+++ b/lib/asn1/test/asn1_SUITE_data/test_records.erl
@@ -45,19 +45,19 @@ check_record_names({initiatingMessage,
transactionID = _TransactionID,
value = Value}}) ->
- ?line ok = check_record_ProcedureID(ProcedureID),
- ?line ok = check_record_Value(Value).
+ ok = check_record_ProcedureID(ProcedureID),
+ ok = check_record_Value(Value).
check_record_ProcedureID(#'ProcedureID'{}) ->
ok;
check_record_ProcedureID(_) -> false.
check_record_Value(#'ResourceStatusIndication'{protocolIEs = ProtocolIEs}) ->
- ?line ok = check_record_ProtocolIEs(ProtocolIEs);
+ ok = check_record_ProtocolIEs(ProtocolIEs);
check_record_Value(_) -> false.
check_record_ProtocolIEs([#'ProtocolIE-Field'{value =IndicationType}|_]) ->
- ?line ok = check_record_NFResourceStatusInd(IndicationType);
+ ok = check_record_NFResourceStatusInd(IndicationType);
check_record_ProtocolIEs(_) -> false.
check_record_NFResourceStatusInd({'no-Failure',#'No-Failure-ResourceStatusInd'{'local-Cell-InformationList'=[LCIPF]}}) ->
@@ -65,13 +65,13 @@ check_record_NFResourceStatusInd({'no-Failure',#'No-Failure-ResourceStatusInd'{'
check_record_NFResourceStatusInd(_) -> false.
'check_record_NFResourceStatusInd_ProtocolIE-Field'(#'ProtocolIE-Field'{value=LCI}) ->
- ?line ok = check_record_LCInfoResourceStatusInd(LCI);
+ ok = check_record_LCInfoResourceStatusInd(LCI);
'check_record_NFResourceStatusInd_ProtocolIE-Field'(_) -> false.
check_record_LCInfoResourceStatusInd(#'Local-Cell-InformationItem-ResourceStatusInd'{commonChannelsCapacityConsumptionLaw=[CCCCL],dedicatedChannelsCapacityConsumptionLaw=[DCCCL],'iE-Extensions' = [LCIRE]}) ->
- ?line ok = check_record_CCCCL(CCCCL),
- ?line ok = check_record_DCCCL(DCCCL),
- ?line ok = check_record_LCIRE(LCIRE).
+ ok = check_record_CCCCL(CCCCL),
+ ok = check_record_DCCCL(DCCCL),
+ ok = check_record_LCIRE(LCIRE).
check_record_CCCCL(#'CommonChannelsCapacityConsumptionLaw_SEQOF'{}) ->
ok;
diff --git a/lib/asn1/test/asn1_app_test.erl b/lib/asn1/test/asn1_app_test.erl
index 71aad5c62f..f226652b02 100644
--- a/lib/asn1/test/asn1_app_test.erl
+++ b/lib/asn1/test/asn1_app_test.erl
@@ -42,8 +42,6 @@ end_per_group(_GroupName, Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-init_per_suite(suite) -> [];
-init_per_suite(doc) -> [];
init_per_suite(Config) when is_list(Config) ->
case is_app(asn1) of
{ok, AppFile} ->
@@ -64,18 +62,13 @@ is_app(App) ->
end.
-end_per_suite(suite) -> [];
-end_per_suite(doc) -> [];
end_per_suite(Config) when is_list(Config) ->
Config.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-fields(suite) ->
- [];
-fields(doc) ->
- [];
+%% .
fields(Config) when is_list(Config) ->
AppFile = key1search(app_file, Config),
Fields = [vsn, description, modules, registered, applications],
@@ -103,10 +96,7 @@ check_field(Name, AppFile, Missing) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-modules(suite) ->
- [];
-modules(doc) ->
- [];
+%% .
modules(Config) when is_list(Config) ->
AppFile = key1search(app_file, Config),
Mods = key1search(modules, AppFile),
@@ -176,10 +166,7 @@ extra_modules(Mods, [Mod|Ebins], Extra) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-exportall(suite) ->
- [];
-exportall(doc) ->
- [];
+%% .
exportall(Config) when is_list(Config) ->
AppFile = key1search(app_file, Config),
Mods = key1search(modules, AppFile),
@@ -209,10 +196,7 @@ check_export_all([Mod|Mods]) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-app_depend(suite) ->
- [];
-app_depend(doc) ->
- [];
+%% .
app_depend(Config) when is_list(Config) ->
AppFile = key1search(app_file, Config),
Apps = key1search(applications, AppFile),
diff --git a/lib/asn1/test/asn1_appup_test.erl b/lib/asn1/test/asn1_appup_test.erl
index 7df6190f92..94c84f7c45 100644
--- a/lib/asn1/test/asn1_appup_test.erl
+++ b/lib/asn1/test/asn1_appup_test.erl
@@ -42,14 +42,10 @@ end_per_group(_GroupName, Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-init_per_suite(suite) -> [];
-init_per_suite(doc) -> [];
init_per_suite(Config) when is_list(Config) ->
Config.
-end_per_suite(suite) -> [];
-end_per_suite(doc) -> [];
end_per_suite(Config) when is_list(Config) ->
Config.
diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl
index dbb2600b41..21f00b0968 100644
--- a/lib/asn1/test/asn1_test_lib.erl
+++ b/lib/asn1/test/asn1_test_lib.erl
@@ -34,8 +34,8 @@ run_dialyzer() ->
compile(File, Config, Options) -> compile_all([File], Config, Options).
compile_all(Files, Config, Options) ->
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
[compile_file(filename:join(DataDir, F), [{outdir, CaseDir},
debug_info|Options])
|| F <- Files],
@@ -99,8 +99,8 @@ compile_file(File, Options) ->
end.
compile_erlang(Mod, Config, Options) ->
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
M = list_to_atom(Mod),
{ok, M} = compile:file(filename:join(DataDir, Mod),
[report,{i,CaseDir},{outdir,CaseDir}|Options]).
diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl
index caae845592..a8c6b894f1 100644
--- a/lib/asn1/test/error_SUITE.erl
+++ b/lib/asn1/test/error_SUITE.erl
@@ -929,8 +929,8 @@ values(Config) ->
run({Mod,Spec}, Config) ->
Base = atom_to_list(Mod) ++ ".asn1",
- File = filename:join(?config(priv_dir, Config), Base),
- Include0 = filename:dirname(?config(data_dir, Config)),
+ File = filename:join(proplists:get_value(priv_dir, Config), Base),
+ Include0 = filename:dirname(proplists:get_value(data_dir, Config)),
Include = filename:join(filename:dirname(Include0), "asn1_SUITE_data"),
ok = file:write_file(File, Spec),
asn1ct:compile(File, [{i, Include}]).
diff --git a/lib/asn1/test/syntax_SUITE.erl b/lib/asn1/test/syntax_SUITE.erl
index a354b75062..56b8f32ff7 100644
--- a/lib/asn1/test/syntax_SUITE.erl
+++ b/lib/asn1/test/syntax_SUITE.erl
@@ -305,7 +305,7 @@ run(List, File, Config) ->
run(List, File0, Config, Module) ->
Base = File0 ++ ".asn1",
- File = filename:join(?config(priv_dir, Config), Base),
+ File = filename:join(proplists:get_value(priv_dir, Config), Base),
case run_1(List, Base, File, Module, 0) of
0 -> ok;
Errors -> ?t:fail(Errors)
diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl
index 3779f61f2f..62fe4c2168 100644
--- a/lib/asn1/test/testContextSwitchingTypes.erl
+++ b/lib/asn1/test/testContextSwitchingTypes.erl
@@ -38,7 +38,7 @@ test(Config) ->
check_EXTERNAL(enc_dec('T', ValT_4)),
{ok,ValT2} = asn1ct:value('ContextSwitchingTypes', 'T',
- [{i,?config(case_dir, Config)}]),
+ [{i,proplists:get_value(case_dir, Config)}]),
io:format("ValT2 ~p~n",[ValT2]),
check_EXTERNAL(enc_dec('T', ValT2)),
diff --git a/lib/asn1/test/testMegaco.erl b/lib/asn1/test/testMegaco.erl
index 61794ec02d..e298622a0f 100644
--- a/lib/asn1/test/testMegaco.erl
+++ b/lib/asn1/test/testMegaco.erl
@@ -32,13 +32,13 @@ compile(Config, Erule, Options) ->
main(no_module,_) -> ok;
main('OLD-MEDIA-GATEWAY-CONTROL',Config) ->
- CaseDir = ?config(case_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
{ok,Msg} = asn1ct:value('OLD-MEDIA-GATEWAY-CONTROL','MegacoMessage',
[{i, CaseDir}]),
asn1_test_lib:roundtrip('OLD-MEDIA-GATEWAY-CONTROL', 'MegacoMessage', Msg),
ok;
main('MEDIA-GATEWAY-CONTROL'=Mod, Config) ->
- DataDir = ?config(data_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
Files = filelib:wildcard(filename:join([DataDir,megacomessages,"*.val"])),
lists:foreach(fun(File) ->
{ok,Bin} = file:read_file(File),
diff --git a/lib/asn1/test/testMergeCompile.erl b/lib/asn1/test/testMergeCompile.erl
index 5011c7d576..1feac361e1 100644
--- a/lib/asn1/test/testMergeCompile.erl
+++ b/lib/asn1/test/testMergeCompile.erl
@@ -66,16 +66,16 @@ main(Erule) ->
mvrasn(Erule) ->
case Erule of
ber ->
- ?line ok = test(isd),
- ?line ok = test(isd2),
- ?line ok = test(dsd),
- ?line ok = test(ul_res),
- ?line ok = test(seqofseq),
- ?line ok = test('InsertSubscriberDataArg');
+ ok = test(isd),
+ ok = test(isd2),
+ ok = test(dsd),
+ ok = test(ul_res),
+ ok = test(seqofseq),
+ ok = test('InsertSubscriberDataArg');
_ ->
ok
end,
- ?line ok = test(mvrasn6,'InsertSubscriberDataArg').
+ ok = test(mvrasn6,'InsertSubscriberDataArg').
test(isd)->
EncPdu = <<48,128,129,7,145,148,113,50,1,0,241,131,1,0,176,128,5,0,
diff --git a/lib/asn1/test/testNBAPsystem.erl b/lib/asn1/test/testNBAPsystem.erl
index 2a7e39597a..956da1e632 100644
--- a/lib/asn1/test/testNBAPsystem.erl
+++ b/lib/asn1/test/testNBAPsystem.erl
@@ -92,23 +92,23 @@ compile(Config, Options) ->
test(_Erule,Config) ->
- ?line ok = enc_audit_req_msg(),
- ?line ok = cell_setup_req_msg_test(),
+ ok = enc_audit_req_msg(),
+ ok = cell_setup_req_msg_test(),
ticket_5812(Config).
ticket_5812(Config) ->
- ?line Msg = v_5812(),
+ Msg = v_5812(),
{ok,B2} = 'NBAP-PDU-Discriptions':encode('NBAP-PDU', Msg),
V = <<0,28,74,0,3,48,0,0,1,0,123,64,41,0,0,0,126,64,35,95,208,2,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,145,0,1,205,0,0,0,0,2,98,64,1,128>>,
- ?line ok = compare(V,B2),
+ ok = compare(V,B2),
{ok,Msg2} = 'NBAP-PDU-Discriptions':decode('NBAP-PDU', B2),
- ?line ok = check_record_names(Msg2,Config).
+ ok = check_record_names(Msg2,Config).
enc_audit_req_msg() ->
Msg = {initiatingMessage, audit_req_msg()},
{ok,B} = 'NBAP-PDU-Discriptions':encode('NBAP-PDU', Msg),
{ok,_Msg} = 'NBAP-PDU-Discriptions':decode('NBAP-PDU', B),
- ?line {initiatingMessage,
+ {initiatingMessage,
#'InitiatingMessage'{value=#'AuditRequest'{protocolIEs=[{_,114,ignore,_}],
protocolExtensions = asn1_NOVALUE}}} = _Msg,
io:format("Msg: ~n~P~n~n_Msg:~n~P~n",[Msg,15,_Msg,15]),
@@ -285,8 +285,8 @@ compare(_,_) ->
false.
check_record_names(Msg,Config) ->
- DataDir = ?config(data_dir,Config),
- CaseDir = ?config(case_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
+ CaseDir = proplists:get_value(case_dir,Config),
{ok, test_records} = compile:file(filename:join([DataDir, "test_records"]),
[{i, CaseDir}]),
ok = test_records:'check_record_names_OTP-5812'(Msg).
diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl
index 8b0353522d..d7bcde963b 100644
--- a/lib/asn1/test/testParameterizedInfObj.erl
+++ b/lib/asn1/test/testParameterizedInfObj.erl
@@ -97,7 +97,7 @@ roundtrip(T, V) ->
ranap(_Erule) ->
PIEVal2 = [{'ProtocolIE-Field',4,ignore,{radioNetwork,'rab-pre-empted'}}],
- ?line Val2 =
+ Val2 =
#'InitiatingMessage'{procedureCode=1,
criticality=ignore,
value=#'Iu-ReleaseCommand'{protocolIEs=PIEVal2,
@@ -121,8 +121,8 @@ param2(Config, Erule) ->
{'ProtocolIE-Field',101,true}]}),
%% Now remove the data after the extension mark in the object set.
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
Asn1SrcBase = "Param2.asn1",
Asn1SrcFile0 = filename:join(DataDir, Asn1SrcBase),
{ok,Src0} = file:read_file(Asn1SrcFile0),
diff --git a/lib/asn1/test/testRfcs.erl b/lib/asn1/test/testRfcs.erl
index fa4389b904..e110f87edd 100644
--- a/lib/asn1/test/testRfcs.erl
+++ b/lib/asn1/test/testRfcs.erl
@@ -27,11 +27,11 @@
compile(Config, Erules, Options0) ->
Options = [no_ok_wrapper|Options0],
- DataDir = ?config(data_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
Specs0 = filelib:wildcard("*.asn1", filename:join(DataDir, rfcs)),
Specs = [filename:join(rfcs, Spec) || Spec <- Specs0],
122 = length(Specs),
- CaseDir = ?config(case_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
asn1_test_lib:compile_all(Specs, Config, [Erules,{i,CaseDir}|Options]).
test() ->
diff --git a/lib/asn1/test/testSSLspecs.erl b/lib/asn1/test/testSSLspecs.erl
index 7dc7eedd50..5d5f749d37 100644
--- a/lib/asn1/test/testSSLspecs.erl
+++ b/lib/asn1/test/testSSLspecs.erl
@@ -26,8 +26,8 @@
-include_lib("common_test/include/ct.hrl").
compile(Config, Options) ->
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
NewOptions = [{i, DataDir}, {i, CaseDir}|Options],
asn1_test_lib:compile_all(["SSL-PKIX", "PKIXAttributeCertificate"],
@@ -44,16 +44,16 @@ compile(Config, Options) ->
Config, NewOptions).
compile_combined(Config, ber=Rule) ->
- DataDir = ?config(data_dir, Config),
- CaseDir = ?config(case_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
+ CaseDir = proplists:get_value(case_dir, Config),
Options = [{i, CaseDir}, {i, DataDir}, Rule,
der, compact_bit_string, asn1config],
ok = remove_db_files_combined(CaseDir),
asn1_test_lib:compile("OTP-PKIX.set.asn", Config, Options).
remove_db_files(Dir) ->
- ?line ok = remove_db_file(Dir ++ "PKIX1Explicit93.asn1db"),
- ?line ok = remove_db_file(Dir ++ "PKIX1Implicit93.asn1db").
+ ok = remove_db_file(Dir ++ "PKIX1Explicit93.asn1db"),
+ ok = remove_db_file(Dir ++ "PKIX1Implicit93.asn1db").
remove_db_file(File) ->
case file:delete(File) of
ok ->
@@ -65,23 +65,23 @@ remove_db_file(File) ->
end.
remove_db_files_combined(Dir) ->
- ?line ok = remove_db_file(Dir ++ "OTP-PKIX.asn1db"),
- ?line ok = remove_db_file(Dir ++ "SSL-PKIX.asn1db"),
- ?line ok = remove_db_file(Dir ++ "PKIXAttributeCertificate.asn1db"),
- ?line ok = remove_db_file(Dir ++ "PKIX1Algorithms88.asn1db"),
- ?line ok = remove_db_file(Dir ++ "PKIX1Explicit88.asn1db"),
- ?line ok = remove_db_file(Dir ++ "PKIX1Implicit88.asn1db").
+ ok = remove_db_file(Dir ++ "OTP-PKIX.asn1db"),
+ ok = remove_db_file(Dir ++ "SSL-PKIX.asn1db"),
+ ok = remove_db_file(Dir ++ "PKIXAttributeCertificate.asn1db"),
+ ok = remove_db_file(Dir ++ "PKIX1Algorithms88.asn1db"),
+ ok = remove_db_file(Dir ++ "PKIX1Explicit88.asn1db"),
+ ok = remove_db_file(Dir ++ "PKIX1Implicit88.asn1db").
run(ber) ->
run1(1).
run1(6) ->
- ?line f1(6),
- ?line f2(6),
- ?line transform4(ex(7));
+ f1(6),
+ f2(6),
+ transform4(ex(7));
run1(N) ->
- ?line f1(N),
- ?line f2(N),
+ f1(N),
+ f2(N),
run1(N+1).
@@ -93,22 +93,22 @@ f2(N) ->
transform1(ATAV) ->
- ?line {ok, ATAVEnc} = 'PKIX1Explicit88':encode('AttributeTypeAndValue',
+ {ok, ATAVEnc} = 'PKIX1Explicit88':encode('AttributeTypeAndValue',
ATAV),
- ?line {ok, _ATAVDec} = 'SSL-PKIX':decode('AttributeTypeAndValue',
+ {ok, _ATAVDec} = 'SSL-PKIX':decode('AttributeTypeAndValue',
ATAVEnc).
transform2(ATAV) ->
- ?line {ok, ATAVEnc} = 'PKIX1Explicit88':encode('AttributeTypeAndValue',
+ {ok, ATAVEnc} = 'PKIX1Explicit88':encode('AttributeTypeAndValue',
ATAV),
- ?line {ok, _ATAVDec} = 'PKIX1Explicit88':decode('AttributeTypeAndValue',
+ {ok, _ATAVDec} = 'PKIX1Explicit88':decode('AttributeTypeAndValue',
ATAVEnc).
transform4(ATAV) ->
- ?line {ok, ATAVEnc} = 'PKIX1Explicit88':encode('Attribute',
+ {ok, ATAVEnc} = 'PKIX1Explicit88':encode('Attribute',
ATAV),
- ?line {ok, _ATAVDec} = 'PKIX1Explicit88':decode('Attribute',
+ {ok, _ATAVDec} = 'PKIX1Explicit88':decode('Attribute',
ATAVEnc).
@@ -144,8 +144,8 @@ ex(7) ->
run_combined(ber) ->
Cert = cert(),
- ?line {ok,{'CertificatePKIX1Explicit88',{Type,UnDec},_,_}} = 'OTP-PKIX':decode_TBSCert_exclusive(Cert),
- ?line {ok,_} = 'OTP-PKIX':decode_part(Type,UnDec),
+ {ok,{'CertificatePKIX1Explicit88',{Type,UnDec},_,_}} = 'OTP-PKIX':decode_TBSCert_exclusive(Cert),
+ {ok,_} = 'OTP-PKIX':decode_part(Type,UnDec),
ok.
cert() ->
diff --git a/lib/asn1/test/testSeqOfIndefinite.erl b/lib/asn1/test/testSeqOfIndefinite.erl
index bebd516c5c..e28b9e0fd3 100644
--- a/lib/asn1/test/testSeqOfIndefinite.erl
+++ b/lib/asn1/test/testSeqOfIndefinite.erl
@@ -25,13 +25,13 @@
-include_lib("common_test/include/ct.hrl").
main() ->
- ?line ok = test(isd),
- ?line ok = test(isd2),
- ?line ok = test(dsd),
- ?line ok = test(ul_res),
- ?line ok = test(prim),
- ?line ok = test(seqofseq),
- ?line ok = test('InsertSubscriberDataArg'). % OTP-4232
+ ok = test(isd),
+ ok = test(isd2),
+ ok = test(dsd),
+ ok = test(ul_res),
+ ok = test(prim),
+ ok = test(seqofseq),
+ ok = test('InsertSubscriberDataArg'). % OTP-4232
test(isd)->
EncPdu = <<48,128,129,7,145,148,113,50,1,0,241,131,1,0,176,128,5,0,
diff --git a/lib/asn1/test/testTCAP.erl b/lib/asn1/test/testTCAP.erl
index 6e777875f6..48a9f049ca 100644
--- a/lib/asn1/test/testTCAP.erl
+++ b/lib/asn1/test/testTCAP.erl
@@ -39,7 +39,6 @@ compile_asn1config(Config, Options) ->
asn1_test_lib:compile_erlang("TCAPPackage_msg", Config, []).
test(Erule,_Config) ->
-% ?line OutDir = ?config(priv_dir,Config),
%% testing OTP-4798, open type encoded with indefinite length
{ok,_Res} = 'TCAPMessages-simple':decode('MessageType',
val_OTP_4798(Erule)),
@@ -49,20 +48,17 @@ test(Erule,_Config) ->
val_OTP_4799(Erule)),
%% testing vance shipley's problems. Parameterized object sets.
- ?line Val3 = 'TCAPPackage_msg':val('PackageType',unidirectional),
+ Val3 = 'TCAPPackage_msg':val('PackageType',unidirectional),
Res3 = enc_dec('PackageType', Val3),
- ?line ok = 'TCAPPackage_msg':check_result('PackageType',unidirectional,Res3),
-%% ?line io:format("Res3:~n~p~n~n",[Res3]),
+ ok = 'TCAPPackage_msg':check_result('PackageType',unidirectional,Res3),
- ?line Val4 = 'TCAPPackage_msg':val('PackageType',abort),
+ Val4 = 'TCAPPackage_msg':val('PackageType',abort),
Res4 = enc_dec('PackageType', Val4),
- ?line ok = 'TCAPPackage_msg':check_result('PackageType',abort,Res4),
-%% ?line io:format("Res4:~n~p~n~n",[Res4]),
+ ok = 'TCAPPackage_msg':check_result('PackageType',abort,Res4),
- ?line Val5 = 'TCAPPackage_msg':val('PackageType',response),
+ Val5 = 'TCAPPackage_msg':val('PackageType',response),
Res5 = enc_dec('PackageType', Val5),
- ?line ok = 'TCAPPackage_msg':check_result('PackageType',response,Res5).
-%% ?line io:format("Res5:~n~p~n~n",[Res5]).
+ ok = 'TCAPPackage_msg':check_result('PackageType',response,Res5).
val_OTP_4798(ber) ->
[100,129,176,73,4,57,3,17,80,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,14,2,162,3,2,1,0,163,5,161,3,2,1,0,108,128,162,120,2,1,0,48,115,2,1,56,48,128,48,34,4,16,203,87,215,196,217,93,235,90,64,131,106,145,39,26,25,236,4,4,197,241,81,112,4,8,78,225,34,196,215,212,200,0,48,34,4,16,145,125,27,67,42,144,6,161,207,112,55,75,200,191,191,28,4,4,226,219,242,123,4,8,72,46,130,28,206,178,168,0,48,34,4,16,1,8,20,29,70,160,218,160,125,188,244,174,113,115,253,245,4,4,26,5,90,160,4,8,252,75,149,98,153,224,140,0,0,0,0,0];
diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl
index 1af614f49a..ea67514229 100644
--- a/lib/asn1/test/test_compile_options.erl
+++ b/lib/asn1/test/test_compile_options.erl
@@ -39,50 +39,49 @@ wrong_path(Config) ->
end.
comp(Parent,Config) ->
- DataDir = ?config(data_dir,Config),
- OutDir = ?config(priv_dir,Config),
- ?line Err=asn1ct:compile(DataDir++"NoImport",[{i,OutDir},{i,filename:join([DataDir,"subdir"])},{outdir,OutDir}]),
+ DataDir = proplists:get_value(data_dir,Config),
+ OutDir = proplists:get_value(priv_dir,Config),
+ Err=asn1ct:compile(DataDir++"NoImport",[{i,OutDir},{i,filename:join([DataDir,"subdir"])},{outdir,OutDir}]),
Parent!Err.
%% OTP-5701
path(Config) ->
- DataDir = ?config(data_dir,Config),
- OutDir = ?config(priv_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
+ OutDir = proplists:get_value(priv_dir,Config),
{ok,CWD} = file:get_cwd(),
- ?line file:set_cwd(filename:join([DataDir,subdir])),
+ file:set_cwd(filename:join([DataDir,subdir])),
ok = asn1ct:compile("../MyMerge.set.asn",[{outdir,OutDir}]),
- ?line ok=outfiles_check(OutDir),
- ?line outfiles_remove(OutDir),
+ ok=outfiles_check(OutDir),
+ outfiles_remove(OutDir),
file:set_cwd(filename:join([DataDir,subdir,subsubdir])),
ok = asn1ct:compile('../../MyMerge.set.asn',[{i,'..'},{outdir,OutDir}]),
- ?line ok=outfiles_check(OutDir,outfiles2()),
+ ok=outfiles_check(OutDir,outfiles2()),
file:set_cwd(CWD),
ok.
ticket_6143(Config) -> asn1_test_lib:compile("AA1", Config, []).
noobj(Config) ->
- DataDir = ?config(data_dir,Config),
- OutDir = ?config(priv_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
+ OutDir = proplists:get_value(priv_dir,Config),
code:purge('P-Record'),
file:delete(filename:join([OutDir,'P-Record.erl'])),
file:delete(filename:join([OutDir,'P-Record.beam'])),
- ?line ok=asn1ct:compile(filename:join([DataDir,"P-Record"]),
+ ok=asn1ct:compile(filename:join([DataDir,"P-Record"]),
[noobj,{outdir,OutDir}]),
-% ?line false = code:is_loaded('P-Record'),
- ?line {ok,_} = file:read_file_info(filename:join([OutDir,
+ {ok,_} = file:read_file_info(filename:join([OutDir,
"P-Record.erl"])),
- ?line {error,enoent} =
+ {error,enoent} =
file:read_file_info(filename:join([OutDir,"P-Record.beam"])),
- ?line {ok,_} = c:c(filename:join([OutDir,'P-Record']),
+ {ok,_} = c:c(filename:join([OutDir,'P-Record']),
[{i,OutDir},{outdir,OutDir}]),
- ?line {file,_} = code:is_loaded('P-Record'),
+ {file,_} = code:is_loaded('P-Record'),
code:purge('P-Record'),
code:delete('P-Record'),
@@ -94,43 +93,41 @@ noobj(Config) ->
file:delete(filename:join([OutDir,'p_record.beam'])),
ok = asn1ct:compile(filename:join([DataDir,"p_record.set.asn"]),
[asn1config,ber,noobj,{outdir,OutDir}]),
-%% ?line false = code:is_loaded('P-Record'),
-%% ?line false = code:is_loaded('p_record'),
- ?line {error,enoent} =
+ {error,enoent} =
file:read_file_info(filename:join([OutDir,"P-Record.beam"])),
- ?line {error,enoent} =
+ {error,enoent} =
file:read_file_info(filename:join([OutDir,"P-Record.erl"])),
- ?line {error,enoent} =
+ {error,enoent} =
file:read_file_info(filename:join([OutDir,"p_record.beam"])),
io:format("read_file_info: p_record.erl~n",[]),
- ?line {ok,_} =
+ {ok,_} =
file:read_file_info(filename:join([OutDir,"p_record.erl"])),
io:format("c:c: p_record.erl~n",[]),
- ?line {ok,_} = c:c(filename:join([OutDir,'p_record']),
+ {ok,_} = c:c(filename:join([OutDir,'p_record']),
[{i,OutDir},{outdir,OutDir}]),
io:format("code:is_loaded: p_record.erl~n",[]),
- ?line {file,_} = code:is_loaded('p_record'),
+ {file,_} = code:is_loaded('p_record'),
io:format("file:delete: p_record.erl~n",[]),
file:delete(filename:join([OutDir,'p_record.erl'])),
file:delete(filename:join([OutDir,'p_record.beam'])).
verbose(Config) when is_list(Config) ->
- DataDir = ?config(data_dir,Config),
- OutDir = ?config(priv_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
+ OutDir = proplists:get_value(priv_dir,Config),
Asn1File = filename:join([DataDir,"Comment.asn"]),
%% Test verbose compile
- ?line test_server:capture_start(),
- ?line ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj,verbose]),
- ?line test_server:capture_stop(),
- ?line [Line0|_] = test_server:capture_get(),
- ?line true = lists:prefix("Erlang ASN.1 compiler", Line0),
+ test_server:capture_start(),
+ ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj,verbose]),
+ test_server:capture_stop(),
+ [Line0|_] = test_server:capture_get(),
+ true = lists:prefix("Erlang ASN.1 compiler", Line0),
%% Test non-verbose compile
- ?line test_server:capture_start(),
- ?line ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj]),
- ?line test_server:capture_stop(),
- ?line [] = test_server:capture_get(),
+ test_server:capture_start(),
+ ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj]),
+ test_server:capture_stop(),
+ [] = test_server:capture_get(),
ok.
outfiles_check(OutDir) ->
@@ -141,7 +138,7 @@ outfiles_check(_OutDir,[])->
ok;
outfiles_check(OutDir,[H|T]) ->
io:format("File: ~p~n",[filename:join([OutDir,H])]),
- ?line {ok,_}=file:read_file_info(filename:join([OutDir,H])),
+ {ok,_}=file:read_file_info(filename:join([OutDir,H])),
outfiles_check(OutDir,T).
outfiles1() ->
@@ -155,8 +152,8 @@ outfiles_remove(OutDir) ->
outfiles1()).
record_name_prefix(Config) ->
- DataDir = ?config(data_dir,Config),
- OutDir = ?config(priv_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
+ OutDir = proplists:get_value(priv_dir,Config),
ok = b_SeqIn(DataDir,OutDir),
ok = a_SeqIn(DataDir,OutDir).
@@ -165,15 +162,15 @@ b_SeqIn(DataDir,OutDir) ->
[{record_name_prefix,"b_"},{outdir,OutDir}]),
io:format("FileName: ~p~nOutDir:~p~n",
[filename:join([DataDir,'b_SeqIn']),OutDir]),
- ?line {ok,_} = compile:file(filename:join([DataDir,'b_SeqIn']),
+ {ok,_} = compile:file(filename:join([DataDir,'b_SeqIn']),
[{i,OutDir}]),
- ?line 'b_SeqIn' = b_SeqIn:record_name(),
+ 'b_SeqIn' = b_SeqIn:record_name(),
ok.
a_SeqIn(DataDir,OutDir) ->
asn1ct:compile(filename:join([DataDir,'Seq']),
[{record_name_prefix,"a_"},{outdir,OutDir}]),
- ?line {ok,_} = compile:file(filename:join([DataDir,'a_SeqIn']),
+ {ok,_} = compile:file(filename:join([DataDir,'a_SeqIn']),
[{i,OutDir}]),
- ?line 'a_SeqIn' = a_SeqIn:record_name(),
+ 'a_SeqIn' = a_SeqIn:record_name(),
ok.
diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl
index c0a32e2a37..a83d522764 100644
--- a/lib/asn1/test/test_modified_x420.erl
+++ b/lib/asn1/test/test_modified_x420.erl
@@ -24,7 +24,7 @@
-include_lib("common_test/include/ct.hrl").
test(Config) ->
- DataDir = ?config(data_dir,Config),
+ DataDir = proplists:get_value(data_dir,Config),
Der = read_pem(filename:join([DataDir,modified_x420,"p7_signed_data.pem"])),
{ok,{_,_,SignedData}} = 'PKCS7':decode( 'ContentInfo', Der),
diff --git a/lib/asn1/test/test_partial_incomplete_decode.erl b/lib/asn1/test/test_partial_incomplete_decode.erl
index 64f2ce22ae..2b1c3bd8c5 100644
--- a/lib/asn1/test/test_partial_incomplete_decode.erl
+++ b/lib/asn1/test/test_partial_incomplete_decode.erl
@@ -67,7 +67,7 @@ test(Config) ->
ok.
test_megaco(Config) ->
- DataDir = ?config(data_dir, Config),
+ DataDir = proplists:get_value(data_dir, Config),
Files = filelib:wildcard(filename:join([DataDir,megacomessages,"*.val"])),
Mod = 'MEDIA-GATEWAY-CONTROL',
lists:foreach(fun(File) ->
@@ -81,72 +81,72 @@ test_megaco(Config) ->
exclusive_decode(Bin,F) ->
Mod='MEDIA-GATEWAY-CONTROL',
io:format("Encoding message: ~p~n",[F]),
- ?line {ok,{_,_,{_,_VsnNo,{MsgMidKey,MsgMid},{MsgMBodyKey,MsgMBody}}}}=
+ {ok,{_,_,{_,_VsnNo,{MsgMidKey,MsgMid},{MsgMBodyKey,MsgMBody}}}}=
Mod:decode_MegacoMessage_exclusive(Bin),
- ?line {ok,_} = Mod:decode_part(MsgMidKey,MsgMid),
- ?line {ok,_} = Mod:decode_part(MsgMBodyKey,MsgMBody),
+ {ok,_} = Mod:decode_part(MsgMidKey,MsgMid),
+ {ok,_} = Mod:decode_part(MsgMBodyKey,MsgMBody),
ok.
decode_parts('F',PartDecMsg) ->
- ?line {fb,{'E',35,{NameE_b,ListBinE_b},false,{NameE_d,BinE_d}}} = PartDecMsg,
- ?line {ok,[{'D',3,true}|_]} = 'PartialDecSeq':decode_part(NameE_b,ListBinE_b),
- ?line {ok,{'D',3,true}} = 'PartialDecSeq':decode_part(NameE_b,
+ {fb,{'E',35,{NameE_b,ListBinE_b},false,{NameE_d,BinE_d}}} = PartDecMsg,
+ {ok,[{'D',3,true}|_]} = 'PartialDecSeq':decode_part(NameE_b,ListBinE_b),
+ {ok,{'D',3,true}} = 'PartialDecSeq':decode_part(NameE_b,
hd(ListBinE_b)),
- ?line {ok,{da,[{'A',16,{'D',17,true}}]}} =
+ {ok,{da,[{'A',16,{'D',17,true}}]}} =
'PartialDecSeq':decode_part(NameE_d,BinE_d),
ok;
decode_parts('F2',PartDecMsg) ->
- ?line {fb,{'E',35,{E_bkey,E_b},false,{da,{E_d_akey,E_d_a}}}} = PartDecMsg,
- ?line {ok,[{'D',3,true},{'D',4,false},{'D',5,true},{'D',6,true},{'D',7,false},{'D',8,true},{'D',9,true},{'D',10,false},{'D',11,true},{'D',12,true},{'D',13,false},{'D',14,true}]} = 'PartialDecSeq':decode_part(E_bkey,E_b),
- ?line {ok,[{'A',16,{'D',17,true}}]} = 'PartialDecSeq':decode_part(E_d_akey,E_d_a);
+ {fb,{'E',35,{E_bkey,E_b},false,{da,{E_d_akey,E_d_a}}}} = PartDecMsg,
+ {ok,[{'D',3,true},{'D',4,false},{'D',5,true},{'D',6,true},{'D',7,false},{'D',8,true},{'D',9,true},{'D',10,false},{'D',11,true},{'D',12,true},{'D',13,false},{'D',14,true}]} = 'PartialDecSeq':decode_part(E_bkey,E_b),
+ {ok,[{'A',16,{'D',17,true}}]} = 'PartialDecSeq':decode_part(E_d_akey,E_d_a);
decode_parts('F3',PartDecMsg) ->
- ?line {fb,{'E',10,{E_bkey,E_b},false,{dc,{'E_d_dc',13,true,{E_d_dc_dcckey,E_d_dc_dcc}}}}} = PartDecMsg,
- ?line {ok,[{'D',11,true},{'D',12,false}]} = 'PartialDecSeq':decode_part(E_bkey,E_b),
- ?line {ok,{'E_d_dc_dcc',14,15}} = 'PartialDecSeq':decode_part(E_d_dc_dcckey,E_d_dc_dcc);
+ {fb,{'E',10,{E_bkey,E_b},false,{dc,{'E_d_dc',13,true,{E_d_dc_dcckey,E_d_dc_dcc}}}}} = PartDecMsg,
+ {ok,[{'D',11,true},{'D',12,false}]} = 'PartialDecSeq':decode_part(E_bkey,E_b),
+ {ok,{'E_d_dc_dcc',14,15}} = 'PartialDecSeq':decode_part(E_d_dc_dcckey,E_d_dc_dcc);
decode_parts('D',PartDecMsg) ->
- ?line {'D',{NameD_a,BinD_a},true} = PartDecMsg,
- ?line {ok,123} = 'PartialDecSeq':decode_part(NameD_a,BinD_a),
+ {'D',{NameD_a,BinD_a},true} = PartDecMsg,
+ {ok,123} = 'PartialDecSeq':decode_part(NameD_a,BinD_a),
ok;
decode_parts('A',PartDecMsg) ->
- ?line {'A',12,{c,{'S',true,false}},{b,{NameA_c_b,BinA_c_b}}} = PartDecMsg,
- ?line {ok,{'A_c_b',false,false}} =
+ {'A',12,{c,{'S',true,false}},{b,{NameA_c_b,BinA_c_b}}} = PartDecMsg,
+ {ok,{'A_c_b',false,false}} =
'PartialDecSeq2':decode_part(NameA_c_b,BinA_c_b),
ok;
decode_parts('GetRequest',PartDecMsg) ->
- ?line {'GetRequest',true,false,
+ {'GetRequest',true,false,
{'AcceptTypes',[html,'plain-text',gif,jpeg],
{NameAcceptTypes_others,ListBinAcceptTypes_others}},
"IamfineThankYOu"} = PartDecMsg,
- ?line {ok,["hell","othe","reho","peyo","uare","fine"]} =
+ {ok,["hell","othe","reho","peyo","uare","fine"]} =
'PartialDecMyHTTP':decode_part(NameAcceptTypes_others,
ListBinAcceptTypes_others),
- ?line {ok,"hell"} =
+ {ok,"hell"} =
'PartialDecMyHTTP':decode_part(NameAcceptTypes_others,
hd(ListBinAcceptTypes_others)),
ok;
decode_parts('S1_1',PartDecMsg) ->
- ?line {'S1',14,{'S2',false,12,{NameS2c,BinS2c}},
+ {'S1',14,{'S2',false,12,{NameS2c,BinS2c}},
{_,{NameS1c_a,ListBinS1c_a}},{NameS1d,BinS1d}} = PartDecMsg,
- ?line {ok,[{'S3',10,"PrintableString","OCTETSTRING",
+ {ok,[{'S3',10,"PrintableString","OCTETSTRING",
[one,two,three,four]}|_Rest1]} =
'PartialDecSeq3':decode_part(NameS2c,BinS2c),
- ?line {ok,[{'S3',10,"PrintableString","OCTETSTRING",
+ {ok,[{'S3',10,"PrintableString","OCTETSTRING",
[one,two,three,four]}|_Rest2]} =
'PartialDecSeq3':decode_part(NameS1c_a,ListBinS1c_a),
- ?line {ok,{'S3',10,"PrintableString","OCTETSTRING",
+ {ok,{'S3',10,"PrintableString","OCTETSTRING",
[one,two,three,four]}} =
'PartialDecSeq3':decode_part(NameS1c_a,hd(ListBinS1c_a)),
- ?line {ok,[{'Name',"Hans","HCA","Andersen"}|_Rest3]} =
+ {ok,[{'Name',"Hans","HCA","Andersen"}|_Rest3]} =
'PartialDecSeq3':decode_part(NameS1d,BinS1d),
ok;
decode_parts('S1_2',PartDecMsg) ->
- ?line {'S1',14,{'S2',false,12,_S2c},S1c_b,{NameS1d,BinS1d}} = PartDecMsg,
- ?line {b,{'C1_b',11,true,
+ {'S1',14,{'S2',false,12,_S2c},S1c_b,{NameS1d,BinS1d}} = PartDecMsg,
+ {b,{'C1_b',11,true,
{'S4',{'Name',"Hans","HCA","Andersen"},"MSc"}}}=S1c_b,
- ?line {ok,[{'Name',"Hans","HCA","Andersen"}|_Rest3]} =
+ {ok,[{'Name',"Hans","HCA","Andersen"}|_Rest3]} =
'PartialDecSeq3':decode_part(NameS1d,BinS1d),
ok.
diff --git a/lib/asn1/test/test_special_decode_performance.erl b/lib/asn1/test/test_special_decode_performance.erl
index 6cf7ee2805..55e64b61e0 100644
--- a/lib/asn1/test/test_special_decode_performance.erl
+++ b/lib/asn1/test/test_special_decode_performance.erl
@@ -27,29 +27,29 @@
go(all) ->
{Time_S_s,Time_S_e,Time_S_c}=go(10000,'PartialDecSeq'),
{Time_MGC_s,Time_MGC_e,Time_MGC_c}=go(10000,'MEDIA-GATEWAY-CONTROL'),
- ?line do_comment({Time_S_s,Time_MGC_s},
+ do_comment({Time_S_s,Time_MGC_s},
{Time_S_e,Time_MGC_e},
{Time_S_c,Time_MGC_c}).
go(N,Mod) ->
{Type,Val} = val(Mod),
{ok,B} = Mod:encode(Type, Val),
- ?line go(Mod,B,N).
+ go(Mod,B,N).
go(Mod,Bin,N) ->
- ?line FsS = get_selective_funcs(Mod),
- ?line FsE = get_exclusive_funcs(Mod),
- ?line io:format("~nSize of value for module ~p: ~p bytes.~n~n",[Mod,size(Bin)]),
- ?line Time_s=go1(selective,Mod,FsS,Bin,N,0),
- ?line Time_e=go1(exclusive,Mod,FsE,Bin,N,0),
- ?line Time_c=go1(common,Mod,[decode],Bin,N,0),
- ?line {Time_s/length(FsS),Time_e/length(FsE),Time_c}.
+ FsS = get_selective_funcs(Mod),
+ FsE = get_exclusive_funcs(Mod),
+ io:format("~nSize of value for module ~p: ~p bytes.~n~n",[Mod,size(Bin)]),
+ Time_s=go1(selective,Mod,FsS,Bin,N,0),
+ Time_e=go1(exclusive,Mod,FsE,Bin,N,0),
+ Time_c=go1(common,Mod,[decode],Bin,N,0),
+ {Time_s/length(FsS),Time_e/length(FsE),Time_c}.
go1(_,_,[],_,_,AccTime) ->
- ?line AccTime;
+ AccTime;
%% go1 for common decode
go1(common,Mod,_,Bin,N,_) ->
- ?line TT=get_top_type(Mod),
+ TT=get_top_type(Mod),
{Time,Result} = timer:tc(fun() -> loop1(Mod, decode, TT, Bin, N) end),
case Result of
{ok,_R1} ->
diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl
index 77147d59cc..9711fd3e8c 100644
--- a/lib/asn1/test/test_undecoded_rest.erl
+++ b/lib/asn1/test/test_undecoded_rest.erl
@@ -29,7 +29,7 @@
test(Opts, Config) ->
{ok,Msg} = asn1ct:value('P-Record', 'PersonnelRecord',
- [{i,?config(case_dir, Config)}]),
+ [{i,proplists:get_value(case_dir, Config)}]),
Bytes0 = encode(Opts, 'PersonnelRecord', Msg),
Bytes1 = iolist_to_binary([Bytes0, <<55,55,55>>]),
case proplists:get_bool(undec_rest, Opts) of
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 46917905de..332bc0bdf9 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1681,6 +1681,7 @@ help(_) ->
%% Compile entry point for erl_compile.
compile(File0, _OutFile, Options) ->
+ pre_load(),
File = shorten_filename(File0),
case file(File, make_erl_options(Options)) of
{ok,_Mod} -> ok;
@@ -1745,3 +1746,46 @@ make_erl_options(Opts) ->
end,
Options ++ [report_errors, {cwd, Cwd}, {outdir, Outdir}|
[{i, Dir} || Dir <- Includes]] ++ Specific.
+
+pre_load() ->
+ L = [beam_a,
+ beam_asm,
+ beam_block,
+ beam_bool,
+ beam_bs,
+ beam_bsm,
+ beam_clean,
+ beam_dead,
+ beam_dict,
+ beam_except,
+ beam_flatten,
+ beam_jump,
+ beam_opcodes,
+ beam_peep,
+ beam_receive,
+ beam_reorder,
+ beam_split,
+ beam_trim,
+ beam_type,
+ beam_utils,
+ beam_validator,
+ beam_z,
+ cerl,
+ cerl_clauses,
+ cerl_sets,
+ cerl_trees,
+ core_lib,
+ epp,
+ erl_bifs,
+ erl_expand_records,
+ erl_lint,
+ erl_parse,
+ erl_scan,
+ sys_core_dsetel,
+ sys_core_fold,
+ sys_pre_expand,
+ v3_codegen,
+ v3_core,
+ v3_kernel,
+ v3_life],
+ code:ensure_modules_loaded(L).
diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl
index b2e9558cba..fc04c9a60a 100644
--- a/lib/compiler/test/compile_SUITE.erl
+++ b/lib/compiler/test/compile_SUITE.erl
@@ -22,6 +22,7 @@
%% Tests compile:file/1 and compile:file/2 with various options.
-include_lib("common_test/include/ct.hrl").
+-include_lib("stdlib/include/erl_compile.hrl").
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
@@ -32,7 +33,7 @@
strict_record/1,
missing_testheap/1, cover/1, env/1, core/1, asm/1,
sys_pre_attributes/1, dialyzer/1,
- warnings/1
+ warnings/1, pre_load_check/1
]).
-export([init/3]).
@@ -50,7 +51,7 @@ all() ->
other_output, encrypted_abstr,
strict_record,
missing_testheap, cover, env, core, asm,
- sys_pre_attributes, dialyzer, warnings].
+ sys_pre_attributes, dialyzer, warnings, pre_load_check].
groups() ->
[].
@@ -881,6 +882,115 @@ do_warnings_2([], Next, F) ->
do_warnings_1(Next, F).
+%% Test that the compile:pre_load/0 function (used by 'erlc')
+%% pre-loads the modules that are used by a typical compilation.
+
+pre_load_check(Config) ->
+ case test_server:is_cover() of
+ true ->
+ {skip,"Cover is running"};
+ false ->
+ try
+ do_pre_load_check(Config)
+ after
+ dbg:stop_clear()
+ end
+ end.
+
+do_pre_load_check(Config) ->
+ DataDir = ?config(data_dir, Config),
+ Simple = filename:join(DataDir, "simple.erl"),
+ Big = filename:join(DataDir, "big.erl"),
+ {ok,_} = dbg:tracer(process, {fun pre_load_trace/2,[]}),
+ dbg:p(self(), call),
+ dbg:p(new, call),
+ {ok,_} = dbg:tpl({?MODULE,get_trace_data,0}, []),
+ {ok,_} = dbg:tp({code,ensure_modules_loaded,1}, []),
+
+ %% Compile a simple module using the erl_compile interface
+ %% to find out the modules that are pre-loaded by
+ %% compile:pre_load/0.
+ Opts = #options{specific=[binary]},
+ {ok,simple,_} = compile:compile(Simple, "", Opts),
+ [{code,ensure_modules_loaded,[PreLoaded0]}] = get_trace_data(),
+ PreLoaded1 = ordsets:from_list(PreLoaded0),
+
+ %% Since 'compile' is the function doing the pre-loaded,
+ %% it is useless to include it in the list.
+ case ordsets:is_element(compile, PreLoaded1) of
+ true ->
+ io:put_chars("The 'compile' module should not be included "
+ "in the list of modules to be pre-loaded."),
+ ?t:fail(compile);
+ false ->
+ []
+ end,
+ PreLoaded = ordsets:add_element(compile, PreLoaded1),
+
+ %% Now unload all pre-loaded modules and all modules in
+ %% compiler application. Then compile a module to find
+ %% which modules that get loaded.
+ CompilerMods = compiler_modules(),
+ Unload = ordsets:union(ordsets:from_list(CompilerMods), PreLoaded),
+ _ = [begin
+ code:delete(M),
+ code:purge(M)
+ end || M <- Unload],
+
+ {ok,_} = dbg:ctp({code,ensure_modules_loaded,1}),
+ {ok,_} = dbg:tp({code,ensure_loaded,1}, []),
+ {ok,big,_} = compile:file(Big, [binary]),
+ WasLoaded0 = get_trace_data(),
+ WasLoaded1 = [M || {code,ensure_loaded,[M]} <- WasLoaded0],
+ WasLoaded = ordsets:from_list(WasLoaded1),
+
+ %% Check for modules that should have been pre-loaded.
+ case ordsets:subtract(WasLoaded, PreLoaded) of
+ [] ->
+ ok;
+ [_|_]=NotPreLoaded ->
+ io:format("The following modules were used "
+ "but not pre-loaded:\n~p\n",
+ [NotPreLoaded]),
+ ?t:fail({not_preload,NotPreLoaded})
+ end,
+
+ %% Check for modules that should not be pre-loaded.
+ case ordsets:subtract(PreLoaded, WasLoaded) of
+ [] ->
+ ok;
+ [_|_]=NotUsed ->
+ io:format("The following modules were pre-loaded"
+ " but not used:\n~p\n",
+ [NotUsed]),
+ ?t:fail({not_used,NotUsed})
+ end,
+
+ ok.
+
+get_trace_data() ->
+ %% Apparantely, doing a receive at the beginning of
+ %% a traced function can cause extra trace messages.
+ %% To avoid that, don't do the receive in this function.
+ do_get_trace_data().
+
+do_get_trace_data() ->
+ receive
+ {trace_data,Data} -> Data
+ end.
+
+pre_load_trace({trace,Pid,call,{?MODULE,get_trace_data,[]}}, Acc) ->
+ Pid ! {trace_data,Acc},
+ [];
+pre_load_trace({trace,_,call,MFA}, Acc) ->
+ [MFA|Acc].
+
+compiler_modules() ->
+ Wc = filename:join([code:lib_dir(compiler),"ebin","*.beam"]),
+ Ms = filelib:wildcard(Wc),
+ FN = filename,
+ [list_to_atom(FN:rootname(FN:basename(M), ".beam")) || M <- Ms].
+
%%%
%%% Utilities.
%%%
diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile
index cd3c102f55..d63b2fe8f5 100644
--- a/lib/eldap/src/Makefile
+++ b/lib/eldap/src/Makefile
@@ -98,7 +98,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
- $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin"
+ $(INSTALL_DATA) $(ASN1_HRL) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin"
$(INSTALL_DIR) "$(RELSYSDIR)/src"
$(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src"
$(INSTALL_DIR) "$(RELSYSDIR)/asn1"
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 6262407354..fb08b4c22b 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -67,7 +67,9 @@ init(Ref, Parent, [Root,Mode]) ->
%% Pre-loaded modules are always sticky.
ets:insert(Db, [{M,preloaded},{{sticky,M},true}])
end, erlang:pre_loaded()),
- ets:insert(Db, init:fetch_loaded()),
+ Loaded0 = init:fetch_loaded(),
+ Loaded = [{M,filename:join([P])} || {M,P} <- Loaded0], %Normalize.
+ ets:insert(Db, Loaded),
IPath =
case Mode of
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 298c1f7d6b..abea23e854 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -34,7 +34,8 @@
purge_stacktrace/1, mult_lib_roots/1, bad_erl_libs/1,
code_archive/1, code_archive2/1, on_load/1, on_load_binary/1,
on_load_embedded/1, on_load_errors/1, big_boot_embedded/1,
- native_early_modules/1, get_mode/1]).
+ native_early_modules/1, get_mode/1,
+ normalized_paths/1]).
-export([init_per_testcase/2, end_per_testcase/2,
init_per_suite/1, end_per_suite/1]).
@@ -61,7 +62,7 @@ all() ->
purge_stacktrace, mult_lib_roots,
bad_erl_libs, code_archive, code_archive2, on_load,
on_load_binary, on_load_embedded, on_load_errors,
- big_boot_embedded, native_early_modules, get_mode].
+ big_boot_embedded, native_early_modules, get_mode, normalized_paths].
groups() ->
[].
@@ -1451,6 +1452,22 @@ native_early_modules_1(Architecture) ->
get_mode(Config) when is_list(Config) ->
interactive = code:get_mode().
+%% Make sure that the paths for all loaded modules have been normalized.
+normalized_paths(_Config) ->
+ do_normalized_paths(erlang:loaded()).
+
+do_normalized_paths([M|Ms]) ->
+ case code:which(M) of
+ Special when is_atom(Special) ->
+ do_normalized_paths(Ms);
+ File when is_list(File) ->
+ File = filename:join([File]),
+ do_normalized_paths(Ms)
+ end;
+do_normalized_paths([]) ->
+ ok.
+
+
%%-----------------------------------------------------------------
%% error_logger handler.
%% (Copied from stdlib/test/proc_lib_SUITE.erl.)
diff --git a/lib/kernel/test/error_logger_warn_SUITE.erl b/lib/kernel/test/error_logger_warn_SUITE.erl
index d8bbd42517..4fad781520 100644
--- a/lib/kernel/test/error_logger_warn_SUITE.erl
+++ b/lib/kernel/test/error_logger_warn_SUITE.erl
@@ -366,7 +366,7 @@ rb_basic() ->
0 = one_rb_findstr([info_msg],pid_to_list(Self)),
0 = one_rb_findstr([info_report],pid_to_list(Self)),
2 = one_rb_findstr([],pid_to_list(Self)),
- true = (one_rb_findstr([progress],"===") > 4),
+ true = (one_rb_findstr([progress],"===") > 3),
rb:stop(),
application:stop(sasl),
stop_node(Node),
@@ -396,7 +396,7 @@ rb_warnings_info() ->
1 = one_rb_findstr([info_msg],pid_to_list(Self)),
1 = one_rb_findstr([info_report],pid_to_list(Self)),
2 = one_rb_findstr([],pid_to_list(Self)),
- true = (one_rb_findstr([progress],"===") > 4),
+ true = (one_rb_findstr([progress],"===") > 3),
rb:stop(),
application:stop(sasl),
stop_node(Node),
@@ -426,7 +426,7 @@ rb_warnings_errors() ->
0 = one_rb_findstr([info_msg],pid_to_list(Self)),
0 = one_rb_findstr([info_report],pid_to_list(Self)),
2 = one_rb_findstr([],pid_to_list(Self)),
- true = (one_rb_findstr([progress],"===") > 4),
+ true = (one_rb_findstr([progress],"===") > 3),
rb:stop(),
application:stop(sasl),
stop_node(Node),
@@ -459,7 +459,7 @@ rb_trunc() ->
0 = one_rb_findstr([info_msg],pid_to_list(Self)),
0 = one_rb_findstr([info_report],pid_to_list(Self)),
1 = one_rb_findstr([],pid_to_list(Self)),
- true = (one_rb_findstr([progress],"===") > 4),
+ true = (one_rb_findstr([progress],"===") > 3),
rb:stop(),
application:stop(sasl),
stop_node(Node),
diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl
index badb3f3d66..f1a2002c9d 100644
--- a/lib/percept/src/percept.erl
+++ b/lib/percept/src/percept.erl
@@ -226,7 +226,7 @@ stop_webserver(Port) ->
parse_and_insert(Filename, DB) ->
io:format("Parsing: ~p ~n", [Filename]),
- T0 = erlang:now(),
+ T0 = erlang:monotonic_time(milli_seconds),
Pid = dbg:trace_client(file, Filename, mk_trace_parser(self())),
Ref = erlang:monitor(process, Pid),
parse_and_insert_loop(Filename, Pid, Ref, DB, T0).
@@ -239,8 +239,8 @@ parse_and_insert_loop(Filename, Pid, Ref, DB, T0) ->
{parse_complete, {Pid, Count}} ->
receive {'DOWN', Ref, process, Pid, normal} -> ok after 0 -> ok end,
DB ! {action, consolidate},
- T1 = erlang:now(),
- io:format("Parsed ~p entries in ~p s.~n", [Count, ?seconds(T1, T0)]),
+ T1 = erlang:monotonic_time(milli_seconds),
+ io:format("Parsed ~w entries in ~w ms.~n", [Count, T1 - T0]),
io:format(" ~p created processes.~n", [length(percept_db:select({information, procs}))]),
io:format(" ~p opened ports.~n", [length(percept_db:select({information, ports}))]),
ok;
diff --git a/lib/percept/test/egd_SUITE.erl b/lib/percept/test/egd_SUITE.erl
index 0b1149e1f1..6df7ed74c0 100644
--- a/lib/percept/test/egd_SUITE.erl
+++ b/lib/percept/test/egd_SUITE.erl
@@ -22,195 +22,160 @@
-include_lib("common_test/include/ct.hrl").
%% Test server specific exports
--export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]).
+-export([all/0, suite/0]).
-export([init_per_suite/1, end_per_suite/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
%% Test cases
--export([
- image_create_and_destroy/1,
- image_shape/1,
- image_primitives/1,
- image_colors/1,
- image_font/1,
- image_png_compliant/1
- ]).
-
-%% Default timetrap timeout (set in init_per_testcase)
--define(default_timeout, ?t:minutes(1)).
+-export([image_create_and_destroy/1,
+ image_shape/1,
+ image_primitives/1,
+ image_colors/1,
+ image_font/1,
+ image_png_compliant/1]).
-init_per_suite(Config) when is_list(Config) ->
- rand:seed(exsplus),
- Config.
-
-end_per_suite(Config) when is_list(Config) ->
- Config.
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?default_timeout),
- [{max_size, 800}, {watchdog,Dog} | Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- ?t:timetrap_cancel(Dog),
- ok.
-
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {minutes, 1}}].
all() ->
[image_create_and_destroy, image_shape,
image_primitives, image_colors, image_font,
image_png_compliant].
-groups() ->
- [].
-init_per_group(_GroupName, Config) ->
+init_per_suite(Config) when is_list(Config) ->
+ rand:seed(exsplus),
Config.
-end_per_group(_GroupName, Config) ->
+end_per_suite(Config) when is_list(Config) ->
Config.
+init_per_testcase(_Case, Config) ->
+ [{max_size, 800}|Config].
+
+end_per_testcase(_Case, _Config) ->
+ ok.
%%----------------------------------------------------------------------
%% Tests
%%----------------------------------------------------------------------
-image_create_and_destroy(suite) ->
- [];
-image_create_and_destroy(doc) ->
- ["Image creation and destroy test."];
+%% Image creation and destroy test.
image_create_and_destroy(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
- ?line Image = egd:create(W, H),
- ?line ok = egd:destroy(Image),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
+ Image = egd:create(W, H),
+ ok = egd:destroy(Image),
ok.
-image_colors(suite) ->
- [];
-image_colors(doc) ->
- ["Image color test."];
+%% Image color test.
image_colors(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
- ?line Image = egd:create(W, H),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
+ Image = egd:create(W, H),
put(image_size, {W,H}),
RGB = get_rgb(),
- ?line Black = egd:color({0,0,0}),
- ?line Red = egd:color({255,0,0}),
- ?line Green = egd:color({0,255,0}),
- ?line Blue = egd:color({0,0,255}),
- ?line Random = egd:color(Image, RGB),
-
- ?line ok = egd:line(Image, get_point(), get_point(), Random),
- ?line ok = egd:line(Image, get_point(), get_point(), Red),
- ?line ok = egd:line(Image, get_point(), get_point(), Green),
- ?line ok = egd:line(Image, get_point(), get_point(), Black),
- ?line ok = egd:line(Image, get_point(), get_point(), Blue),
+ Black = egd:color({0,0,0}),
+ Red = egd:color({255,0,0}),
+ Green = egd:color({0,255,0}),
+ Blue = egd:color({0,0,255}),
+ Random = egd:color(Image, RGB),
+
+ ok = egd:line(Image, get_point(), get_point(), Random),
+ ok = egd:line(Image, get_point(), get_point(), Red),
+ ok = egd:line(Image, get_point(), get_point(), Green),
+ ok = egd:line(Image, get_point(), get_point(), Black),
+ ok = egd:line(Image, get_point(), get_point(), Blue),
HtmlDefaultNames = [black,silver,gray,white,maroon,red,
- purple,fuchia,green,lime,olive,yellow,navy,blue,teal,
- aqua],
-
- lists:foreach(fun
- (ColorName) ->
- ?line Color = egd:color(ColorName),
- ?line ok = egd:line(Image, get_point(), get_point(), Color)
- end, HtmlDefaultNames),
-
- ?line <<_/binary>> = egd:render(Image),
- ?line ok = egd:destroy(Image),
+ purple,fuchia,green,lime,olive,yellow,navy,blue,teal,
+ aqua],
+
+ lists:foreach(fun (ColorName) ->
+ Color = egd:color(ColorName),
+ ok = egd:line(Image, get_point(), get_point(), Color)
+ end, HtmlDefaultNames),
+
+ <<_/binary>> = egd:render(Image),
+ ok = egd:destroy(Image),
erase(image_size),
ok.
-image_shape(suite) ->
- [];
-image_shape(doc) ->
- ["Image shape api test."];
+%% Image shape API test.
image_shape(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
put(image_size, {W,H}),
- ?line Im = egd:create(W, H),
-
- ?line Fgc = egd:color({255,0,0}),
-
- ?line ok = egd:line(Im, get_point(), get_point(), Fgc),
- ?line ok = egd:rectangle(Im, get_point(), get_point(), Fgc),
- ?line ok = egd:filledEllipse(Im, get_point(), get_point(), Fgc),
- ?line ok = egd:arc(Im, get_point(), get_point(), Fgc),
- ?line ok = egd:arc(Im, get_point(), get_point(), 100, Fgc),
-
+ Im = egd:create(W, H),
+
+ Fgc = egd:color({255,0,0}),
+
+ ok = egd:line(Im, get_point(), get_point(), Fgc),
+ ok = egd:rectangle(Im, get_point(), get_point(), Fgc),
+ ok = egd:filledEllipse(Im, get_point(), get_point(), Fgc),
+ ok = egd:arc(Im, get_point(), get_point(), Fgc),
+ ok = egd:arc(Im, get_point(), get_point(), 100, Fgc),
+
Pt1 = get_point(),
Pt2 = get_point(),
- ?line ok = egd:filledRectangle(Im, Pt1, Pt2, Fgc),
+ ok = egd:filledRectangle(Im, Pt1, Pt2, Fgc),
- ?line Bitmap = egd:render(Im, raw_bitmap),
+ Bitmap = egd:render(Im, raw_bitmap),
- ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
- ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
+ ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
+ ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
- ?line <<_/binary>> = egd:render(Im, raw_bitmap, [{render_engine, alpha}]),
+ <<_/binary>> = egd:render(Im, raw_bitmap, [{render_engine, alpha}]),
- ?line ok = egd:destroy(Im),
+ ok = egd:destroy(Im),
erase(image_size),
ok.
-image_primitives(suite) ->
- [];
-image_primitives(doc) ->
- ["Image shape api test."];
+%% Image shape API test.
image_primitives(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
put(image_size, {W,H}),
- ?line Im0 = egd_primitives:create(W, H),
- ?line Fgc = egd:color({25,25,255}),
- ?line Bgc = egd:color({0,250,25}),
+ Im0 = egd_primitives:create(W, H),
+ Fgc = egd:color({25,25,255}),
+ Bgc = egd:color({0,250,25}),
- ?line Im1 = lists:foldl(fun
- ({Function, Arguments}, Im) ->
- ?line erlang:apply(egd_primitives, Function, [Im|Arguments])
- end, Im0,
- [{Fs, [get_point(), get_point(), Bgc]} || Fs <- [line, rectangle, filledEllipse, arc]] ++
- [{pixel, [get_point(), Bgc]},
- {filledTriangle, [get_point(), get_point(), get_point(), Bgc]}]),
+ Im1 = lists:foldl(fun ({Function, Arguments}, Im) ->
+ erlang:apply(egd_primitives, Function, [Im|Arguments])
+ end, Im0,
+ [{Fs, [get_point(), get_point(), Bgc]} || Fs <- [line, rectangle, filledEllipse, arc]] ++
+ [{pixel, [get_point(), Bgc]},
+ {filledTriangle, [get_point(), get_point(), get_point(), Bgc]}]),
Pt1 = get_point(),
Pt2 = get_point(),
- ?line Im2 = egd_primitives:filledRectangle(Im1, Pt1, Pt2, Fgc),
+ Im2 = egd_primitives:filledRectangle(Im1, Pt1, Pt2, Fgc),
- ?line Bitmap = egd_render:binary(Im2, opaque),
+ Bitmap = egd_render:binary(Im2, opaque),
- ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
- ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
+ ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
+ ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
- ?line <<_/binary>> = egd_render:binary(Im2, alpha),
+ <<_/binary>> = egd_render:binary(Im2, alpha),
erase(image_size),
ok.
-
-
-
-image_font(suite) ->
- [];
-image_font(doc) ->
- ["Image font test."];
+%% Image font test.
image_font(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
put(image_size, {W,H}),
- ?line Im = egd:create(W, H),
- ?line Fgc = egd:color({0,130,0}),
-
- ?line Filename = filename:join([code:priv_dir(percept),"fonts","6x11_latin1.wingsfont"]),
- ?line Font = egd_font:load(Filename),
-
+ Im = egd:create(W, H),
+ Fgc = egd:color({0,130,0}),
+
+ Filename = filename:join([code:priv_dir(percept),"fonts","6x11_latin1.wingsfont"]),
+ Font = egd_font:load(Filename),
+
% simple text
- ?line ok = egd:text(Im, get_point(), Font, "Hello World", Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
-
+ ok = egd:text(Im, get_point(), Font, "Hello World", Fgc),
+ <<_/binary>> = egd:render(Im, png),
+
GlyphStr1 = " !\"#$%&'()*+,-./", % Codes 32 -> 47
NumericStr = "0123456789", % Codes 48 -> 57
GlyphStr2 = ":;<=>?@", % Codes 58 -> 64
@@ -219,62 +184,59 @@ image_font(Config) when is_list(Config) ->
AlphaSmStr = "abcdefghijklmnopqrstuvwxyz", % Codes 97 -> 122
GlyphStr4 = "{|}~", % Codes 123 -> 126
- ?line ok = egd:text(Im, get_point(), Font, GlyphStr1, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
+ ok = egd:text(Im, get_point(), Font, GlyphStr1, Fgc),
+ <<_/binary>> = egd:render(Im, png),
+
+ ok = egd:text(Im, get_point(), Font, NumericStr, Fgc),
+ <<_/binary>> = egd:render(Im, png),
+
+ ok = egd:text(Im, get_point(), Font, GlyphStr2, Fgc),
+ <<_/binary>> = egd:render(Im, png),
+
+ ok = egd:text(Im, get_point(), Font, AlphaBigStr, Fgc),
+ <<_/binary>> = egd:render(Im, png),
- ?line ok = egd:text(Im, get_point(), Font, NumericStr, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
-
- ?line ok = egd:text(Im, get_point(), Font, GlyphStr2, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
+ ok = egd:text(Im, get_point(), Font, GlyphStr3, Fgc),
+ <<_/binary>> = egd:render(Im, png),
- ?line ok = egd:text(Im, get_point(), Font, AlphaBigStr, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
-
- ?line ok = egd:text(Im, get_point(), Font, GlyphStr3, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
+ ok = egd:text(Im, get_point(), Font, AlphaSmStr, Fgc),
+ <<_/binary>> = egd:render(Im, png),
- ?line ok = egd:text(Im, get_point(), Font, AlphaSmStr, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
-
- ?line ok = egd:text(Im, get_point(), Font, GlyphStr4, Fgc),
- ?line <<_/binary>> = egd:render(Im, png),
+ ok = egd:text(Im, get_point(), Font, GlyphStr4, Fgc),
+ <<_/binary>> = egd:render(Im, png),
- ?line ok = egd:destroy(Im),
+ ok = egd:destroy(Im),
erase(image_size),
ok.
-image_png_compliant(suite) ->
- [];
-image_png_compliant(doc) ->
- ["Image png compliant test."];
+%% Image png compliant test.
image_png_compliant(Config) when is_list(Config) ->
- {W,H} = get_size(?config(max_size, Config)),
+ {W,H} = get_size(proplists:get_value(max_size, Config)),
put(image_size, {W,H}),
- ?line Im = egd:create(W, H),
- ?line Fgc = egd:color({0,0,0}),
- ?line ok = egd:filledRectangle(Im, get_point(), get_point(), Fgc),
-
- ?line Bin = egd:render(Im, png),
- ?line true = binary_is_png_compliant(Bin),
-
- ?line ok = egd:destroy(Im),
+ Im = egd:create(W, H),
+ Fgc = egd:color({0,0,0}),
+ ok = egd:filledRectangle(Im, get_point(), get_point(), Fgc),
+
+ Bin = egd:render(Im, png),
+ true = binary_is_png_compliant(Bin),
+
+ ok = egd:destroy(Im),
erase(image_size),
ok.
%%----------------------------------------------------------------------
%% Auxiliary tests
%%----------------------------------------------------------------------
-
+
bitmap_point_has_color(Bitmap, {W,_}, {X,Y}, C) ->
{CR,CG,CB,_} = egd_primitives:rgb_float2byte(C),
N = W*Y*3 + X*3,
<< _:N/binary, R,G,B, _/binary>> = Bitmap,
case {R,G,B} of
- {CR,CG,CB} -> ok;
- Other ->
- io:format("bitmap_point_has_color: error color was ~p, should be ~p~n", [Other, {CR,CG,CB}]),
- {error, {Other,{CR,CG,CB}}}
+ {CR,CG,CB} -> ok;
+ Other ->
+ io:format("bitmap_point_has_color: error color was ~p, should be ~p~n", [Other, {CR,CG,CB}]),
+ {error, {Other,{CR,CG,CB}}}
end.
%% jfif header by specification
@@ -283,35 +245,35 @@ bitmap_point_has_color(Bitmap, {W,_}, {X,Y}, C) ->
%% 2 bytes, version, (major, minor)
%% 1 byte , units
%% However, JFIF seems to start at 6 (7 with 1-index)?
-
+
binary_is_jfif_compliant(JpegBin) ->
- ?line {Bin, _} = split_binary(JpegBin, 11),
+ {Bin, _} = split_binary(JpegBin, 11),
List = binary_to_list(Bin),
case lists:sublist(List, 7, 4) of
- "JFIF" -> true;
- Other ->
- io:format("img -> ~p~n", [Other]),
- false
+ "JFIF" -> true;
+ Other ->
+ io:format("img -> ~p~n", [Other]),
+ false
end.
binary_is_gif_compliant(GifBin) ->
- ?line {Bin, _} = split_binary(GifBin, 10),
+ {Bin, _} = split_binary(GifBin, 10),
List = binary_to_list(Bin),
case lists:sublist(List, 1,5) of
- "GIF87" -> true;
- Other ->
- io:format("img -> ~p~n", [Other]),
- false
+ "GIF87" -> true;
+ Other ->
+ io:format("img -> ~p~n", [Other]),
+ false
end.
binary_is_png_compliant(PngBin) ->
- ?line {Bin, _} = split_binary(PngBin, 10),
+ {Bin, _} = split_binary(PngBin, 10),
List = binary_to_list(Bin),
case lists:sublist(List, 2,3) of
- "PNG" -> true;
- Other ->
- io:format("img -> ~p~n", [Other]),
- false
+ "PNG" -> true;
+ Other ->
+ io:format("img -> ~p~n", [Other]),
+ false
end.
%%----------------------------------------------------------------------
@@ -320,20 +282,20 @@ binary_is_png_compliant(PngBin) ->
get_rgb() ->
- R = random(255),
- G = random(255),
- B = random(255),
- {R,G,B}.
+ R = random(255),
+ G = random(255),
+ B = random(255),
+ {R,G,B}.
get_angle() ->
- random(359).
+ random(359).
get_point() ->
get_point(get(image_size)).
get_point({W,H}) ->
- X = random(W - 1),
- Y = random(H - 1),
- {X,Y}.
+ X = random(W - 1),
+ Y = random(H - 1),
+ {X,Y}.
get_size(Max) ->
W = trunc(random(Max/2) + Max/2 + 1),
@@ -344,7 +306,7 @@ get_size(Max) ->
get_points(N) ->
get_points(N, []).
get_points(0, Out) ->
- Out;
+ Out;
get_points(N, Out) ->
get_points(N - 1, [get_point() | Out]).
diff --git a/lib/percept/test/ipc_tree.erl b/lib/percept/test/ipc_tree.erl
index ff1c8d49c1..29da20e83f 100644
--- a/lib/percept/test/ipc_tree.erl
+++ b/lib/percept/test/ipc_tree.erl
@@ -46,4 +46,4 @@ gather([]) -> ok;
gather([_|Pids]) -> receive _ -> gather(Pids) end.
workload(0) -> ok;
-workload(N) -> math:sin(2), workload(N - 1).
+workload(N) -> _ = math:sin(2), workload(N - 1).
diff --git a/lib/percept/test/percept_SUITE.erl b/lib/percept/test/percept_SUITE.erl
index 06d62630ba..141035c631 100644
--- a/lib/percept/test/percept_SUITE.erl
+++ b/lib/percept/test/percept_SUITE.erl
@@ -22,51 +22,23 @@
-include_lib("common_test/include/ct.hrl").
%% Test server specific exports
--export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]).
--export([init_per_suite/1, end_per_suite/1]).
--export([init_per_testcase/2, end_per_testcase/2]).
+-export([all/0, suite/0]).
%% Test cases
--export([
- app/1,
- appup/1,
- profile/1,
- analyze/1,
- analyze_dist/1,
- webserver/1
- ]).
-
-%% Default timetrap timeout (set in init_per_testcase)
--define(default_timeout, ?t:minutes(2)).
-
-init_per_suite(Config) when is_list(Config) ->
- Config.
-
-end_per_suite(Config) when is_list(Config) ->
- Config.
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?default_timeout),
- [{max_size, 300}, {watchdog,Dog} | Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- ?t:timetrap_cancel(Dog),
- ok.
+-export([app/1,
+ appup/1,
+ profile/1,
+ analyze/1,
+ analyze_dist/1,
+ webserver/1]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {minutes, 2}}].
all() ->
- [app, appup, webserver, profile, analyze, analyze_dist].
-
-groups() ->
- [].
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
+ [app, appup, webserver, profile,
+ analyze, analyze_dist].
%%----------------------------------------------------------------------
@@ -75,70 +47,56 @@ end_per_group(_GroupName, Config) ->
%% Test that the percept app file is ok
app(Config) when is_list(Config) ->
- ok = ?t:app_test(percept).
+ ok = test_server:app_test(percept).
%% Test that the percept appup file is ok
appup(Config) when is_list(Config) ->
- ok = ?t:appup_test(percept).
+ ok = test_server:appup_test(percept).
-webserver(suite) ->
- [];
-webserver(doc) ->
- ["Percept webserver test."];
+%% Percept webserver test.
webserver(Config) when is_list(Config) ->
% Explicit start inets?
- ?line {started, _, Port} = percept:start_webserver(),
- ?line ok = percept:stop_webserver(Port),
- ?line {started, _, _} = percept:start_webserver(),
- ?line ok = percept:stop_webserver(),
- ?line {started, _, NewPort} = percept:start_webserver(),
- ?line ok = percept:stop_webserver(NewPort),
- ?line application:stop(inets),
+ {started, _, Port} = percept:start_webserver(),
+ ok = percept:stop_webserver(Port),
+ {started, _, _} = percept:start_webserver(),
+ ok = percept:stop_webserver(),
+ {started, _, NewPort} = percept:start_webserver(),
+ ok = percept:stop_webserver(NewPort),
+ application:stop(inets),
ok.
-profile(suite) ->
- [];
-profile(doc) ->
- ["Percept profile test."];
+%% Percept profile test.
profile(Config) when is_list(Config) ->
- Path = ?config(data_dir, Config),
+ Path = proplists:get_value(data_dir, Config),
File = filename:join([Path,"profile_test.dat"]),
- ?line {ok, _} = percept:profile(File, [procs]),
+ {ok, _} = percept:profile(File, [procs]),
ipc_tree:go(7),
- ?line ok = percept:stop_profile(),
+ ok = percept:stop_profile(),
ok.
-analyze(suite) ->
- [];
-analyze(doc) ->
- ["Percept analyze test."];
+%% Percept analyze test.
analyze(Config) when is_list(Config) ->
Begin = processes(),
- Path = ?config(data_dir, Config),
+ Path = proplists:get_value(data_dir, Config),
File = filename:join([Path,"profile_test.dat"]),
- T0 = erlang:now(),
- ?line ok = percept:analyze(File),
- T1 = erlang:now(),
- Secs = timer:now_diff(T1,T0)/1000000,
- io:format("percept:analyze/1 took ~.2f s.~n", [Secs]),
- ?line {stopped, _} = percept_db:stop(),
+ T0 = erlang:monotonic_time(milli_seconds),
+ ok = percept:analyze(File),
+ T1 = erlang:monotonic_time(milli_seconds),
+ io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]),
+ {stopped, _} = percept_db:stop(),
print_remainers(remainers(Begin, processes())),
ok.
-analyze_dist(suite) ->
- [];
-analyze_dist(doc) ->
- ["Percept analyze distribution test."];
+%% Percept analyze distribution test.
analyze_dist(Config) when is_list(Config) ->
Begin = processes(),
- Path = ?config(data_dir, Config),
+ Path = proplists:get_value(data_dir, Config),
File = filename:join([Path,"ipc-dist.dat"]),
- T0 = erlang:now(),
- ?line ok = percept:analyze(File),
- T1 = erlang:now(),
- Secs = timer:now_diff(T1,T0)/1000000,
- io:format("percept:analyze/1 took ~.2f s.~n", [Secs]),
- ?line {stopped, _} = percept_db:stop(),
+ T0 = erlang:monotonic_time(milli_seconds),
+ ok = percept:analyze(File),
+ T1 = erlang:monotonic_time(milli_seconds),
+ io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]),
+ {stopped, _} = percept_db:stop(),
print_remainers(remainers(Begin, processes())),
ok.
@@ -166,9 +124,3 @@ remainers(Begin, [Pid|End], Out) ->
true -> remainers(Begin, End, Out);
false -> remainers(Begin, End, [Pid|Out])
end.
-
-
-
-
-
-
diff --git a/lib/percept/test/percept_db_SUITE.erl b/lib/percept/test/percept_db_SUITE.erl
index 5b878e8462..c1d711060c 100644
--- a/lib/percept/test/percept_db_SUITE.erl
+++ b/lib/percept/test/percept_db_SUITE.erl
@@ -22,54 +22,32 @@
-include_lib("common_test/include/ct.hrl").
%% Test server specific exports
--export([all/1]).
--export([init_per_suite/1, end_per_suite/1]).
--export([init_per_testcase/2, end_per_testcase/2]).
+-export([all/0, suite/0]).
%% Test cases
--export([
- start/1
- ]).
+-export([start/1]).
%% Default timetrap timeout (set in init_per_testcase)
--define(default_timeout, ?t:minutes(2)).
-define(restarts, 10).
-define(alive_timeout, 500).
-init_per_suite(Config) when is_list(Config) ->
- Config.
+suite() ->
+ [{timetrap, {minutes, 2}}].
-end_per_suite(Config) when is_list(Config) ->
- Config.
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?default_timeout),
- [{max_size, 300}, {watchdog,Dog} | Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- ?t:timetrap_cancel(Dog),
- ok.
-
-all(suite) ->
- % Test cases
+all() ->
[start].
%%----------------------------------------------------------------------
%% Tests
%%----------------------------------------------------------------------
-start(suite) ->
- [];
-start(doc) ->
- ["Percept_db start and restart test."];
+%% Percept_db start and restart test.
start(Config) when is_list(Config) ->
ok = restart(?restarts),
{stopped, _DB} = percept_db:stop(),
ok.
-restart(0)->
- ok;
+restart(0)-> ok;
restart(N)->
{_, DB} = percept_db:start(),
timer:sleep(?alive_timeout),
diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml
index 16a7497a22..6923066da7 100644
--- a/lib/public_key/doc/src/public_key.xml
+++ b/lib/public_key/doc/src/public_key.xml
@@ -141,7 +141,7 @@
<item><p><c>#'DSAPrivateKey'{}</c></p></item>
<tag><c>ec_public_key()</c></tag>
- <item><p>= <c>{#'ECPoint'{}, #'EcpkParameters'{} | {namedCurve, oid()}}</c></p></item>
+ <item><p>= <c>{#'ECPoint'{}, #'ECParameters'{} | {namedCurve, oid()}}</c></p></item>
<tag><c>ec_private_key() =</c></tag>
<item><p><c>#'ECPrivateKey'{}</c></p></item>
@@ -418,13 +418,14 @@
<v>Entity = term()</v>
<d>Erlang representation of
<c>Asn1Type</c>. If <c>Asn1Type</c> is 'SubjectPublicKeyInfo',
- <c>Entity</c> must be either an <c>rsa_public_key()</c> or a
- <c>dsa_public_key()</c> and this function creates the appropriate
+ <c>Entity</c> must be either an <c>rsa_public_key()</c>,
+ <c>dsa_public_key()</c> or an <c>ec_public_key()</c>
+ and this function creates the appropriate
'SubjectPublicKeyInfo' entry.
</d>
<v>CipherInfo = cipher_info()</v>
<v>Password = string()</v>
- </type>
+ </type>
<desc>
<p>Creates a PEM entry that can be feed to <c>pem_encode/1</c>.</p>
</desc>
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index a79badef24..a5944bd604 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -134,7 +134,8 @@ pem_entry_decode({'SubjectPublicKeyInfo', Der, _}) ->
{params, DssParams} = der_decode('DSAParams', Params),
{der_decode(KeyType, Key0), DssParams};
'ECPoint' ->
- der_decode(KeyType, Key0)
+ ECCParams = der_decode('EcpkParameters', Params),
+ {#'ECPoint'{point = Key0}, ECCParams}
end;
pem_entry_decode({Asn1Type, Der, not_encrypted}) when is_atom(Asn1Type),
is_binary(Der) ->
@@ -181,6 +182,13 @@ pem_entry_encode('SubjectPublicKeyInfo',
Spki = {'SubjectPublicKeyInfo',
{'AlgorithmIdentifier', ?'id-dsa', ParamDer}, KeyDer},
pem_entry_encode('SubjectPublicKeyInfo', Spki);
+pem_entry_encode('SubjectPublicKeyInfo',
+ {#'ECPoint'{point = Key}, ECParam}) when is_binary(Key)->
+ Params = der_encode('EcpkParameters',ECParam),
+ Spki = {'SubjectPublicKeyInfo',
+ {'AlgorithmIdentifier', ?'id-ecPublicKey', Params},
+ Key},
+ pem_entry_encode('SubjectPublicKeyInfo', Spki);
pem_entry_encode(Asn1Type, Entity) when is_atom(Asn1Type) ->
Der = der_encode(Asn1Type, Entity),
{Asn1Type, Der, not_encrypted}.
diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl
index ea5e036a7e..2fbccbfaa7 100644
--- a/lib/public_key/test/public_key_SUITE.erl
+++ b/lib/public_key/test/public_key_SUITE.erl
@@ -46,7 +46,7 @@ all() ->
pkix_iso_rsa_oid, pkix_iso_dsa_oid, pkix_crl].
groups() ->
- [{pem_decode_encode, [], [dsa_pem, rsa_pem, encrypted_pem,
+ [{pem_decode_encode, [], [dsa_pem, rsa_pem, ec_pem, encrypted_pem,
dh_pem, cert_pem, pkcs7_pem, pkcs10_pem]},
{ssh_public_key_decode_encode, [],
[ssh_rsa_public_key, ssh_dsa_public_key, ssh_ecdsa_public_key,
@@ -123,8 +123,8 @@ dsa_pem(Config) when is_list(Config) ->
DSAPubKey = public_key:pem_entry_decode(PubEntry0),
true = check_entry_type(DSAPubKey, 'DSAPublicKey'),
PubEntry0 = public_key:pem_entry_encode('SubjectPublicKeyInfo', DSAPubKey),
- DSAPubPemNoEndNewLines = strip_ending_newlines(DSAPubPem),
- DSAPubPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry0])).
+ DSAPubPemNoEndNewLines = strip_superfluous_newlines(DSAPubPem),
+ DSAPubPemNoEndNewLines = strip_superfluous_newlines(public_key:pem_encode([PubEntry0])).
%%--------------------------------------------------------------------
@@ -151,18 +151,44 @@ rsa_pem(Config) when is_list(Config) ->
RSAPubKey = public_key:pem_entry_decode(PubEntry0),
true = check_entry_type(RSAPubKey, 'RSAPublicKey'),
PubEntry0 = public_key:pem_entry_encode('SubjectPublicKeyInfo', RSAPubKey),
- RSAPubPemNoEndNewLines = strip_ending_newlines(RSAPubPem),
- RSAPubPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry0])),
+ RSAPubPemNoEndNewLines = strip_superfluous_newlines(RSAPubPem),
+ RSAPubPemNoEndNewLines = strip_superfluous_newlines(public_key:pem_encode([PubEntry0])),
{ok, RSARawPem} = file:read_file(filename:join(Datadir, "rsa_pub_key.pem")),
[{'RSAPublicKey', _, _} = PubEntry1] =
public_key:pem_decode(RSARawPem),
RSAPubKey = public_key:pem_entry_decode(PubEntry1),
- RSARawPemNoEndNewLines = strip_ending_newlines(RSARawPem),
- RSARawPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry1])).
+ RSARawPemNoEndNewLines = strip_superfluous_newlines(RSARawPem),
+ RSARawPemNoEndNewLines = strip_superfluous_newlines(public_key:pem_encode([PubEntry1])).
%%--------------------------------------------------------------------
+ec_pem() ->
+ [{doc, "EC key PEM-file decode/encode"}].
+ec_pem(Config) when is_list(Config) ->
+ Datadir = ?config(data_dir, Config),
+ {ok, ECPubPem} = file:read_file(filename:join(Datadir, "ec_pubkey.pem")),
+ [{'SubjectPublicKeyInfo', _, _} = PubEntry0] =
+ public_key:pem_decode(ECPubPem),
+ ECPubKey = public_key:pem_entry_decode(PubEntry0),
+ true = check_entry_type(ECPubKey, 'ECPoint'),
+ PubEntry0 = public_key:pem_entry_encode('SubjectPublicKeyInfo', ECPubKey),
+ ECPubPemNoEndNewLines = strip_superfluous_newlines(ECPubPem),
+ ECPubPemNoEndNewLines = strip_superfluous_newlines(public_key:pem_encode([PubEntry0])),
+
+ {ok, ECPrivPem} = file:read_file(filename:join(Datadir, "ec_key.pem")),
+ [{'EcpkParameters', _, not_encrypted} = Entry1,
+ {'ECPrivateKey', _, not_encrypted} = Entry2] = public_key:pem_decode(ECPrivPem),
+
+ ECParams = public_key:pem_entry_decode(Entry1),
+ true = check_entry_type(ECParams, 'EcpkParameters'),
+ ECPrivKey = public_key:pem_entry_decode(Entry2),
+ true = check_entry_type(ECPrivKey, 'ECPrivateKey'),
+ ECPemNoEndNewLines = strip_superfluous_newlines(ECPrivPem),
+ ECPemNoEndNewLines = strip_superfluous_newlines(public_key:pem_encode([Entry1, Entry2])).
+
+%%--------------------------------------------------------------------
+
encrypted_pem() ->
[{doc, "Encrypted PEM-file decode/encode"}].
encrypted_pem(Config) when is_list(Config) ->
@@ -825,6 +851,14 @@ check_entry_type(#'DHParameter'{}, 'DHParameter') ->
true;
check_entry_type(#'Certificate'{}, 'Certificate') ->
true;
+check_entry_type({#'ECPoint'{}, _}, 'ECPoint') ->
+ true;
+check_entry_type(#'ECPrivateKey'{}, 'ECPrivateKey') ->
+ true;
+check_entry_type({namedCurve, _}, 'EcpkParameters') ->
+ true;
+check_entry_type(#'ECParameters'{}, 'EcpkParameters') ->
+ true;
check_entry_type(_,_) ->
false.
@@ -837,8 +871,9 @@ check_encapsulated_header([ _ | Rest]) ->
check_encapsulated_header([]) ->
false.
-strip_ending_newlines(Bin) ->
- string:strip(binary_to_list(Bin), right, 10).
+strip_superfluous_newlines(Bin) ->
+ Str = string:strip(binary_to_list(Bin), right, 10),
+ re:replace(Str,"\n\n","\n", [{return,list}, global]).
incorrect_countryname_pkix_cert() ->
<<48,130,5,186,48,130,4,162,160,3,2,1,2,2,7,7,250,61,63,6,140,137,48,13,6,9,42, 134,72,134,247,13,1,1,5,5,0,48,129,220,49,11,48,9,6,3,85,4,6,19,2,85,83,49, 16,48,14,6,3,85,4,8,19,7,65,114,105,122,111,110,97,49,19,48,17,6,3,85,4,7,19, 10,83,99,111,116,116,115,100,97,108,101,49,37,48,35,6,3,85,4,10,19,28,83,116, 97,114,102,105,101,108,100,32,84,101,99,104,110,111,108,111,103,105,101,115, 44,32,73,110,99,46,49,57,48,55,6,3,85,4,11,19,48,104,116,116,112,58,47,47,99, 101,114,116,105,102,105,99,97,116,101,115,46,115,116,97,114,102,105,101,108, 100,116,101,99,104,46,99,111,109,47,114,101,112,111,115,105,116,111,114,121, 49,49,48,47,6,3,85,4,3,19,40,83,116,97,114,102,105,101,108,100,32,83,101,99, 117,114,101,32,67,101,114,116,105,102,105,99,97,116,105,111,110,32,65,117, 116,104,111,114,105,116,121,49,17,48,15,6,3,85,4,5,19,8,49,48,54,56,56,52,51, 53,48,30,23,13,49,48,49,48,50,51,48,49,51,50,48,53,90,23,13,49,50,49,48,50, 51,48,49,51,50,48,53,90,48,122,49,11,48,9,6,3,85,4,6,12,2,85,83,49,11,48,9,6, 3,85,4,8,12,2,65,90,49,19,48,17,6,3,85,4,7,12,10,83,99,111,116,116,115,100, 97,108,101,49,38,48,36,6,3,85,4,10,12,29,83,112,101,99,105,97,108,32,68,111, 109,97,105,110,32,83,101,114,118,105,99,101,115,44,32,73,110,99,46,49,33,48, 31,6,3,85,4,3,12,24,42,46,108,111,103,105,110,46,115,101,99,117,114,101,115, 101,114,118,101,114,46,110,101,116,48,130,1,34,48,13,6,9,42,134,72,134,247, 13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,185,136,240,80,141,36,124, 245,182,130,73,19,188,74,166,117,72,228,185,209,43,129,244,40,44,193,231,11, 209,12,234,88,43,142,1,162,48,122,17,95,230,105,171,131,12,147,46,204,36,80, 250,171,33,253,35,62,83,22,71,212,186,141,14,198,89,89,121,204,224,122,246, 127,110,188,229,162,67,95,6,74,231,127,99,131,7,240,85,102,203,251,50,58,58, 104,245,103,181,183,134,32,203,121,232,54,32,188,139,136,112,166,126,14,91, 223,153,172,164,14,61,38,163,208,215,186,210,136,213,143,70,147,173,109,217, 250,169,108,31,211,104,238,103,93,182,59,165,43,196,189,218,241,30,148,240, 109,90,69,176,194,52,116,173,151,135,239,10,209,179,129,192,102,75,11,25,168, 223,32,174,84,223,134,70,167,55,172,143,27,130,123,226,226,7,34,142,166,39, 48,246,96,231,150,84,220,106,133,193,55,95,159,227,24,249,64,36,1,142,171,16, 202,55,126,7,156,15,194,22,116,53,113,174,104,239,203,120,45,131,57,87,84, 163,184,27,83,57,199,91,200,34,43,98,61,180,144,76,65,170,177,2,3,1,0,1,163, 130,1,224,48,130,1,220,48,15,6,3,85,29,19,1,1,255,4,5,48,3,1,1,0,48,29,6,3, 85,29,37,4,22,48,20,6,8,43,6,1,5,5,7,3,1,6,8,43,6,1,5,5,7,3,2,48,14,6,3,85, 29,15,1,1,255,4,4,3,2,5,160,48,56,6,3,85,29,31,4,49,48,47,48,45,160,43,160, 41,134,39,104,116,116,112,58,47,47,99,114,108,46,115,116,97,114,102,105,101, 108,100,116,101,99,104,46,99,111,109,47,115,102,115,50,45,48,46,99,114,108, 48,83,6,3,85,29,32,4,76,48,74,48,72,6,11,96,134,72,1,134,253,110,1,7,23,2,48, 57,48,55,6,8,43,6,1,5,5,7,2,1,22,43,104,116,116,112,115,58,47,47,99,101,114, 116,115,46,115,116,97,114,102,105,101,108,100,116,101,99,104,46,99,111,109, 47,114,101,112,111,115,105,116,111,114,121,47,48,129,141,6,8,43,6,1,5,5,7,1, 1,4,129,128,48,126,48,42,6,8,43,6,1,5,5,7,48,1,134,30,104,116,116,112,58,47, 47,111,99,115,112,46,115,116,97,114,102,105,101,108,100,116,101,99,104,46,99, 111,109,47,48,80,6,8,43,6,1,5,5,7,48,2,134,68,104,116,116,112,58,47,47,99, 101,114,116,105,102,105,99,97,116,101,115,46,115,116,97,114,102,105,101,108, 100,116,101,99,104,46,99,111,109,47,114,101,112,111,115,105,116,111,114,121, 47,115,102,95,105,110,116,101,114,109,101,100,105,97,116,101,46,99,114,116, 48,31,6,3,85,29,35,4,24,48,22,128,20,73,75,82,39,209,27,188,242,161,33,106, 98,123,81,66,122,138,215,213,86,48,59,6,3,85,29,17,4,52,48,50,130,24,42,46, 108,111,103,105,110,46,115,101,99,117,114,101,115,101,114,118,101,114,46,110, 101,116,130,22,108,111,103,105,110,46,115,101,99,117,114,101,115,101,114,118, 101,114,46,110,101,116,48,29,6,3,85,29,14,4,22,4,20,138,233,191,208,157,203, 249,85,242,239,20,195,48,10,148,49,144,101,255,116,48,13,6,9,42,134,72,134, 247,13,1,1,5,5,0,3,130,1,1,0,82,31,121,162,49,50,143,26,167,202,143,61,71, 189,201,199,57,81,122,116,90,192,88,24,102,194,174,48,157,74,27,87,210,223, 253,93,3,91,150,109,120,1,110,27,11,200,198,141,222,246,14,200,71,105,41,138, 13,114,122,106,63,17,197,181,234,121,61,89,74,65,41,231,248,219,129,83,176, 219,55,107,55,211,112,98,38,49,69,77,96,221,108,123,152,12,210,159,157,141, 43,226,55,187,129,3,82,49,136,66,81,196,91,234,196,10,82,48,6,80,163,83,71, 127,102,177,93,209,129,26,104,2,84,24,255,248,161,3,244,169,234,92,122,110, 43,4,17,113,185,235,108,219,210,236,132,216,177,227,17,169,58,162,159,182, 162,93,160,229,200,9,163,229,110,121,240,168,232,14,91,214,188,196,109,210, 164,222,0,109,139,132,113,91,16,118,173,178,176,80,132,34,41,199,51,206,250, 224,132,60,115,192,94,107,163,219,212,226,225,65,169,148,108,213,46,174,173, 103,110,189,229,166,149,254,31,51,44,144,108,187,182,11,251,201,206,86,138, 208,59,51,86,132,235,81,225,88,34,190,8,184>>.
diff --git a/lib/public_key/test/public_key_SUITE_data/ec_key.pem b/lib/public_key/test/public_key_SUITE_data/ec_key.pem
new file mode 100644
index 0000000000..1bb375d22f
--- /dev/null
+++ b/lib/public_key/test/public_key_SUITE_data/ec_key.pem
@@ -0,0 +1,8 @@
+-----BEGIN EC PARAMETERS-----
+BgUrgQQACg==
+-----END EC PARAMETERS-----
+-----BEGIN EC PRIVATE KEY-----
+MHQCAQEEIAd+PV10pm2uQWyU+VLgijqMqDx7MoMup/lsz9SfvHmEoAcGBSuBBAAK
+oUQDQgAE0yXQ7YqlfR7O6vmP8mpNc97iabpBUBmJq5Sdos7cX7+289dHiecjPxja
+hvJCtMO0iM43nbCJH40Su21+pj+4eA==
+-----END EC PRIVATE KEY-----
diff --git a/lib/public_key/test/public_key_SUITE_data/ec_pubkey.pem b/lib/public_key/test/public_key_SUITE_data/ec_pubkey.pem
new file mode 100644
index 0000000000..186c32bc01
--- /dev/null
+++ b/lib/public_key/test/public_key_SUITE_data/ec_pubkey.pem
@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE0yXQ7YqlfR7O6vmP8mpNc97iabpBUBmJ
+q5Sdos7cX7+289dHiecjPxjahvJCtMO0iM43nbCJH40Su21+pj+4eA==
+-----END PUBLIC KEY-----
diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl
index d207dc15bb..154374cd8c 100644
--- a/lib/sasl/src/systools_make.erl
+++ b/lib/sasl/src/systools_make.erl
@@ -1453,16 +1453,37 @@ behave([H|T]) ->
behave([]) ->
[].
-%%______________________________________________________________________
-%% mandatory modules; this modules must be loaded before processes
-%% can be started. These are a collection of modules from the kernel
-%% and stdlib applications.
-%% Nowadays, error_handler dynamically loads almost every module.
-%% The error_handler self must still be there though.
-
mandatory_modules() ->
- %% Sorted
- [error_handler].
+ [error_handler, %Truly mandatory.
+
+ %% Modules that are almost always needed. Listing them here
+ %% helps the init module to load them faster. Modules not
+ %% listed here will be loaded by the error_handler module.
+ %%
+ %% Keep this list sorted.
+ application,
+ application_controller,
+ application_master,
+ code,
+ code_server,
+ erl_eval,
+ erl_lint,
+ erl_parse,
+ error_logger,
+ ets,
+ file,
+ filename,
+ file_server,
+ file_io_server,
+ gen,
+ gen_event,
+ gen_server,
+ heart,
+ kernel,
+ lists,
+ proc_lib,
+ supervisor
+ ].
%%______________________________________________________________________
%% This is the modules that are preloaded into the Erlang system.
diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl
index 4e6e25bc70..2dfc55cd92 100644
--- a/lib/ssh/src/ssh_info.erl
+++ b/lib/ssh/src/ssh_info.erl
@@ -25,7 +25,11 @@
-module(ssh_info).
--compile(export_all).
+-export([print/0,
+ print/1,
+ string/0,
+ collect_pids/0
+ ]).
print() ->
print(user).
@@ -34,55 +38,54 @@ print(D) ->
try supervisor:which_children(ssh_sup)
of
_ ->
- io:nl(D),
+ io__nl(D),
print_general(D),
- io:nl(D),
+ io__nl(D),
underline(D, "Client part", $=),
print_clients(D),
- io:nl(D),
+ io__nl(D),
underline(D, "Server part", $=),
print_servers(D),
- io:nl(D),
- %% case os:type() of
- %% {unix,_} ->
- %% io:nl(),
- %% underline("Linux part", $=),
- %% underline("Listening"),
- %% catch io:format(os:cmd("netstat -tpln")),
- %% io:nl(),
- %% underline("Other"),
- %% catch io:format(os:cmd("netstat -tpn"));
- %% _ -> ok
- %% end,
+ io__nl(D),
underline(D, "Supervisors", $=),
walk_sups(D, ssh_sup),
- io:nl(D)
+ io__nl(D)
catch
_:_ ->
- io:format(D,"Ssh not found~n",[])
+ io__format(D,"Ssh not found~n",[])
+ end.
+
+string() ->
+ Pid = spawn(fun init/0),
+ print(Pid),
+ Pid ! {get,self()},
+ receive
+ {result,R} -> R
end.
%%%================================================================
print_general(D) ->
{_Name, Slogan, Ver} = lists:keyfind(ssh,1,application:which_applications()),
underline(D, io_lib:format("~s ~s", [Slogan, Ver]), $=),
- io:format(D, 'This printout is generated ~s. ~n',[datetime()]).
+ io__format(D, 'This printout is generated ~s. ~n',[datetime()]).
%%%================================================================
+-define(INDENT, " ").
+
print_clients(D) ->
PrintClient = fun(X) -> print_client(D,X) end,
try
lists:foreach(PrintClient, supervisor:which_children(sshc_sup))
catch
C:E ->
- io:format(D, '***FAILED: ~p:~p~n',[C,E])
+ io__format(D, '***FAILED: ~p:~p~n',[C,E])
end.
print_client(D, {undefined,Pid,supervisor,[ssh_connection_handler]}) ->
{{Local,Remote},_Str} = ssh_connection_handler:get_print_info(Pid),
- io:format(D, " Local=~s Remote=~s ConnectionRef=~p~n",[fmt_host_port(Local),fmt_host_port(Remote),Pid]);
+ io__format(D, ?INDENT"Local: ~s Remote: ~s ConnectionRef = ~p~n",[fmt_host_port(Local),fmt_host_port(Remote),Pid]);
print_client(D, Other) ->
- io:format(D, " [[Other 1: ~p]]~n",[Other]).
+ io__format(D, " [[Other 1: ~p]]~n",[Other]).
%%%================================================================
@@ -92,51 +95,56 @@ print_servers(D) ->
lists:foreach(PrintServer, supervisor:which_children(sshd_sup))
catch
C:E ->
- io:format(D, '***FAILED: ~p:~p~n',[C,E])
+ io__format(D, '***FAILED: ~p:~p~n',[C,E])
end.
-print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) ->
- io:format(D, 'Local=~s (~p children)~n',[fmt_host_port({LocalHost,LocalPort}),
- ssh_acceptor:number_of_connections(Pid)]),
+
+print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort,Profile},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) ->
+ io__format(D, ?INDENT"Listen: ~s (~p children) Profile ~p~n",[fmt_host_port({LocalHost,LocalPort}),
+ ssh_acceptor:number_of_connections(Pid),
+ Profile]),
PrintSystemSup = fun(X) -> print_system_sup(D,X) end,
- lists:foreach(PrintSystemSup, supervisor:which_children(Pid));
-print_server(D, Other) ->
- io:format(D, " [[Other 2: ~p]]~n",[Other]).
-
+ lists:foreach(PrintSystemSup, supervisor:which_children(Pid)).
+
+
print_system_sup(D, {Ref,Pid,supervisor,[ssh_subsystem_sup]}) when is_reference(Ref),
- is_pid(Pid) ->
+ is_pid(Pid) ->
PrintChannels = fun(X) -> print_channels(D,X) end,
lists:foreach(PrintChannels, supervisor:which_children(Pid));
-print_system_sup(D, {{ssh_acceptor_sup,LocalHost,LocalPort}, Pid,supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) ->
- io:format(D, " [Acceptor for ~s]~n",[fmt_host_port({LocalHost,LocalPort})]);
-print_system_sup(D, Other) ->
- io:format(D, " [[Other 3: ~p]]~n",[Other]).
+print_system_sup(D, {{ssh_acceptor_sup,_LocalHost,_LocalPort,_Profile}, Pid, supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) ->
+ io__format(D, ?INDENT?INDENT"[Acceptor Pid ~p]~n",[Pid]).
-print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) ->
- PrintChannel = fun(X) -> print_channel(D,X) end,
- lists:foreach(PrintChannel, supervisor:which_children(Pid));
-print_channels(D, Other) ->
- io:format(D, " [[Other 4: ~p]]~n",[Other]).
+print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) ->
+ Children = supervisor:which_children(Pid),
+ ChannelPids = [P || {R,P,worker,[ssh_channel]} <- Children,
+ is_pid(P),
+ is_reference(R)],
+ case ChannelPids of
+ [] -> io__format(D, ?INDENT?INDENT"No channels~n",[]);
+ [Ch1Pid|_] ->
+ {{ConnManager,_}, _Str} = ssh_channel:get_print_info(Ch1Pid),
+ {{_,Remote},_} = ssh_connection_handler:get_print_info(ConnManager),
+ io__format(D, ?INDENT?INDENT"Remote: ~s ConnectionRef = ~p~n",[fmt_host_port(Remote),ConnManager]),
+ lists:foreach(fun(P) -> print_ch(D,P) end, ChannelPids)
+ end;
+print_channels(_D, {{server,ssh_connection_sup,_,_},Pid,supervisor,[ssh_connection_sup]}) when is_pid(Pid) ->
+ ok. % The supervisor of the connections socket owning process
-print_channel(D, {Ref,Pid,worker,[ssh_channel]}) when is_reference(Ref),
- is_pid(Pid) ->
+print_ch(D, Pid) ->
{{ConnManager,ChannelID}, Str} = ssh_channel:get_print_info(Pid),
- {{Local,Remote},StrM} = ssh_connection_handler:get_print_info(ConnManager),
- io:format(D, ' ch ~p: ~s ~s',[ChannelID, StrM, Str]),
- io:format(D, " Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]);
-print_channel(D, Other) ->
- io:format(D, " [[Other 5: ~p]]~n",[Other]).
-
+ {_LocalRemote,StrM} = ssh_connection_handler:get_print_info(ConnManager),
+ io__format(D, ?INDENT?INDENT?INDENT"ch ~p: ~s ~s~n",[ChannelID, StrM, Str]).
+
%%%================================================================
-define(inc(N), (N+4)).
walk_sups(D, StartPid) ->
- io:format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]),
+ io__format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]),
walk_sups(D, children(StartPid), _Indent=?inc(0)).
walk_sups(D, [H={_,Pid,_,_}|T], Indent) ->
- indent(D, Indent), io:format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]),
+ indent(D, Indent), io__format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]),
case H of
{_,_,supervisor,[ssh_connection_handler]} -> ok;
{_,Pid,supervisor,_} -> walk_sups(D, children(Pid), ?inc(Indent));
@@ -159,7 +167,7 @@ dead_or_alive(Pid) when is_pid(Pid) ->
_ -> "alive"
end.
-indent(D, I) -> io:format(D,'~*c',[I,$ ]).
+indent(D, I) -> io__format(D,'~*c',[I,$ ]).
children(Pid) ->
Parent = self(),
@@ -176,16 +184,13 @@ children(Pid) ->
end.
%%%================================================================
-underline(D, Str) ->
- underline(D, Str, $-).
-
underline(D, Str, LineChar) ->
Len = lists:flatlength(Str),
- io:format(D, '~s~n',[Str]),
+ io__format(D, '~s~n',[Str]),
line(D,Len,LineChar).
line(D, Len, Char) ->
- io:format(D, '~*c~n', [Len,Char]).
+ io__format(D, '~*c~n', [Len,Char]).
datetime() ->
@@ -196,8 +201,78 @@ datetime() ->
fmt_host_port({{A,B,C,D},Port}) -> io_lib:format('~p.~p.~p.~p:~p',[A,B,C,D,Port]);
fmt_host_port({Host,Port}) -> io_lib:format('~s:~p',[Host,Port]).
+%%%################################################################
+
+io__nl(D) when is_atom(D) -> io:nl(D);
+io__nl(P) when is_pid(P) -> P ! {string,io_lib:nl()}.
+
+io__format(D, Fmt, Args) when is_atom(D) -> io:format(D, Fmt, Args);
+io__format(P, Fmt, Args) when is_pid(P) -> P ! {string,io_lib:format(Fmt, Args)}.
+
+
+init() -> loop([]).
+loop(Acc) ->
+ receive
+ {string,Str} ->
+ loop([Str|Acc]);
+ {get,Who} ->
+ Who ! {result,lists:flatten(lists:reverse(Acc))}
+ end.
+
+%%%################################################################
+collect_pids() -> collect_pids(ssh_sup).
+
+collect_pids(P) ->
+ Collector = pcollect_pids(P, spawn(fun init_collector/0)),
+ Collector ! {get_values,self()},
+ receive
+ {values,Values} ->
+ Values
+ end.
+
+%%%----------------
+pcollect_pids(undefined, Collector) ->
+ Collector;
+
+pcollect_pids(A, Collector) when is_atom(A) ->
+ pcollect_pids(whereis(A), Collector);
+
+pcollect_pids(Pid, Collector) when is_pid(Pid) ->
+ Collector ! {expect,Pid},
+ spawn(fun() ->
+ lists:foreach(
+ fun(P2) ->
+ pcollect_pids(P2,Collector)
+ end, children(Pid)),
+ Collector ! {value,Pid,Pid}
+ end),
+ Collector;
+
+pcollect_pids({_,Pid,supervisor,_}, Collector) when is_pid(Pid) ->
+ pcollect_pids(Pid, Collector);
+
+pcollect_pids({_,Pid,worker,_}, Collector) when is_pid(Pid) ->
+ Collector ! {value,Pid,Pid},
+ Collector;
+
+pcollect_pids(_, Collector) ->
+ Collector.
+
+%%%----------------
+init_collector() ->
+ loop_collector([],[]).
+
+loop_collector(Expects, Values) ->
+ receive
+ {expect, Ref} ->
+ loop_collector([Ref|Expects], Values);
+ {value, Ref, Val} ->
+ loop_collector(Expects--[Ref], [Val|Values]);
+ {get_values, From} when Expects==[] ->
+%% Values=/=[] ->
+ From ! {values,Values}
+ end.
+
+
-nyi(D) ->
- io:format(D,'Not yet implemented~n',[]),
- nyi.
diff --git a/lib/ssh/test/ssh_algorithms_SUITE.erl b/lib/ssh/test/ssh_algorithms_SUITE.erl
index 49ed15698c..256c8c8da3 100644
--- a/lib/ssh/test/ssh_algorithms_SUITE.erl
+++ b/lib/ssh/test/ssh_algorithms_SUITE.erl
@@ -36,7 +36,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,10}}].
+ {timetrap,{seconds,40}}].
all() ->
%% [{group,kex},{group,cipher}... etc
@@ -191,6 +191,9 @@ simple_exec_groups_no_match_too_large(Config) ->
%%--------------------------------------------------------------------
%% Testing all default groups
+
+simple_exec_groups() -> [{timetrap,{seconds,90}}].
+
simple_exec_groups(Config) ->
Sizes = interpolate( public_key:dh_gex_group_sizes() ),
lists:foreach(
@@ -217,6 +220,9 @@ interpolate(Is) ->
%%--------------------------------------------------------------------
%% Use the ssh client of the OS to connect
+
+sshc_simple_exec() -> [{timetrap,{seconds,90}}].
+
sshc_simple_exec(Config) ->
PrivDir = ?config(priv_dir, Config),
KnownHosts = filename:join(PrivDir, "known_hosts"),
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 094d28e879..18a05c0fb8 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -79,7 +79,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,10}}].
+ {timetrap,{seconds,40}}].
all() ->
[app_test,
diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl
index 6e90faf0e8..a1fbe28a83 100644
--- a/lib/ssh/test/ssh_connection_SUITE.erl
+++ b/lib/ssh/test/ssh_connection_SUITE.erl
@@ -37,7 +37,7 @@
%% [{ct_hooks,[ts_install_cth]}].
suite() ->
- [{timetrap,{minutes,2}}].
+ [{timetrap,{seconds,40}}].
all() ->
[
@@ -314,11 +314,7 @@ ptty_alloc_pixel(Config) when is_list(Config) ->
ssh:close(ConnectionRef).
%%--------------------------------------------------------------------
-
-interrupted_send() ->
- [{doc, "Use a subsystem that echos n char and then sends eof to cause a channel exit partway through a large send."}].
-
-interrupted_send(Config) when is_list(Config) ->
+interrupted_send(Config) ->
PrivDir = ?config(priv_dir, Config),
UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth
file:make_dir(UserDir),
diff --git a/lib/ssh/test/ssh_options_SUITE.erl b/lib/ssh/test/ssh_options_SUITE.erl
index ba0107efd6..22a311df3c 100644
--- a/lib/ssh/test/ssh_options_SUITE.erl
+++ b/lib/ssh/test/ssh_options_SUITE.erl
@@ -51,8 +51,10 @@
ssh_connect_arg4_timeout/1,
ssh_connect_negtimeout_parallel/1,
ssh_connect_negtimeout_sequential/1,
- ssh_connect_nonegtimeout_connected_parallel/1,
- ssh_connect_nonegtimeout_connected_sequential/1,
+ ssh_connect_nonegtimeout_connected_parallel/0,
+ ssh_connect_nonegtimeout_connected_parallel/1,
+ ssh_connect_nonegtimeout_connected_sequential/0,
+ ssh_connect_nonegtimeout_connected_sequential/1,
ssh_connect_timeout/1, connect/4,
ssh_daemon_minimal_remote_max_packet_size_option/1,
ssh_msg_debug_fun_option_client/1,
@@ -80,7 +82,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,6}}].
+ {timetrap,{seconds,40}}].
all() ->
[connectfun_disconnectfun_server,
@@ -980,10 +982,16 @@ ssh_connect_negtimeout(Config, Parallel) ->
%%--------------------------------------------------------------------
%%% Test that ssh connection does not timeout if the connection is established (parallel)
+
+ssh_connect_nonegtimeout_connected_parallel() -> [{timetrap,{seconds,90}}].
+
ssh_connect_nonegtimeout_connected_parallel(Config) ->
ssh_connect_nonegtimeout_connected(Config, true).
%%% Test that ssh connection does not timeout if the connection is established (non-parallel)
+
+ssh_connect_nonegtimeout_connected_sequential() -> [{timetrap,{seconds,90}}].
+
ssh_connect_nonegtimeout_connected_sequential(Config) ->
ssh_connect_nonegtimeout_connected(Config, false).
diff --git a/lib/ssh/test/ssh_protocol_SUITE.erl b/lib/ssh/test/ssh_protocol_SUITE.erl
index dbba48c726..eea71038aa 100644
--- a/lib/ssh/test/ssh_protocol_SUITE.erl
+++ b/lib/ssh/test/ssh_protocol_SUITE.erl
@@ -43,7 +43,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,2}}].
+ {timetrap,{seconds,40}}].
all() ->
[{group,tool_tests},
diff --git a/lib/ssh/test/ssh_renegotiate_SUITE.erl b/lib/ssh/test/ssh_renegotiate_SUITE.erl
index 6d2c97aa68..abbe57796f 100644
--- a/lib/ssh/test/ssh_renegotiate_SUITE.erl
+++ b/lib/ssh/test/ssh_renegotiate_SUITE.erl
@@ -31,7 +31,7 @@
%%--------------------------------------------------------------------
suite() -> [{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,12}}].
+ {timetrap,{seconds,40}}].
all() -> [{group,default_algs},
@@ -83,7 +83,8 @@ end_per_testcase(_TestCase, _Config) ->
%%--------------------------------------------------------------------
%%% Idle timeout test
-
+rekey() -> [{timetrap,{seconds,90}}].
+
rekey(Config) ->
{Pid, Host, Port} =
ssh_test_lib:std_daemon(Config,
@@ -105,6 +106,8 @@ rekey(Config) ->
%%% Test rekeying by data volume
+rekey_limit() -> [{timetrap,{seconds,400}}].
+
rekey_limit(Config) ->
UserDir = ?config(priv_dir, Config),
DataFile = filename:join(UserDir, "rekey.data"),
diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl
index c2b04d7a05..76ba78b728 100644
--- a/lib/ssh/test/ssh_sftp_SUITE.erl
+++ b/lib/ssh/test/ssh_sftp_SUITE.erl
@@ -36,7 +36,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,2}}].
+ {timetrap,{seconds,40}}].
all() ->
diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl
index 45439ce0fa..57b93a5f36 100644
--- a/lib/ssh/test/ssh_sftpd_SUITE.erl
+++ b/lib/ssh/test/ssh_sftpd_SUITE.erl
@@ -45,7 +45,7 @@
%%--------------------------------------------------------------------
suite() ->
- [{timetrap,{minutes,3}}].
+ [{timetrap,{seconds,40}}].
all() ->
[open_close_file,
diff --git a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
index 02a2ac4cf9..4c3c2dcd5a 100644
--- a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
+++ b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
@@ -37,7 +37,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,2}}].
+ {timetrap,{seconds,40}}].
all() ->
diff --git a/lib/ssh/test/ssh_sup_SUITE.erl b/lib/ssh/test/ssh_sup_SUITE.erl
index 18e91a9af3..cbbd7d4d76 100644
--- a/lib/ssh/test/ssh_sup_SUITE.erl
+++ b/lib/ssh/test/ssh_sup_SUITE.erl
@@ -36,7 +36,7 @@
suite() ->
[{ct_hooks,[ts_install_cth]},
- {timetrap,{minutes,1}}].
+ {timetrap,{seconds,40}}].
all() ->
[default_tree, sshc_subtree, sshd_subtree, sshd_subtree_profile].
diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl
index 2788bc6b58..80f8607f65 100644
--- a/lib/ssh/test/ssh_to_openssh_SUITE.erl
+++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl
@@ -34,7 +34,7 @@
%%--------------------------------------------------------------------
suite() ->
- [{timetrap,{minutes,1}}].
+ [{timetrap,{seconds,40}}].
all() ->
case os:find_executable("ssh") of
diff --git a/lib/ssh/test/ssh_upgrade_SUITE.erl b/lib/ssh/test/ssh_upgrade_SUITE.erl
index bf8874b118..20df865b55 100644
--- a/lib/ssh/test/ssh_upgrade_SUITE.erl
+++ b/lib/ssh/test/ssh_upgrade_SUITE.erl
@@ -39,7 +39,7 @@
%%% CommonTest callbacks
%%%
suite() ->
- [{timetrap,{minutes,2}}].
+ [{timetrap,{seconds,180}}].
all() ->
[
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl
index d921a69108..37f87b1ff9 100644
--- a/lib/stdlib/src/filename.erl
+++ b/lib/stdlib/src/filename.erl
@@ -1068,24 +1068,43 @@ basedir_darwin(Type) ->
%% user_cache %LOCALAPPDATA%[/$author]/$appname[/$version]/Cache
%% user_log %LOCALAPPDATA%[/$author]/$appname[/$version]/Logs
+-define(basedir_windows_user_data, "Local").
+-define(basedir_windows_user_config, "Roaming").
+-define(basedir_windows_user_cache, "Local"). %% Cache is added later
+-define(basedir_windows_user_log, "Local"). %% Logs is added later
+
basedir_windows(Type) ->
%% If LOCALAPPDATA is not defined we are likely on an
%% XP machine. Use APPDATA instead.
- AppData = basedir_windows_appdata(),
- case Type of
- user_data -> getenv("LOCALAPPDATA", AppData);
- user_config -> AppData;
- user_cache -> getenv("LOCALAPPDATA", AppData);
- user_log -> getenv("LOCALAPPDATA", AppData);
- site_data -> [];
- site_config -> []
+ case basedir_windows_appdata() of
+ noappdata ->
+ %% No AppData is set
+ %% Probably running MSYS
+ case Type of
+ user_data -> basedir_join_home(?basedir_windows_user_data);
+ user_config -> basedir_join_home(?basedir_windows_user_config);
+ user_cache -> basedir_join_home(?basedir_windows_user_cache);
+ user_log -> basedir_join_home(?basedir_windows_user_log);
+ site_data -> [];
+ site_config -> []
+ end;
+ {ok, AppData} ->
+ case Type of
+ user_data -> getenv("LOCALAPPDATA", AppData);
+ user_config -> AppData;
+ user_cache -> getenv("LOCALAPPDATA", AppData);
+ user_log -> getenv("LOCALAPPDATA", AppData);
+ site_data -> [];
+ site_config -> []
+ end
end.
basedir_windows_appdata() ->
case os:getenv("APPDATA") of
Invalid when Invalid =:= false orelse Invalid =:= [] ->
- erlang:error(noappdata);
- Val -> Val
+ noappdata;
+ Val ->
+ {ok, Val}
end.
%% basedir aux