diff options
Diffstat (limited to 'lib')
31 files changed, 523 insertions, 176 deletions
diff --git a/lib/common_test/src/unix_telnet.erl b/lib/common_test/src/unix_telnet.erl index 99ce92e9f1..71df2ab44e 100644 --- a/lib/common_test/src/unix_telnet.erl +++ b/lib/common_test/src/unix_telnet.erl @@ -94,11 +94,16 @@ connect(Ip,Port,Timeout,KeepAlive,Extra) -> {Username,Password} -> connect1(Ip,Port,Timeout,KeepAlive,Username,Password); Name -> - case get_username_and_password(Name) of - {ok,{Username,Password}} -> - connect1(Ip,Port,Timeout,KeepAlive,Username,Password); - Error -> - Error + case not_require_user_and_pass(Name) of + true -> + connect_without_username_and_pass(Ip,Port,Timeout,KeepAlive); + _ -> + case get_username_and_password(Name) of + {ok,{Username,Password}} -> + connect1(Ip,Port,Timeout,KeepAlive,Username,Password); + Error -> + Error + end end end. @@ -144,6 +149,27 @@ connect1(Ip,Port,Timeout,KeepAlive,Username,Password) -> end_log(), Result. +connect_without_username_and_pass(Ip,Port,Timeout,KeepAlive) -> + start_log("unix_telnet:connect"), + Result = + case ct_telnet_client:open(Ip,Port,Timeout,KeepAlive) of + {ok,Pid} -> + {ok, Pid}; + Error -> + cont_log("Could not open telnet connection\n~p\n",[Error]), + Error + end, + end_log(), + Result. + +not_require_user_and_pass(Name) -> + case ct:get_config({Name, not_require_user_and_pass}) of + undefined -> + false; + _ -> + true + end. + get_username_and_password(Name) -> case ct:get_config({Name,username}) of undefined -> diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile index bd746f87a7..a9ebd8f1d3 100644 --- a/lib/common_test/test/Makefile +++ b/lib/common_test/test/Makefile @@ -58,7 +58,8 @@ MODULES= \ ct_group_leader_SUITE \ ct_cover_SUITE \ ct_groups_search_SUITE \ - ct_surefire_SUITE + ct_surefire_SUITE \ + ct_telnet_SUITE ERL_FILES= $(MODULES:%=%.erl) diff --git a/lib/common_test/test/ct_telnet_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE.erl new file mode 100644 index 0000000000..b4f24baa0c --- /dev/null +++ b/lib/common_test/test/ct_telnet_SUITE.erl @@ -0,0 +1,122 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%%------------------------------------------------------------------- +%%% File: ct_telnet_SUITE +%%% +%%% Description: +%%% Edit your ts.unix.config or ts.win32.config before runnings these tests +%%% Test ct_telnet_SUITE module +%%% +%%%------------------------------------------------------------------- +-module(ct_telnet_SUITE). +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Description: Since Common Test starts another Test Server +%% instance, the tests need to be performed on a separate node (or +%% there will be clashes with logging processes etc). +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + ct_test_support:init_per_suite(Config). + +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ + default + ]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +default(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "ct_telnet_basic_SUITE"), + Cfg = {unix, ct:get_config(unix)}, + ok = file:write_file(filename:join(DataDir, "telnet.cfg"), io_lib:write(Cfg) ++ "."), + CfgFile = filename:join(DataDir, "telnet.cfg"), + {Opts,ERPid} = setup([{suite,Suite},{label,default}, {config, CfgFile}], Config), + ok = execute(default, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +setup(Test, Config) -> + Opts0 = ct_test_support:get_opts(Config), + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +execute(Name, Opts, ERPid, Config) -> + ok = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(Name, + reformat(Events, ?eh), + ?config(priv_dir, Config), + Opts), + + TestEvents = events_to_check(Name,Config), + ct_test_support:verify_events(TestEvents, Events, Config). + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +events_to_check(default,Config) -> + {module,_} = code:load_abs(filename:join(?config(data_dir,Config), + ct_telnet_basic_SUITE)), + TCs = ct_telnet_basic_SUITE:all(), + code:purge(ct_telnet_basic_SUITE), + code:delete(ct_telnet_basic_SUITE), + + OneTest = + [{?eh,start_logging,{'DEF','RUNDIR'}}] ++ + [{?eh,tc_done,{ct_telnet_basic_SUITE,TC,ok}} || TC <- TCs] ++ + [{?eh,stop_logging,[]}], + + %% 2 tests (ct:run_test + script_start) is default + OneTest ++ OneTest. diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl new file mode 100644 index 0000000000..914b95f9cf --- /dev/null +++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl @@ -0,0 +1,78 @@ +%% Modify your ts.unix.config or ts.win32.config file before running these tests +-module(ct_telnet_basic_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + + +suite() -> [{require,telnet_temp,{unix,[telnet]}}]. + +all() -> + [start_stop, send_and_get, expect, already_closed, + cmd, sendf, close_wrong_type]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +start_stop(_Config) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + ok = ct_telnet:close(Handle), + ok. +send_and_get(_) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + ok = ct_telnet:send(Handle, "ayt"), + {ok, _Data} = ct_telnet:get_data(Handle), + ok = ct_telnet:close(Handle), + ok. + +expect(_) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + ok = ct_telnet:send(Handle, "echo ayt"), + ok = case ct_telnet:expect(Handle, ["ayt"]) of + {ok, _} -> + ok; + {error, {prompt, _}} -> + ok + end, + ok = ct_telnet:close(Handle), + ok. + +already_closed(_) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + ok = ct_telnet:close(Handle), + {error, already_closed} = ct_telnet:close(Handle), + ok. + +cmd(_) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + {ok, _} = ct_telnet:cmd(Handle, "display"), + {ok, _} = ct_telnet:cmdf(Handle, "~s ~s", ["set", "bsasdel"]), + ok = ct_telnet:close(Handle), + ok. + +sendf(_) -> + {ok, Handle} = ct_telnet:open(telnet_temp), + ok = ct_telnet:sendf(Handle, "~s", ["ayt"]), + ok = ct_telnet:close(Handle), + ok. + +close_wrong_type(_) -> + {error, _} = ct_telnet:close(whatever), + ok. diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 0a2c6e822f..42c7e360c1 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -1053,6 +1053,8 @@ type(hipe_bifs, mark_referred_from, 1, Xs) -> fun (_) -> t_nil() end); type(hipe_bifs, merge_term, 1, Xs) -> strict(arg_types(hipe_bifs, merge_term, 1), Xs, fun ([X]) -> X end); +type(hipe_bifs, nstack_used_size, 0, _) -> + t_non_neg_fixnum(); type(hipe_bifs, patch_call, 3, Xs) -> strict(arg_types(hipe_bifs, patch_call, 3), Xs, fun (_) -> t_nil() end); type(hipe_bifs, patch_insn, 3, Xs) -> @@ -2361,6 +2363,8 @@ arg_types(hipe_bifs, mark_referred_from, 1) -> [t_mfa()]; arg_types(hipe_bifs, merge_term, 1) -> [t_any()]; +arg_types(hipe_bifs, nstack_used_size, 0) -> + []; arg_types(hipe_bifs, patch_call, 3) -> [t_integer(), t_integer(), t_trampoline()]; arg_types(hipe_bifs, patch_insn, 3) -> diff --git a/lib/hipe/icode/Makefile b/lib/hipe/icode/Makefile index 0f2d6db39b..238f70cf59 100644 --- a/lib/hipe/icode/Makefile +++ b/lib/hipe/icode/Makefile @@ -83,7 +83,7 @@ DOC_FILES= $(DOC_MODULES:%=$(DOCS)/%.html) include ../native.mk -ERL_COMPILE_FLAGS += +warn_unused_import +warn_missing_spec # +warn_untyped_record +ERL_COMPILE_FLAGS += +warn_unused_import +warn_exported_vars +warn_missing_spec # +warn_untyped_record # ---------------------------------------------------- # Targets diff --git a/lib/hipe/icode/hipe_icode.erl b/lib/hipe/icode/hipe_icode.erl index 3e211bf385..dfea092af2 100644 --- a/lib/hipe/icode/hipe_icode.erl +++ b/lib/hipe/icode/hipe_icode.erl @@ -261,7 +261,6 @@ %% {tuple, N} %% atom %% {atom, Atom} -%% constant %% number %% integer %% {integer, N} @@ -380,7 +379,6 @@ %% | {tuple, integer()} %% | atom %% | {atom, atom()} -%% | constant %% | number %% | integer %% | {integer, integer()} diff --git a/lib/hipe/icode/hipe_icode.hrl b/lib/hipe/icode/hipe_icode.hrl index d76eebf78d..89d297ef01 100644 --- a/lib/hipe/icode/hipe_icode.hrl +++ b/lib/hipe/icode/hipe_icode.hrl @@ -23,12 +23,6 @@ %%===================================================================== %%--------------------------------------------------------------------- -%% THIS DOES NOT REALLY BELONG HERE -- PLEASE REMOVE ASAP! -%%--------------------------------------------------------------------- - --type ordset(T) :: [T]. - -%%--------------------------------------------------------------------- %% Include files needed for the compilation of this header file %%--------------------------------------------------------------------- @@ -67,7 +61,7 @@ | 'op_exact_eqeq_2' | 'suspend_msg_timeout'. -type icode_type_test() :: 'atom' | 'bignum' | 'binary' | 'bitstr' | 'boolean' - | 'cons' | 'constant' | 'fixnum' | 'float' + | 'cons' | 'fixnum' | 'float' | 'function' | 'function2' | 'integer' | 'list' | 'nil' | 'number' | 'pid' | 'port' | 'reference' | 'tuple' | {'atom', atom()} | {'integer', integer()} diff --git a/lib/hipe/icode/hipe_icode_callgraph.erl b/lib/hipe/icode/hipe_icode_callgraph.erl index ae4b5785c4..6d004823e2 100644 --- a/lib/hipe/icode/hipe_icode_callgraph.erl +++ b/lib/hipe/icode/hipe_icode_callgraph.erl @@ -102,7 +102,7 @@ pp(#icode_callgraph{ordered_sccs = SCCs}) -> %%------------------------------------------------------------------------ %% Get the modules called from this module --spec get_called_modules([mfa_icode()]) -> ordset(atom()). +-spec get_called_modules([mfa_icode()]) -> ordsets:ordset(atom()). get_called_modules(List) -> get_remote_calls(List, []). diff --git a/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl b/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl index 675c8c1ad8..718d5d442b 100644 --- a/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl +++ b/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl @@ -129,8 +129,8 @@ maps_expr_key_enter(Expr, Maps) -> key = none :: 'none' | tuple(), % illegal_icode_instr() defs = none :: 'none' | [icode_var()], direct_replace = false :: boolean(), - inserts = ?SETS:new() :: ?SET(_), - use = ?SETS:new() :: ?SET(_)}). + inserts = ?SETS:new() :: ?SETS:?SET(_), + use = ?SETS:new() :: ?SETS:?SET(_)}). expr_id(#expr{id = Out}) -> Out. expr_defs(#expr{defs = Out}) -> Out. @@ -169,7 +169,7 @@ expr_create(Key, Defs) -> %% exprid - a expression value number which is the expression that %% the variable is defined by. --record(varinfo, {use = ?SETS:new() :: ?SET(_), +-record(varinfo, {use = ?SETS:new() :: ?SETS:?SET(_), ref = none :: 'none' | {non_neg_integer(), non_neg_integer()}, elem = none :: 'none' | {icode_var(), non_neg_integer()}, exprid = none :: 'none' | non_neg_integer()}). @@ -215,12 +215,12 @@ varinfo_use_add(#varinfo{use = UseSet} = I, Use) -> varmap = [] :: [{icode_var(), icode_var()}], pre_loop = false :: boolean(), non_struct_defs = gb_sets:new() :: gb_set(), - up_expr = none :: 'none' | ?SET(_), - killed_expr = none :: 'none' | ?SET(_), - sub_inserts = ?SETS:new() :: ?SET(_), - inserts = ?SETS:new() :: ?SET(_), - antic_in = none :: 'none' | ?SET(_), - antic_out = none :: 'none' | ?SET(_), + up_expr = none :: 'none' | ?SETS:?SET(_), + killed_expr = none :: 'none' | ?SETS:?SET(_), + sub_inserts = ?SETS:new() :: ?SETS:?SET(_), + inserts = ?SETS:new() :: ?SETS:?SET(_), + antic_in = none :: 'none' | ?SETS:?SET(_), + antic_out = none :: 'none' | ?SETS:?SET(_), struct_type = [] :: [struct_type()], struct_elems = [] :: [struct_elems()]}). diff --git a/lib/hipe/regalloc/hipe_ls_regalloc.erl b/lib/hipe/regalloc/hipe_ls_regalloc.erl index d06b938bea..7fb65be6a0 100644 --- a/lib/hipe/regalloc/hipe_ls_regalloc.erl +++ b/lib/hipe/regalloc/hipe_ls_regalloc.erl @@ -72,7 +72,7 @@ %% PhysRegs = [reg()] %% Entrypoints = [labelname()] %% DontSpill = reg() -%% Options = proplist:proplist() +%% Options = proplists:proplist() %% Target = atom() %% Coloring = [{temp(), pos()}] %% NumberOfSpills = integer() diff --git a/lib/hipe/rtl/Makefile b/lib/hipe/rtl/Makefile index 7852a2172b..0312e67822 100644 --- a/lib/hipe/rtl/Makefile +++ b/lib/hipe/rtl/Makefile @@ -74,7 +74,7 @@ TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) include ../native.mk -ERL_COMPILE_FLAGS += +inline +ERL_COMPILE_FLAGS += +inline +warn_unused_import +warn_exported_vars # ---------------------------------------------------- # Targets diff --git a/lib/hipe/rtl/hipe_rtl_binary_match.erl b/lib/hipe/rtl/hipe_rtl_binary_match.erl index d147bed6d8..8831199244 100644 --- a/lib/hipe/rtl/hipe_rtl_binary_match.erl +++ b/lib/hipe/rtl/hipe_rtl_binary_match.erl @@ -2,7 +2,7 @@ %%% %%% %CopyrightBegin% %%% -%%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%%% Copyright Ericsson AB 2007-2013. All Rights Reserved. %%% %%% The contents of this file are subject to the Erlang Public License, %%% Version 1.1, (the "License"); you may not use this file except in @@ -42,6 +42,7 @@ %%-------------------------------------------------------------------- +%% ----- bs_start_match ----- gen_rtl({bs_start_match, 0}, [Ms], [Binary], TrueLblName, FalseLblName) -> ReInitLbl = hipe_rtl:mk_new_label(), BinaryLbl = hipe_rtl:mk_new_label(), @@ -62,7 +63,7 @@ gen_rtl({bs_start_match, Max}, [Ms], [Binary], TrueLblName, FalseLblName) -> TestCode = [hipe_rtl:mk_move(Ms,Binary), hipe_tagscheme:test_matchstate(Binary, - hipe_rtl:label_name(MatchStateLbl), + hipe_rtl:label_name(MatchStateLbl), hipe_rtl:label_name(BinaryLbl), 0.99)], MatchStateTestCode = @@ -86,7 +87,7 @@ gen_rtl({{bs_start_match, bitstr}, Max}, [Ms], [Binary], gen_rtl({{bs_start_match, bitstr}, _Max}, [], [_Binary], TrueLblName, _FalseLblName) -> [hipe_rtl:mk_goto(TrueLblName)]; -gen_rtl({{bs_start_match,ok_matchstate}, Max}, [Ms], [Binary], +gen_rtl({{bs_start_match, ok_matchstate}, Max}, [Ms], [Binary], TrueLblName, FalseLblName) -> MatchStateLbl = hipe_rtl:mk_new_label(), BinaryLbl = hipe_rtl:mk_new_label(), @@ -106,12 +107,13 @@ gen_rtl({{bs_start_match, ok_matchstate}, _Max}, [], [Binary], hipe_rtl:label_name(MatchStateLbl), 0.99), MatchStateLbl, hipe_tagscheme:test_matchstate(Binary, TrueLblName, FalseLblName, 0.99)]; -gen_rtl({bs_get_integer, 0, _Flags}, [Dst, NewMs], [Ms], +%% ----- bs_get_integer ----- +gen_rtl({bs_get_integer, 0, _Flags}, [Dst, NewMs], [Ms], TrueLblName, _FalseLblName) -> update_ms(NewMs, Ms) ++ [hipe_rtl:mk_move(Dst, hipe_rtl:mk_imm(15)), hipe_rtl:mk_goto(TrueLblName)]; -gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args, +gen_rtl({bs_get_integer, Size, Flags}, [Dst, NewMs], Args, TrueLblName, FalseLblName) -> case is_illegal_const(Size) of true -> @@ -123,15 +125,14 @@ gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args, UnSafe = unsafe(Flags), case Args of [Ms] -> - CCode= int_get_c_code(Dst, Ms, hipe_rtl:mk_imm(Size), - Flags, TrueLblName, FalseLblName), + CCode = int_get_c_code(Dst, Ms, hipe_rtl:mk_imm(Size), + Flags, TrueLblName, FalseLblName), update_ms(NewMs, Ms) ++ get_static_int(Dst, Ms, Size, CCode, Signed, LittleEndian, Aligned, UnSafe, TrueLblName, FalseLblName); [Ms, Arg] -> - {SizeCode1, SizeReg1} = - make_size(Size, Arg, FalseLblName), + {SizeCode1, SizeReg1} = make_size(Size, Arg, FalseLblName), CCode = int_get_c_code(Dst, Ms, SizeReg1, Flags, TrueLblName, FalseLblName), InCode = get_dynamic_int(Dst, Ms, SizeReg1, CCode, @@ -140,7 +141,8 @@ gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args, update_ms(NewMs, Ms) ++ SizeCode1 ++ InCode end end; -gen_rtl({bs_get_float,Size,Flags}, [Dst1,NewMs], Args, +%% ----- bs_get_float ----- +gen_rtl({bs_get_float,Size,Flags}, [Dst1, NewMs], Args, TrueLblName, FalseLblName) -> case is_illegal_const(Size) of true -> @@ -152,24 +154,26 @@ gen_rtl({bs_get_float,Size,Flags}, [Dst1,NewMs], Args, CCode = float_get_c_code(Dst1, Ms, hipe_rtl:mk_imm(Size), Flags, TrueLblName, FalseLblName), update_ms(NewMs, Ms) ++ CCode; - [Ms,Arg] -> - {SizeCode, SizeReg} = make_size(Size, Arg, - FalseLblName), + [Ms, Arg] -> + {SizeCode, SizeReg} = make_size(Size, Arg, FalseLblName), CCode = float_get_c_code(Dst1, Ms, SizeReg, Flags, TrueLblName, FalseLblName), update_ms(NewMs, Ms) ++ SizeCode ++ CCode end end; +%% ----- bs_get_binary_all ----- gen_rtl({bs_get_binary_all, Unit, _Flags}, [Dst], [Ms], TrueLblName, FalseLblName) -> [hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++ get_binary_all(Dst, Unit, Ms, TrueLblName,FalseLblName); -gen_rtl({bs_get_binary_all_2, Unit, _Flags}, [Dst,NewMs], [Ms], +%% ----- bs_get_binary_all_2 ----- +gen_rtl({bs_get_binary_all_2, Unit, _Flags}, [Dst, NewMs], [Ms], TrueLblName, FalseLblName) -> [hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++ update_ms(NewMs, Ms) ++ get_binary_all(Dst, Unit, Ms, TrueLblName, FalseLblName); -gen_rtl({bs_get_binary,Size,Flags}, [Dst,NewMs], Args, +%% ----- bs_get_binary ----- +gen_rtl({bs_get_binary, Size, Flags}, [Dst, NewMs], Args, TrueLblName, FalseLblName) -> case is_illegal_const(Size) of true -> @@ -188,65 +192,78 @@ gen_rtl({bs_get_binary,Size,Flags}, [Dst,NewMs], Args, [hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++ update_ms(NewMs, Ms) ++ SizeCode ++ InCode end; -gen_rtl(bs_get_utf8, [Dst,NewMs], [Ms], TrueLblName, FalseLblName) -> +%% ----- bs_get_utf8 ----- +gen_rtl(bs_get_utf8, [Dst, NewMs], [Ms], TrueLblName, FalseLblName) -> update_ms(NewMs, Ms) ++ utf8_get_c_code(Dst, Ms, TrueLblName, FalseLblName); -gen_rtl({bs_get_utf16,Flags}, [Dst,NewMs], [Ms], TrueLblName, FalseLblName) -> - update_ms(NewMs, Ms) ++ utf16_get_c_code(Flags, Dst, Ms, TrueLblName, FalseLblName); -gen_rtl(bs_validate_unicode_retract, [NewMs], [Src,Ms], TrueLblName, FalseLblName) -> - update_ms(NewMs, Ms) ++ validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName); +%% ----- bs_get_utf16 ----- +gen_rtl({bs_get_utf16, Flags}, [Dst, NewMs], [Ms], TrueLblName, FalseLblName) -> + update_ms(NewMs, Ms) ++ + utf16_get_c_code(Flags, Dst, Ms, TrueLblName, FalseLblName); +%% ----- bs_validate_unicode_retract ----- +gen_rtl(bs_validate_unicode_retract, [NewMs], [Src, Ms], + TrueLblName, FalseLblName) -> + update_ms(NewMs, Ms) ++ + validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName); +%% ----- bs_test_tail ----- gen_rtl({bs_test_tail, NumBits}, [NewMs], [Ms], TrueLblName, FalseLblName) -> {[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms), update_ms(NewMs, Ms) ++ ExCode ++ [add_to_offset(Offset, Offset, hipe_rtl:mk_imm(NumBits), FalseLblName), hipe_rtl:mk_branch(Offset, eq, BinSize, TrueLblName, FalseLblName)]; +%% ----- bs_test_unit ----- gen_rtl({bs_test_unit, Unit}, [], [Ms], TrueLblName, FalseLblName) -> - {[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms), + {[Offset, BinSize], ExCode} = extract_matchstate_vars([offset, binsize], Ms), SizeReg = hipe_rtl:mk_new_reg(), ExCode ++ [hipe_rtl:mk_alu(SizeReg, BinSize, sub, Offset)| test_alignment_code(SizeReg, Unit, TrueLblName, FalseLblName)]; gen_rtl({bs_test_tail, NumBits}, [], [Ms], TrueLblName, FalseLblName) -> - {[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms), + {[Offset, BinSize], ExCode} = extract_matchstate_vars([offset, binsize], Ms), ExCode ++ [add_to_offset(Offset, Offset, hipe_rtl:mk_imm(NumBits), FalseLblName), hipe_rtl:mk_branch(Offset, eq, BinSize, TrueLblName, FalseLblName)]; -gen_rtl({bs_skip_bits_all, Unit, _Flags}, Dst, [Ms], +%% ----- bs_skip_bits_all ----- +gen_rtl({bs_skip_bits_all, Unit, _Flags}, Dst, [Ms], TrueLblName, FalseLblName) -> opt_update_ms(Dst, Ms) ++ skip_bits_all(Unit, Ms, TrueLblName, FalseLblName); +%% ----- bs_skip_bits ----- gen_rtl({bs_skip_bits, Bits}, Dst, [Ms|Args], TrueLblName, FalseLblName) -> - opt_update_ms(Dst,Ms) ++ - case Args of - [] -> - skip_bits2(Ms, hipe_rtl:mk_imm(Bits), TrueLblName, FalseLblName); - [Arg] -> - {SizeCode, SizeReg} = make_size(Bits, Arg, FalseLblName), - InCode = skip_bits2(Ms, SizeReg, TrueLblName, FalseLblName), - SizeCode ++ InCode - end; + opt_update_ms(Dst, Ms) ++ + case Args of + [] -> + skip_bits2(Ms, hipe_rtl:mk_imm(Bits), TrueLblName, FalseLblName); + [Arg] -> + {SizeCode, SizeReg} = make_size(Bits, Arg, FalseLblName), + InCode = skip_bits2(Ms, SizeReg, TrueLblName, FalseLblName), + SizeCode ++ InCode + end; +%% ----- bs_restore ----- gen_rtl({bs_restore, Slot}, [NewMs], [Ms], TrueLblName, _FalseLblName) -> Tmp1 = hipe_rtl:mk_new_reg_gcsafe(), update_ms(NewMs, Ms) ++ [get_field_from_term({matchstate, {saveoffset, Slot}}, Ms, Tmp1), set_field_from_term({matchstate, {matchbuffer, offset}}, Ms, Tmp1), hipe_rtl:mk_goto(TrueLblName)]; +%% ----- bs_save ----- gen_rtl({bs_save, Slot}, [NewMs], [Ms], TrueLblName, _FalseLblName) -> {Offset, Instr} = extract_matchstate_var(offset, Ms), update_ms(NewMs, Ms) ++ [Instr, set_field_from_term({matchstate, {saveoffset, Slot}}, Ms, Offset), hipe_rtl:mk_goto(TrueLblName)]; -gen_rtl({bs_match_string, String, ByteSize}, [NewMs], - [Ms], TrueLblName, FalseLblName) -> +%% ----- bs_match_string ----- +gen_rtl({bs_match_string, String, ByteSize}, Dst, [Ms], + TrueLblName, FalseLblName) -> {[Offset, BinSize, Base], Instrs} = extract_matchstate_vars([offset, binsize, base], Ms), [SuccessLbl, ALbl, ULbl] = create_lbls(3), - [NewOffset,BitOffset] = create_gcsafe_regs(2), + [NewOffset, BitOffset] = create_gcsafe_regs(2), Unit = hipe_rtl_arch:word_size() - 1, Loops = ByteSize div Unit, Init = [Instrs, - update_ms(NewMs,Ms), + opt_update_ms(Dst, Ms), check_size(Offset, hipe_rtl:mk_imm(ByteSize*?BYTE_SIZE), BinSize, NewOffset, hipe_rtl:label_name(SuccessLbl), FalseLblName), SuccessLbl], @@ -255,10 +272,10 @@ gen_rtl({bs_match_string, String, ByteSize}, [NewMs], hipe_rtl:label_name(ALbl), hipe_rtl:label_name(ULbl))], Loops = ByteSize div Unit, SkipSize = Loops * Unit, - {ACode1,UCode1} = + {ACode1, UCode1} = case Loops of 0 -> - {[],[]}; + {[], []}; _ -> create_loops(Loops, Unit, String, Base, Offset, BitOffset, FalseLblName) @@ -267,12 +284,17 @@ gen_rtl({bs_match_string, String, ByteSize}, [NewMs], {ACode2, UCode2} = case ByteSize rem Unit of 0 -> - {[],[]}; + {[], []}; Rem -> create_rests(Rem, RestString, Base, Offset, BitOffset, FalseLblName) end, - End = [update_offset(NewOffset, NewMs), hipe_rtl:mk_goto(TrueLblName)], - [Init, SplitCode, ALbl, ACode1, ACode2, End, ULbl, UCode1, UCode2,End]; + GoTo = hipe_rtl:mk_goto(TrueLblName), + End = case Dst of + [] -> [GoTo]; + [NewMs] -> [update_offset(NewOffset, NewMs), GoTo] + end, + [Init, SplitCode, ALbl, ACode1, ACode2, End, ULbl, UCode1, UCode2, End]; +%% ----- bs_context_to_binary ----- gen_rtl(bs_context_to_binary, [Bin], [Var], TrueLblName, _FalseLblName) -> MSLabel = hipe_rtl:mk_new_label(), [hipe_rtl:mk_move(Bin, Var), @@ -304,9 +326,7 @@ get_c_code(Func, Dst1, Ms, Size, Flags, TrueLblName, FalseLblName) -> hipe_rtl_arch:call_bif([Dst1], Func, [SizeReg, FlagsReg, MatchBuf], hipe_rtl:label_name(RetLabel), FalseLblName), RetLabel, - hipe_rtl:mk_branch(Dst1, eq, NonVal, - FalseLblName, - TrueLblName, 0.01)]. + hipe_rtl:mk_branch(Dst1, eq, NonVal, FalseLblName, TrueLblName, 0.01)]. utf8_get_c_code(Dst, Ms, TrueLblName, FalseLblName) -> MatchBuf = hipe_rtl:mk_new_reg(), @@ -330,7 +350,7 @@ validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName) -> Tmp = hipe_rtl:mk_new_reg(), [hipe_tagscheme:extract_matchbuffer(MatchBuf, Ms), hipe_rtl_arch:call_bif([Tmp], bs_validate_unicode_retract, - [MatchBuf,Src], [], []), + [MatchBuf, Src], [], []), hipe_rtl:mk_branch(Tmp, eq, Zero, FalseLblName, TrueLblName, 0.01)]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Int Code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -464,9 +484,9 @@ get_int_from_unaligned_bin(Ms, Size, Dst1, Signed, {[Base,Offset,BinSize], ExCode} = extract_matchstate_vars([base,offset,binsize], Ms), ExCode ++ - [check_size(Offset, hipe_rtl:mk_imm(Size), BinSize, NewOffset, - UnSafe, hipe_rtl:label_name(SuccessLbl), FalseLblName), - SuccessLbl] ++ + [check_size(Offset, hipe_rtl:mk_imm(Size), BinSize, NewOffset, + UnSafe, hipe_rtl:label_name(SuccessLbl), FalseLblName), + SuccessLbl] ++ [update_offset(NewOffset, Ms)] ++ get_unaligned_int(Dst1, Size, Base, Offset, Shiftr, Type, TrueLblName). @@ -499,7 +519,7 @@ make_matchstate(Binary, Max, Ms, TrueLblName, FalseLblName) -> Offset = hipe_rtl:mk_new_reg_gcsafe(), Lbl = hipe_rtl:mk_new_label(), [hipe_rtl:mk_gctest(?MS_MIN_SIZE+Max), - get_binary_bytes(Binary, BinSize, Base, Offset, + get_binary_bytes(Binary, BinSize, Base, Offset, Orig, hipe_rtl:label_name(Lbl), FalseLblName), Lbl, hipe_tagscheme:create_matchstate(Max, BinSize, Base, Offset, Orig, Ms), @@ -551,24 +571,22 @@ get_binary_all(Dst1, Unit, Ms, TrueLblName, FalseLblName) -> hipe_rtl:mk_goto(TrueLblName)], ExCode ++ MakeCode. -get_binary(Dst1, Ms, SizeReg, - UnSafe, TrueLblName, FalseLblName) -> +get_binary(Dst1, Ms, SizeReg, UnSafe, TrueLblName, FalseLblName) -> [SuccessLbl] = create_lbls(1), [EndOffset] = create_gcsafe_regs(1), {[Offset,BinSize,Orig], ExCode} = extract_matchstate_vars([offset,binsize,orig], Ms), CheckCode = - [check_size(Offset, SizeReg, BinSize, EndOffset, - UnSafe, hipe_rtl:label_name(SuccessLbl), - FalseLblName), + [check_size(Offset, SizeReg, BinSize, EndOffset, UnSafe, + hipe_rtl:label_name(SuccessLbl), FalseLblName), SuccessLbl], MakeCode = - construct_subbin(Dst1,SizeReg,Offset,Orig) + construct_subbin(Dst1, SizeReg, Offset, Orig) ++ [update_offset(EndOffset, Ms), hipe_rtl:mk_goto(TrueLblName)], ExCode ++ CheckCode ++ MakeCode. -construct_subbin(Dst,Size,Offset,Orig) -> +construct_subbin(Dst, Size, Offset, Orig) -> [BitOffset, ByteOffset, BitSize, ByteSize] = create_gcsafe_regs(4), [hipe_rtl:mk_alu(ByteSize, Size, srl, hipe_rtl:mk_imm(?BYTE_SHIFT)), hipe_rtl:mk_alu(BitSize, Size, 'and', hipe_rtl:mk_imm(?LOW_BITS)), @@ -579,12 +597,10 @@ construct_subbin(Dst,Size,Offset,Orig) -> %%%%%%%%%%%%%%%%%%%%%%%%% Skip Bits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -skip_bits_all(1, Ms, TrueLblName,_FalseLblName) -> +skip_bits_all(1, Ms, TrueLblName, _FalseLblName) -> {[BinSize], ExCode} = extract_matchstate_vars([binsize], Ms), - ExCode ++ - [update_offset(BinSize,Ms), - hipe_rtl:mk_goto(TrueLblName)]; -skip_bits_all(Unit,Ms, TrueLblName,FalseLblName) -> + ExCode ++ [update_offset(BinSize,Ms), hipe_rtl:mk_goto(TrueLblName)]; +skip_bits_all(Unit,Ms, TrueLblName, FalseLblName) -> [Size] = create_gcsafe_regs(1), [SuccessLbl] = create_lbls(1), SLblName = hipe_rtl:label_name(SuccessLbl), @@ -597,7 +613,7 @@ skip_bits_all(Unit,Ms, TrueLblName,FalseLblName) -> update_offset(BinSize,Ms), hipe_rtl:mk_goto(TrueLblName)]. -test_alignment_code(Size,Unit,SLblName,FalseLblName) -> +test_alignment_code(Size, Unit, SLblName, FalseLblName) -> case Unit of 1 -> [hipe_rtl:mk_goto(SLblName)]; 2 -> get_fast_test_code(Size,1,SLblName,FalseLblName); @@ -608,13 +624,13 @@ test_alignment_code(Size,Unit,SLblName,FalseLblName) -> _ -> get_slow_test_code(Size,Unit,SLblName,FalseLblName) end. -get_fast_test_code(Size,AndTest,SLblName,FalseLblName) -> +get_fast_test_code(Size, AndTest, SLblName, FalseLblName) -> [Tmp] = create_gcsafe_regs(1), - [hipe_rtl:mk_alub(Tmp,Size,'and',hipe_rtl:mk_imm(AndTest), - eq,SLblName,FalseLblName)]. + [hipe_rtl:mk_alub(Tmp, Size, 'and', hipe_rtl:mk_imm(AndTest), + 'eq', SLblName, FalseLblName)]. %% This is really slow -get_slow_test_code(Size,Unit,SLblName,FalseLblName) -> +get_slow_test_code(Size, Unit, SLblName, FalseLblName) -> [Tmp] = create_gcsafe_regs(1), [LoopLbl,Lbl1,Lbl2] = create_lbls(3), LoopLblName = hipe_rtl:label_name(LoopLbl), @@ -638,7 +654,7 @@ skip_bits2(Ms, NoOfBits, TrueLblName, FalseLblName) -> [hipe_rtl:mk_branch(BinSize, 'ltu', NewOffset, FalseLblName, hipe_rtl:label_name(TempLbl), 0.01), TempLbl, - update_offset(NewOffset,Ms), + update_offset(NewOffset, Ms), hipe_rtl:mk_goto(TrueLblName)]. add_to_offset(Result, Extra, Original, FalseLblName) -> @@ -685,7 +701,7 @@ get_base(Orig,Base) -> [hipe_tagscheme:test_heap_binary(Orig, hipe_rtl:label_name(HeapLbl), hipe_rtl:label_name(REFCLbl)), HeapLbl, - hipe_rtl:mk_alu(Base, Orig, add, hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)), + hipe_rtl:mk_alu(Base, Orig, 'add', hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)), hipe_rtl:mk_goto(hipe_rtl:label_name(EndLbl)), REFCLbl, hipe_rtl:mk_load(Base, Orig, hipe_rtl:mk_imm(?PROC_BIN_BYTES-2)), @@ -761,8 +777,7 @@ unsafe(Flags) -> end. update_offset(NewOffset, Ms) -> - set_field_from_term({matchstate,{matchbuffer,offset}}, - Ms, NewOffset). + set_field_from_term({matchstate, {matchbuffer, offset}}, Ms, NewOffset). opt_update_ms([NewMs], OldMs) -> [hipe_rtl:mk_move(NewMs, OldMs)]; @@ -774,7 +789,7 @@ update_ms(NewMs, OldMs) -> create_lbls(0) -> []; -create_lbls(X) when X > 0-> +create_lbls(X) when X > 0 -> [hipe_rtl:mk_new_label()|create_lbls(X-1)]. make_dyn_prep(SizeReg, CCode) -> @@ -1101,9 +1116,12 @@ multiply_code(List=[Head|_Tail], Variable, Result, FalseLblName) -> multiply_code([ShiftSize|Rest], Register, Result, FalseLblName, Tmp1, OldCode) -> SuccessLbl = hipe_rtl:mk_new_label(), - Code = OldCode ++ [hipe_rtl:mk_alu(Tmp1, Register, sll, hipe_rtl:mk_imm(ShiftSize)), - hipe_rtl:mk_alub(Result, Tmp1, 'add', Result, not_overflow, hipe_rtl:label_name(SuccessLbl), FalseLblName, 0.99), - SuccessLbl], + Code = + OldCode ++ + [hipe_rtl:mk_alu(Tmp1, Register, sll, hipe_rtl:mk_imm(ShiftSize)), + hipe_rtl:mk_alub(Result, Tmp1, 'add', Result, not_overflow, + hipe_rtl:label_name(SuccessLbl), FalseLblName, 0.99), + SuccessLbl], multiply_code(Rest, Register, Result, FalseLblName, Tmp1, Code); multiply_code([], _Register, _Result, _FalseLblName, _Tmp1, Code) -> Code. diff --git a/lib/hipe/rtl/hipe_tagscheme.erl b/lib/hipe/rtl/hipe_tagscheme.erl index 0cc6c2deec..f1e8d1ef41 100644 --- a/lib/hipe/rtl/hipe_tagscheme.erl +++ b/lib/hipe/rtl/hipe_tagscheme.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2011. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ %%======================================================================== %% %% Filename : hipe_tagscheme.erl -%% Note : This is specific to Erlang 5.* (i.e. R9 to R13). +%% Note : This is specific to Erlang 5.* (i.e. starting with R9). %% %% Modifications: %% 020904: Happi - added support for external pids and ports. diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec index 653e515317..e4746fe14c 100644 --- a/lib/mnesia/test/mnesia.spec +++ b/lib/mnesia/test/mnesia.spec @@ -1,4 +1,4 @@ -{suites,"../mnesia_test",all}. +{suites,"../mnesia_test",[mnesia_SUITE]}. {skip_cases,"../mnesia_test",mnesia_measure_test, [ram_meter], "Takes to long time"}. diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl index f0f3053ebf..6baf86a4a5 100644 --- a/lib/mnesia/test/mnesia_config_test.erl +++ b/lib/mnesia/test/mnesia_config_test.erl @@ -596,8 +596,8 @@ dump_log_load_regulation(Config) when is_list(Config) -> {n_branches, length(Nodes) * 10}, {n_accounts_per_branch, 5}, {replica_type, disc_copies}, - {stop_after, timer:seconds(30)}, - {report_interval, timer:seconds(10)}, + {stop_after, timer:seconds(15)}, + {report_interval, timer:seconds(3)}, {use_running_mnesia, true}, {reuse_history_id, true}], diff --git a/lib/mnesia/test/mnesia_durability_test.erl b/lib/mnesia/test/mnesia_durability_test.erl index 2fee72f066..1de62a7d25 100644 --- a/lib/mnesia/test/mnesia_durability_test.erl +++ b/lib/mnesia/test/mnesia_durability_test.erl @@ -100,14 +100,14 @@ load_latest_data(Config) when is_list(Config) -> ?match([], mnesia_test_lib:start_mnesia([N1], [])), %% Should wait for N2 - ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])), + ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])), ?match([], mnesia_test_lib:start_mnesia([N3], [])), - ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])), + ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])), ?match([], mnesia_test_lib:start_mnesia([N2], [])), - ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 3000])), - ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])), + ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 10000])), + ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 10000])), %% We should find the record ?match([Rec2], rpc:call(N1, mnesia, dirty_read, [t1, test])), ?match([Rec2], rpc:call(N2, mnesia, dirty_read, [t1, test])), @@ -124,12 +124,12 @@ load_latest_data(Config) when is_list(Config) -> ?match([], mnesia_test_lib:start_mnesia([N2], [])), %% Should wait for N1 - ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 2000])), + ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])), ?match([], mnesia_test_lib:start_mnesia([N3], [])), - ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 2000])), + ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])), ?match([], mnesia_test_lib:start_mnesia([N1], [])), - ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])), - ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])), + ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 10000])), + ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 10000])), %% We should find the record ?match([Rec1], rpc:call(N1, mnesia, dirty_read, [t1, test])), ?match([Rec1], rpc:call(N2, mnesia, dirty_read, [t1, test])), diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl index 373d47a05a..219f358fdb 100644 --- a/lib/mnesia/test/mnesia_examples_test.erl +++ b/lib/mnesia/test/mnesia_examples_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -34,32 +34,6 @@ end_per_testcase(Func, Conf) -> delete_schema], N, Config, ?FILE, ?LINE)). -opt_net_load(ExampleMod) -> - opt_net_load([node() | nodes()], ExampleMod, ok). - -opt_net_load([Node | Nodes], ExampleMod, Res) -> - case rpc:call(Node, ?MODULE, opt_load, [ExampleMod]) of - {module, ExampleMod} -> - opt_net_load(Nodes, ExampleMod, Res); - {error, Reason} -> - Error = {opt_net_load, ExampleMod, Node, Reason}, - opt_net_load(Nodes, ExampleMod, {error, Error}); - {badrpc, Reason} -> - Error = {opt_net_load, ExampleMod, Node, Reason}, - opt_net_load(Nodes, ExampleMod, {error, Error}) - end; -opt_net_load([], _ExampleMod, Res) -> - Res. - -opt_load(Mod) -> - case code:is_loaded(Mod) of - {file, _} -> - {module, Mod}; - false -> - Abs = filename:join([code:lib_dir(mnesia), examples, Mod]), - code:load_abs(Abs) - end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> [bup, company, meter, {group, tpcb}]. @@ -95,49 +69,49 @@ replica_test(suite) -> []; replica_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(replica_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(replica_test, ram_copies))). sticky_replica_test(suite) -> []; sticky_replica_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(sticky_replica_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(sticky_replica_test, ram_copies))). dist_test(suite) -> []; dist_test(Config) when is_list(Config) -> ?init(3, [{tc_timeout, timer:minutes(10)} | Config]), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(dist_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(dist_test, ram_copies))). conflict_test(suite) -> []; conflict_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(conflict_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(conflict_test, ram_copies))). frag_test(suite) -> []; frag_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(frag_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(frag_test, ram_copies))). frag2_test(suite) -> []; frag2_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(frag2_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(frag2_test, ram_copies))). remote_test(suite) -> []; remote_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(remote_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(remote_test, ram_copies))). remote_frag2_test(suite) -> []; remote_frag2_test(Config) when is_list(Config) -> ?init(3, Config), opt_net_load(mnesia_tpcb), - ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(remote_frag2_test, ram_copies))). + ?match({ok, _}, mnesia_tpcb:start(config(remote_frag2_test, ram_copies))). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% meter(doc) -> @@ -149,4 +123,37 @@ meter(Config) when is_list(Config) -> opt_net_load(mnesia_meter), ?match(ok, mnesia_meter:go(ram_copies, [N])). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +config(Test, Type) -> + Config0 = mnesia_tpcb:config(Test, Type), + %% Cut the times, the idea is to test the example and configuration + %% not running the test a long time + Config1 = lists:keyreplace(stop_after, 1, Config0, {stop_after, 6000}), + lists:keyreplace(report_interval, 1, Config1, {report_interval, 1000}). + +opt_net_load(ExampleMod) -> + opt_net_load([node() | nodes()], ExampleMod, ok). + +opt_net_load([Node | Nodes], ExampleMod, Res) -> + case rpc:call(Node, ?MODULE, opt_load, [ExampleMod]) of + {module, ExampleMod} -> + opt_net_load(Nodes, ExampleMod, Res); + {error, Reason} -> + Error = {opt_net_load, ExampleMod, Node, Reason}, + opt_net_load(Nodes, ExampleMod, {error, Error}); + {badrpc, Reason} -> + Error = {opt_net_load, ExampleMod, Node, Reason}, + opt_net_load(Nodes, ExampleMod, {error, Error}) + end; +opt_net_load([], _ExampleMod, Res) -> + Res. +opt_load(Mod) -> + case code:is_loaded(Mod) of + {file, _} -> + {module, Mod}; + false -> + Abs = filename:join([code:lib_dir(mnesia), examples, Mod]), + code:load_abs(Abs) + end. diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl index c4910a4b11..0d0ad32fb0 100644 --- a/lib/mnesia/test/mnesia_recovery_test.erl +++ b/lib/mnesia/test/mnesia_recovery_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -607,7 +607,7 @@ explicit_stop_during_snmp(Config) when is_list(Config) -> Do_trans_Pid1 = spawn_link(Node2, ?MODULE, do_trans_loop, [Tab, self()]), Do_trans_Pid2 = spawn_link(?MODULE, do_trans_loop, [Tab, self()]), - Start_stop_Pid = spawn_link(?MODULE, start_stop, [Node1, 10, self()]), + Start_stop_Pid = spawn_link(?MODULE, start_stop, [Node1, 5, self()]), receive test_done -> ok @@ -631,13 +631,13 @@ do_trans_loop2(Tab, Father) -> end, case mnesia:transaction(Trans) of {atomic, ok} -> - timer:sleep(200), + timer:sleep(100), do_trans_loop2(Tab, Father); {aborted, {node_not_running, N}} when N == node() -> - timer:sleep(200), + timer:sleep(100), do_trans_loop2(Tab, Father); {aborted, {no_exists, Tab}} -> - timer:sleep(200), + timer:sleep(100), do_trans_loop2(Tab, Father); Else -> ?error("Transaction failed: ~p ~n", [Else]), @@ -649,9 +649,9 @@ start_stop(_Node1, 0, Father) -> Father ! test_done, exit(shutdown); start_stop(Node1, N, Father) when N > 0-> - timer:sleep(timer:seconds(5)), - ?match(stopped, rpc:call(Node1, mnesia, stop, [])), timer:sleep(timer:seconds(2)), + ?match(stopped, rpc:call(Node1, mnesia, stop, [])), + timer:sleep(timer:seconds(1)), ?match([], mnesia_test_lib:start_mnesia([Node1])), start_stop(Node1, N-1, Father). diff --git a/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl b/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl index 768653c898..aa582d1d4e 100644 --- a/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl +++ b/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl @@ -30,7 +30,7 @@ -include("CosNaming_NamingContext.hrl"). -include("CosNaming_NamingContextExt.hrl"). -include_lib("orber/include/corba.hrl"). - +-include_lib("orber/src/orber_iiop.hrl"). %%----------------------------------------------------------------- %% External exports @@ -182,6 +182,8 @@ address(protocol, [$:|T], [], []) -> address(version, T, [], [iiop]); address(protocol, [$i, $i, $o, $p, $:|T], [], []) -> address(version, T, [], [iiop]); +address(protocol, [$s,$s,$l, $i, $o, $p, $:|T], [], []) -> + address(version, T, [], [ssliop]); address(protocol, [$r, $i, $r, $:|T], [], []) -> {false, rir, T}; address(protocol, What, _, _) -> @@ -465,6 +467,20 @@ lookup({corbaname, [[iiop, Vers, Host, Port]|Addresses], Key, Name}, Ctx) -> Obj -> Obj end; +%%% Corbaname via SSL +lookup({corbaname, [[ssliop, Vers, Host, Port]|Addresses], Key, Name}, Ctx) -> + SSLComponent = + #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, + component_data=#'SSLIOP_SSL'{target_supports = 2, + target_requires = 2, + port = Port}}, + NS = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key, [SSLComponent]), + case catch 'CosNaming_NamingContext':resolve(NS, Ctx, Name) of + {'EXCEPTION', _} -> + lookup({corbaname, Addresses, Key, Name}, Ctx); + Obj -> + Obj + end; lookup({corbaname, [_|Addresses], Key, Name}, Ctx) -> lookup({corbaname, Addresses, Key, Name}, Ctx); @@ -498,7 +514,43 @@ lookup({corbaloc, [[iiop, Vers, Host, Port]|Addresses], Key}, Ctx) -> lookup({corbaloc, Addresses, Key}, Ctx) end end; - + +%%% Corbaloc via SSL +lookup({corbaloc, [[ssliop, Vers, Host, Port]|Addresses], Key}, Ctx) -> + SSLComponent = + #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, + component_data=#'SSLIOP_SSL'{target_supports = 2, + target_requires = 2, + port = Port}}, + ObjRef = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key, [SSLComponent]), + OldVal = put(orber_forward_notify, true), + + case catch corba_object:non_existent(ObjRef, Ctx) of + {location_forward, Result} -> + put(orber_forward_notify, OldVal), + Result; + false -> + put(orber_forward_notify, OldVal), + ObjRef; + true -> + put(orber_forward_notify, OldVal), + lookup({corbaloc, Addresses, Key}, Ctx); + _ -> + %% May be located on a version using '_not_existent' + %% see CORBA2.3.1 page 15-34 try again. + case catch corba_object:not_existent(ObjRef, Ctx) of + {location_forward, Result} -> + put(orber_forward_notify, OldVal), + Result; + false -> + put(orber_forward_notify, OldVal), + ObjRef; + _ -> + put(orber_forward_notify, OldVal), + lookup({corbaloc, Addresses, Key}, Ctx) + end + end; + lookup({corbaloc, [_|Addresses], Key}, Ctx) -> lookup({corbaloc, Addresses, Key}, Ctx); diff --git a/lib/orber/doc/src/notes.xml b/lib/orber/doc/src/notes.xml index d43ab3ac24..9e896f03c8 100644 --- a/lib/orber/doc/src/notes.xml +++ b/lib/orber/doc/src/notes.xml @@ -32,6 +32,22 @@ <file>notes.xml</file> </header> + + <section><title>Orber 3.6.26</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix bug in corbaloc/corbaname over ssl.</p> + <p> + Own Id: OTP-10675</p> + </item> + </list> + </section> + + </section> + <section><title>Orber 3.6.25</title> <section><title>Improvements and New Features</title> @@ -45,7 +61,6 @@ </list> </section> - <section><title>Known Bugs and Problems</title> <list> <item> @@ -57,7 +72,6 @@ </item> </list> </section> - </section> <section><title>Orber 3.6.24</title> diff --git a/lib/orber/src/orber_env.erl b/lib/orber/src/orber_env.erl index 8758450104..67d31018ff 100644 --- a/lib/orber/src/orber_env.erl +++ b/lib/orber/src/orber_env.erl @@ -302,6 +302,7 @@ create_security_info(ssl, Info) -> "SSL IIOP accept timeout.......: ~p~n" "SSL IIOP backlog..............: ~p~n" "SSL IIOP Local Interface......: ~p~n" + "SSL server options............: ~p~n" "SSL server certfile...........: ~p~n" "SSL server verification type..: ~p~n" "SSL server verification depth.: ~p~n" @@ -310,6 +311,7 @@ create_security_info(ssl, Info) -> "SSL server password...........: ~p~n" "SSL server ciphers............: ~p~n" "SSL server cachetimeout.......: ~p~n" + "SSL client options............: ~p~n" "SSL client certfile...........: ~p~n" "SSL client verification type..: ~p~n" "SSL client verification depth.: ~p~n" @@ -323,10 +325,12 @@ create_security_info(ssl, Info) -> iiop_ssl_in_keepalive(), iiop_ssl_out_keepalive(), nat_iiop_ssl_port(), iiop_ssl_accept_timeout(), iiop_ssl_backlog(), iiop_ssl_ip_address_local(), + ssl_server_options(), ssl_server_certfile(), ssl_server_verify(), ssl_server_depth(), ssl_server_cacertfile(), ssl_server_keyfile(), ssl_server_password(), ssl_server_ciphers(), ssl_server_cachetimeout(), + ssl_client_options(), ssl_client_certfile(), ssl_client_verify(), ssl_client_depth(), ssl_client_cacertfile(), ssl_client_keyfile(), ssl_client_password(), diff --git a/lib/orber/vsn.mk b/lib/orber/vsn.mk index 10b19477e0..4e09532f88 100644 --- a/lib/orber/vsn.mk +++ b/lib/orber/vsn.mk @@ -1,3 +1,2 @@ - -ORBER_VSN = 3.6.25 +ORBER_VSN = 3.6.26 diff --git a/lib/ssh/doc/html/.gitignore b/lib/ssh/doc/html/.gitignore index e69de29bb2..72e8ffc0db 100644 --- a/lib/ssh/doc/html/.gitignore +++ b/lib/ssh/doc/html/.gitignore @@ -0,0 +1 @@ +* diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 4d29ecce7a..4f241ecc0a 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1151,7 +1151,9 @@ init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHan init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, CertFile, client) -> try - [OwnCert] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), + %% Ignoring potential proxy-certificates see: + %% http://dev.globus.org/wiki/Security/ProxyFileFormat + [OwnCert|_] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, OwnCert} catch _Error:_Reason -> {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheHandle, undefined} @@ -1159,7 +1161,7 @@ init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHan init_certificates(undefined, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, CertFile, server) -> try - [OwnCert] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), + [OwnCert|_] = ssl_certificate:file_to_certificats(CertFile, PemCacheHandle), {ok, CertDbRef, CertDbHandle, FileRefHandle, PemCacheHandle, CacheRef, OwnCert} catch _:Reason -> diff --git a/lib/stdlib/test/escript_SUITE.erl b/lib/stdlib/test/escript_SUITE.erl index b6cdd0a9c7..eebfec3336 100644 --- a/lib/stdlib/test/escript_SUITE.erl +++ b/lib/stdlib/test/escript_SUITE.erl @@ -615,7 +615,7 @@ archive_script_file_access(Config) when is_list(Config) -> %% 3. If symlinks are supported, run one of the scripts via a symlink. %% %% This is in order to test error b) described above this test case. - case file:read_link(Symlink2) of + case element(1,os:type()) =:= win32 orelse file:read_link(Symlink2) of {ok,_} -> run(PrivDir, "./" ++ SymlinkName2 ++ " " ++ ScriptName2, [<<"ExitCode:0">>]); diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl b/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl index b03c8ba70d..523621e4f3 100644 --- a/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl +++ b/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -56,7 +56,7 @@ main([RelArchiveFile]) -> %% If symlinks are supported on this platform... RelSymlinkArchiveFile = "symlink_to_" ++ RelArchiveFile, - case file:read_link(RelSymlinkArchiveFile) of + case element(1,os:type()) =:= win32 orelse file:read_link(RelSymlinkArchiveFile) of {ok,_} -> DotSlashSymlinkArchiveFile = "./" ++ RelSymlinkArchiveFile, AbsSymlinkArchiveFile=filename:join(filename:dirname(AbsArchiveFile), diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl index dfcfc3675f..c2c627abe0 100644 --- a/lib/tools/src/cover.erl +++ b/lib/tools/src/cover.erl @@ -1139,9 +1139,14 @@ remote_collect(Module,Nodes,Stop) -> do_collection(Node, Module, Stop) -> CollectorPid = spawn(fun collector_proc/0), - remote_call(Node,{remote,collect,Module,CollectorPid, self()}), - if Stop -> remote_call(Node,{remote,stop}); - true -> ok + case remote_call(Node,{remote,collect,Module,CollectorPid, self()}) of + {error,node_dead} -> + CollectorPid ! done, + ok; + ok when Stop -> + remote_call(Node,{remote,stop}); + ok -> + ok end. %% Process which receives chunks of data from remote nodes - either when diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl index 5abc5c41b1..c033be98a3 100644 --- a/lib/tools/test/cover_SUITE.erl +++ b/lib/tools/test/cover_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -27,7 +27,8 @@ dont_reconnect_after_stop/1, stop_node_after_disconnect/1, export_import/1, otp_5031/1, eif/1, otp_5305/1, otp_5418/1, otp_6115/1, otp_7095/1, - otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1]). + otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1, + otp_10979_hanging_node/1]). -include_lib("test_server/include/test_server.hrl"). @@ -52,7 +53,7 @@ all() -> dont_reconnect_after_stop, stop_node_after_disconnect, export_import, otp_5031, eif, otp_5305, otp_5418, otp_6115, otp_7095, otp_8188, otp_8270, otp_8273, - otp_8340]; + otp_8340, otp_10979_hanging_node]; _pid -> {skip, "It looks like the test server is running " @@ -1381,6 +1382,25 @@ comprehension_8188(Cf) -> ok. +otp_10979_hanging_node(_Config) -> + + P1 = processes(), + + cover:stop(non_existing_node), + cover:stop(), + + P2 = processes(), + + case P2--P1 of + [] -> + ok; + New -> + [io:format("New: ~p, ~p~n",[P,process_info(P)]) || P<-New], + ct:fail(hanging_process) + end, + + ok. + %%--Auxiliary------------------------------------------------------------ analyse_expr(Expr, Config) -> diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl index cf17818a9d..d55a037599 100644 --- a/lib/wx/test/wx_basic_SUITE.erl +++ b/lib/wx/test/wx_basic_SUITE.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -100,6 +100,7 @@ several_apps(Config) -> || N <- lists:seq(1,4)], process_flag(trap_exit,true), ?m_multi_receive([{complete,Pid} || Pid <- Pids]), + [Pid ! quit || Pid <- Pids], case wx_test_lib:user_available(Config) of true -> receive {'EXIT',_,foo} -> ok end; @@ -118,6 +119,7 @@ several_apps(Parent, N, Config) -> #wx{obj=Frame, event=#wxSize{}} -> Parent ! {complete, self()} end, + receive quit -> ok end, wx_test_lib:wx_destroy(Frame, Config), exit(foo). diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 4186d73c88..7c3eda0be1 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -140,7 +140,7 @@ treeCtrl(Config) -> ?m({true, {_,Y1,_,_}} when Y1 > Y0, wxTreeCtrl:getBoundingRect(Tree, Item2)), ?m({Item1, _}, wxTreeCtrl:hitTest(Tree, {X0+W0 div 2, Y0+H0 div 2})), ?m(true, wxTreeCtrl:isTreeItemIdOk(Item1)), - ?m({0, _}, wxTreeCtrl:hitTest(Tree, {X0+W0 div 2, Y0+H0+H0})), + ?m({0, _}, wxTreeCtrl:hitTest(Tree, {X0+W0+W0, Y0+H0+4*H0})), ?m(false, wxTreeCtrl:isTreeItemIdOk(0)), wxFrame:connect(Tree, command_tree_item_expanded), |