aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/erl_docgen/priv/xsl/db_html.xsl69
-rw-r--r--lib/mnesia/test/mnesia_atomicity_test.erl18
-rw-r--r--lib/mnesia/test/mnesia_consistency_test.erl54
-rw-r--r--lib/mnesia/test/mnesia_evil_backup.erl2
-rw-r--r--lib/mnesia/test/mnesia_recovery_test.erl11
-rw-r--r--lib/mnesia/test/mt.erl2
-rw-r--r--lib/xmerl/src/xmerl_xpath_scan.erl7
-rw-r--r--lib/xmerl/src/xmerl_xsd.erl121
8 files changed, 196 insertions, 88 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index 75399992f2..fe6c7d3c28 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -24,11 +24,76 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
- extension-element-prefixes="exsl"
+ xmlns:func="http://exslt.org/functions"
+ xmlns:erl="http://erlang.org"
+ extension-element-prefixes="exsl func"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<xsl:include href="db_html_params.xsl"/>
+ <func:function name="erl:flip_first_char">
+ <xsl:param name="in"/>
+
+ <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+ <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
+
+ <xsl:variable name="first-char" select="substring($in, 1, 1)"/>
+
+ <xsl:variable name="result">
+ <xsl:choose>
+ <xsl:when test="contains($uppercase, $first-char)">
+ <xsl:value-of select="concat(translate($first-char, $uppercase, $lowercase), substring($in, 2))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(translate($first-char, $lowercase, $uppercase), substring($in, 2))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <func:result select="$result"/>
+ </func:function>
+
+ <!-- Used from template menu.funcs to sort a module's functions for the lefthand index list,
+ from the module's .xml file. Returns a value on which to sort the entity in question
+ (a <name> element).
+
+ Some functions are listed with the name as an attribute, as in string.xml:
+ <name name="join" arity="2"/>
+
+ Others use the element value for the name, as in gen_server.xml:
+ <name>start_link(Module, Args, Options) -> Result</name>
+
+ Additionally, callbacks may be included, as in gen_server.xml:
+ <name>Module:handle_call(Request, From, State) -> Result</name>
+
+ So first, get the name from either the attribute or the element value.
+ Then, reverse the case of the first character. This is because xsltproc, used for processing,
+ orders uppercase before lowercase (even when the 'case-order="lower-first"' option
+ is given). But we want the Module callback functions listed after a module's regular
+ functions, as they are now. This doesn't affect the actual value used in the output, but
+ just the value used as a sort key. To then ensure that uppercase is indeed sorted before
+ lower, as we now want it to be, the 'case-order="upper-first"' option is used.
+
+ This processing only affect the lefthand index list- the body of the doc page is not
+ affected.
+ -->
+ <func:function name="erl:get_sort_field">
+ <xsl:param name="elem"/>
+
+ <xsl:variable name="base">
+ <xsl:choose>
+ <xsl:when test="string-length($elem/@name) > 0">
+ <xsl:value-of select="$elem/@name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$elem"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <func:result select="erl:flip_first_char($base)"/>
+ </func:function>
+
<!-- Start of Dialyzer type/spec tags.
See also the templates matching "name" and "seealso" as well as
the template "menu.funcs"
@@ -1486,6 +1551,8 @@
<xsl:param name="cval"/>
<xsl:for-each select="$entries">
+ <!-- Sort on function name, so the index list in lefthand frame is ordered. -->
+ <xsl:sort select="erl:get_sort_field(.)" data-type="text" case-order="upper-first"/>
<xsl:choose>
<xsl:when test="ancestor::cref">
diff --git a/lib/mnesia/test/mnesia_atomicity_test.erl b/lib/mnesia/test/mnesia_atomicity_test.erl
index 612c4ad368..cc32ba3826 100644
--- a/lib/mnesia/test/mnesia_atomicity_test.erl
+++ b/lib/mnesia/test/mnesia_atomicity_test.erl
@@ -700,11 +700,19 @@ start_restart_check(RestartOp, ReplicaNeed, Config) ->
%% mnesia shall be killed at that node, where A is reading
%% the information from
- kill_where_to_read(TabName, N1, [N2, N3]),
+ Read = kill_where_to_read(TabName, N1, [N2, N3]),
%% wait some time to let mnesia go down and spread those news around
%% fun A shall be able to finish its job before being restarted
- wait(500),
+ Wait = fun(Loop) ->
+ wait(300),
+ sys:get_status(mnesia_monitor),
+ case lists:member(Read, mnesia_lib:val({current, db_nodes})) of
+ true -> Loop(Loop);
+ false -> ok
+ end
+ end,
+ Wait(Wait),
A ! go_ahead,
%% the sticky write doesnt work on remote nodes !!!
@@ -772,10 +780,12 @@ kill_where_to_read(TabName, N1, Nodes) ->
Read = rpc:call(N1,mnesia,table_info, [TabName, where_to_read]),
case lists:member(Read, Nodes) of
true ->
- mnesia_test_lib:kill_mnesia([Read]);
+ mnesia_test_lib:kill_mnesia([Read]),
+ Read;
false ->
?error("Fault while killing Mnesia: ~p~n", [Read]),
- mnesia_test_lib:kill_mnesia(Nodes)
+ mnesia_test_lib:kill_mnesia(Nodes),
+ Read
end.
sync_tid_release() ->
diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl
index 9cc84de87b..2fe1bd34e6 100644
--- a/lib/mnesia/test/mnesia_consistency_test.erl
+++ b/lib/mnesia/test/mnesia_consistency_test.erl
@@ -665,10 +665,10 @@ consistency_after_restore(ReplicaType, Op, Config) ->
[lists:foreach(fun(E) -> ok = mnesia:dirty_write({Tab, E, 2}) end, NList) ||
Tab <- Tabs],
- Pids1 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carA, Op]), ok} || _ <- lists:seq(1, 5)],
- Pids2 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carB, Op]), ok} || _ <- lists:seq(1, 5)],
- Pids3 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carC, Op]), ok} || _ <- lists:seq(1, 5)],
- Pids4 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carD, Op]), ok} || _ <- lists:seq(1, 5)],
+ Pids1 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carA, Op]), carA} || _ <- lists:seq(1, 5)],
+ Pids2 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carB, Op]), carB} || _ <- lists:seq(1, 5)],
+ Pids3 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carC, Op]), carC} || _ <- lists:seq(1, 5)],
+ Pids4 = [{'EXIT', spawn_link(?MODULE, change_tab, [self(), carD, Op]), carD} || _ <- lists:seq(1, 5)],
AllPids = Pids1 ++ Pids2 ++ Pids3 ++ Pids4,
@@ -678,19 +678,38 @@ consistency_after_restore(ReplicaType, Op, Config) ->
Else -> Else
end
end,
-
+
timer:sleep(timer:seconds(Delay)), %% Let changers grab locks
?verbose("Doing restore~n", []),
?match(Tabs, Restore(File, [{default_op, Op}])),
- timer:sleep(timer:seconds(Delay)), %% Let em die
+ Collect = fun(Msg, Acc) ->
+ receive Msg -> Acc
+ after 10000 -> [Msg|Acc]
+ end
+ end,
- ?match_multi_receive(AllPids),
+ Failed1 = lists:foldl(Collect, [], AllPids),
+ Failed = lists:foldl(Collect, [], Failed1),
+
+ case Failed of
+ [] -> ok;
+ _ ->
+ ?match([], Failed),
+ io:format("TIME: ~p sec~n", [erlang:system_time(seconds) band 16#FF]),
+ Dbg = fun({_, Pid, Tab}) ->
+ io:format("Tab ~p: ~p~n",[Tab, process_info(Pid, current_stacktrace)]),
+ [io:format(" ~p~n", [Rec]) || Rec <- mnesia:dirty_match_object({Tab, '_', '_'})]
+ end,
+ [Dbg(Msg) || Msg <- Failed],
+ io:format(" Held: ~p~n", [mnesia_locker:get_held_locks()]),
+ io:format("Queue: ~p~n", [mnesia_locker:get_lock_queue()])
+ end,
- case ?match(ok, restore_verify_tabs(Tabs)) of
- {success, ok} ->
+ case ?match(ok, restore_verify_tabs(Tabs)) of
+ {success, ok} ->
file:delete(File);
- _ ->
+ _ ->
{T, M, S} = time(),
File2 = ?flat_format("consistency_error~w~w~w.BUP", [T, M, S]),
file:rename(File, File2)
@@ -700,17 +719,20 @@ consistency_after_restore(ReplicaType, Op, Config) ->
change_tab(Father, Tab, Test) ->
Key = rand:uniform(20),
Update = fun() ->
+ Time = erlang:system_time(seconds) band 16#FF,
+ case put(time, Time) of
+ Time -> ok;
+ _ -> io:format("~p ~p ~p sec~n", [self(), Tab, Time])
+ end,
case mnesia:read({Tab, Key}) of
- [{Tab, Key, 1}] ->
- quit;
- [{Tab, Key, _N}] ->
- mnesia:write({Tab, Key, 3})
+ [{Tab, Key, 1}] -> quit;
+ [{Tab, Key, _N}] -> mnesia:write({Tab, Key, 3})
end
end,
case mnesia:transaction(Update) of
{atomic, quit} ->
- exit(ok);
- {aborted, {no_exists, Tab}} when Test == recreate_tables ->%% I'll allow this
+ exit(Tab);
+ {aborted, {no_exists, Tab}} when Test == recreate_tables -> %% I'll allow this
change_tab(Father, Tab, Test);
{atomic, ok} ->
change_tab(Father, Tab, Test)
diff --git a/lib/mnesia/test/mnesia_evil_backup.erl b/lib/mnesia/test/mnesia_evil_backup.erl
index b71348f144..e745ec9b04 100644
--- a/lib/mnesia/test/mnesia_evil_backup.erl
+++ b/lib/mnesia/test/mnesia_evil_backup.erl
@@ -325,7 +325,7 @@ restore(Config, Op) ->
end,
?match(ok, file:delete(File1)),
?match(ok, file:delete(File2)),
- ?match([], Check() -- Before),
+ ?match([], Check() -- (Before ++ [{ok, latest_log}, {ok, previous_log}])),
?verify_mnesia(Nodes, []).
diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl
index 2388b595d0..130b87346f 100644
--- a/lib/mnesia/test/mnesia_recovery_test.erl
+++ b/lib/mnesia/test/mnesia_recovery_test.erl
@@ -504,12 +504,21 @@ with_checkpoint(Config, Type) when is_list(Config) ->
?match(ok, mnesia:deactivate_checkpoint(sune)),
?match([], check_chkp(Nodes)),
+ Wait = fun(Loop) ->
+ timer:sleep(300),
+ sys:get_status(mnesia_monitor),
+ case lists:member(Kill, mnesia_lib:val({current, db_nodes})) of
+ true -> Loop(Loop);
+ false -> ok
+ end
+ end,
+
case Kill of
Node1 ->
ignore;
Node2 ->
mnesia_test_lib:kill_mnesia([Kill]),
- timer:sleep(500), %% Just to help debugging
+ Wait(Wait),
?match({ok, sune, _}, mnesia:activate_checkpoint([{name, sune},
{max, mnesia:system_info(tables)},
{ram_overrides_dump, true}])),
diff --git a/lib/mnesia/test/mt.erl b/lib/mnesia/test/mt.erl
index 793fb125e6..5a981bf539 100644
--- a/lib/mnesia/test/mt.erl
+++ b/lib/mnesia/test/mt.erl
@@ -80,6 +80,8 @@ resolve(Suite0) when is_atom(Suite0) ->
{Suite, Case} ->
{Suite, is_group(Suite,Case)}
end;
+resolve({Suite0, {group, Case}}) ->
+ resolve({Suite0, Case});
resolve({Suite0, Case}) when is_atom(Suite0), is_atom(Case) ->
case alias(Suite0) of
Suite when is_atom(Suite) ->
diff --git a/lib/xmerl/src/xmerl_xpath_scan.erl b/lib/xmerl/src/xmerl_xpath_scan.erl
index 5ef5dce737..9032a01eca 100644
--- a/lib/xmerl/src/xmerl_xpath_scan.erl
+++ b/lib/xmerl/src/xmerl_xpath_scan.erl
@@ -286,13 +286,13 @@ strip_ws(T) ->
T.
-special_token('@') -> true;
+%% special_token('@') -> true;
special_token('::') -> true;
special_token(',') -> true;
special_token('(') -> true;
special_token('[') -> true;
special_token('/') -> true;
-special_token('//') -> true;
+%% special_token('//') -> true;
special_token('|') -> true;
special_token('+') -> true;
special_token('-') -> true;
@@ -306,5 +306,4 @@ special_token('and') -> true;
special_token('or') -> true;
special_token('mod') -> true;
special_token('div') -> true;
-special_token(_) ->
- false.
+special_token(_) -> false.
diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl
index d97913ecbc..4b5efae8dd 100644
--- a/lib/xmerl/src/xmerl_xsd.erl
+++ b/lib/xmerl/src/xmerl_xsd.erl
@@ -548,7 +548,7 @@ element_content({attribute,S=#xsd_state{scope=Scope}},Att,Env) ->
{AttRef,add_ref(S,AttRef)};
Name ->
{AttrType,S2} = attribute_type(Att,[Name|Env],S),
- S3 = check_cm(attribute,allowed_content(attribute,Env),AttrType,S2),
+ S3 = check_cm(attribute,allowed_content(attribute,Env),AttrType,S2),
{Attr,S4} = attribute_properties(Att#xmlElement.attributes,
#schema_attribute{type=AttrType},S3),
Object = {attribute,
@@ -566,7 +566,7 @@ element_content({element,S},El,Env) ->
%% 3.3.3 bullet 2.2
S3 = element_forbidden_properties(El,S2),
S4 = element_forbidden_content(El#xmlElement.content,S3),
- ElRef =
+ ElRef =
{element,
{get_QName(Ref,El#xmlElement.namespace,reset_scope(S)),
Occ}},
@@ -811,7 +811,6 @@ element_content({restriction,S},R,Env) ->
%% base (resolved by base_type/1) or the type defined in content.
{CM,S2} = type(R#xmlElement.content,S,[restriction|Env]),
S3 = check_cm(restriction,allowed_content(restriction,Env),CM,S2),
-
{BaseTypeName,CM2,S4} = restriction_base_type(R,CM,S3), %% a QName
%% S5 = add_circularity_mark(BaseTypeName,S4),
BaseTypeType = base_type_type(Env),
@@ -1733,20 +1732,20 @@ allowed_content(SorC,_Parents) when SorC==sequence;SorC==choice ->
{choice,{1,1}},{sequence,{1,1}},
{any,{1,1}}],
occurance={0,unbounded}}]};
-allowed_content(E,_Parents)
- when E==any;E==selector;E==field;E==notation;E==include;E==import;
- E==anyAttribute ->
- {annotation,{0,1}};
-allowed_content(UKK,_Parents) when UKK==unique;UKK==key;UKK==keyref->
- #chain{content=
- [{annotation,{0,1}},
- #chain{content=
- [{selector,{1,1}},{selector,{1,unbounded}}]}]};
-allowed_content(annotation,_Parents) ->
- #alternative{content=[{appinfo,{1,1}},{documentation,{1,1}}],
- occurance={0,unbounded}};
-allowed_content(E,_Parents) when E==appinfo;E==documentation ->
- {any,{0,unbounded}};
+%% allowed_content(E,_Parents)
+%% when E==any;E==selector;E==field;E==notation;E==include;E==import;
+%% E==anyAttribute ->
+%% {annotation,{0,1}};
+%% allowed_content(UKK,_Parents) when UKK==unique;UKK==key;UKK==keyref->
+%% #chain{content=
+%% [{annotation,{0,1}},
+%% #chain{content=
+%% [{selector,{1,1}},{selector,{1,unbounded}}]}]};
+%% allowed_content(annotation,_Parents) ->
+%% #alternative{content=[{appinfo,{1,1}},{documentation,{1,1}}],
+%% occurance={0,unbounded}};
+%% allowed_content(E,_Parents) when E==appinfo;E==documentation ->
+%% {any,{0,unbounded}};
allowed_content(simpleType,_Parents) ->
#chain{content=
[{annotation,{0,1}},
@@ -1766,22 +1765,22 @@ allowed_content(restriction,Parents) ->
end;
allowed_content(LU,_Parent) when LU==list;LU==union ->
#chain{content=[{annotation,{0,1}},{simpleType,{0,1}}]};
-allowed_content(schema,_) ->
- #chain{content=
- [#alternative{content=
- [{include,{1,1}},{import,{1,1}},
- {redefine,{1,1}},{annotation,{1,1}}],
- occurance={0,1}},
- #chain{content=
- [#alternative{content=
- [#alternative{content=
- [{simpleType,{1,1}},{complexType,{1,1}},
- {group,{1,1}},{attributeGroup,{1,1}}]},
- {element,{1,1}},
- {attribute,{1,1}},
- {notation,{1,1}}]},
- {annotation,{0,unbounded}}],
- occurance={0,unbounded}}]};
+%% allowed_content(schema,_) ->
+%% #chain{content=
+%% [#alternative{content=
+%% [{include,{1,1}},{import,{1,1}},
+%% {redefine,{1,1}},{annotation,{1,1}}],
+%% occurance={0,1}},
+%% #chain{content=
+%% [#alternative{content=
+%% [#alternative{content=
+%% [{simpleType,{1,1}},{complexType,{1,1}},
+%% {group,{1,1}},{attributeGroup,{1,1}}]},
+%% {element,{1,1}},
+%% {attribute,{1,1}},
+%% {notation,{1,1}}]},
+%% {annotation,{0,unbounded}}],
+%% occurance={0,unbounded}}]};
allowed_content(redefine,_Parents) ->
#alternative{content=
[{annotation,{1,1}},
@@ -1801,31 +1800,31 @@ allowed_content(extension,Parents) ->
allowed_content2(extension,simpleContent);
_ ->
allowed_content2(extension,complexContent)
- end;
-allowed_content(minExclusive,_Parents) ->
- [];
-allowed_content(minInclusive,_Parents) ->
- [];
-allowed_content(maxExclusive,_Parents) ->
- [];
-allowed_content(maxInclusive,_Parents) ->
- [];
-allowed_content(totalDigits,_Parents) ->
- [];
-allowed_content(fractionDigits,_Parents) ->
- [];
-allowed_content(length,_Parents) ->
- [];
-allowed_content(minLength,_Parents) ->
- [];
-allowed_content(maxLength,_Parents) ->
- [];
-allowed_content(enumeration,_Parents) ->
- [];
-allowed_content(whiteSpace,_Parents) ->
- [];
-allowed_content(pattern,_Parents) ->
- [].
+ end.
+%% allowed_content(minExclusive,_Parents) ->
+%% [];
+%% allowed_content(minInclusive,_Parents) ->
+%% [];
+%% allowed_content(maxExclusive,_Parents) ->
+%% [];
+%% allowed_content(maxInclusive,_Parents) ->
+%% [];
+%% allowed_content(totalDigits,_Parents) ->
+%% [];
+%% allowed_content(fractionDigits,_Parents) ->
+%% [];
+%% allowed_content(length,_Parents) ->
+%% [];
+%% allowed_content(minLength,_Parents) ->
+%% [];
+%% allowed_content(maxLength,_Parents) ->
+%% [];
+%% allowed_content(enumeration,_Parents) ->
+%% [];
+%% allowed_content(whiteSpace,_Parents) ->
+%% [];
+%% allowed_content(pattern,_Parents) ->
+%% [].
@@ -1903,9 +1902,9 @@ set_occurance(Ch = #chain{},Occ) ->
set_occurance(Alt = #alternative{},Occ) ->
Alt#alternative{occurance=Occ};
set_occurance({Name,_},Occ) when is_atom(Name) ->
- {Name,Occ};
-set_occurance(CM,_) ->
- CM.
+ {Name,Occ}.
+%% set_occurance(CM,_) ->
+%% CM.
process_external_schema_once(E,Namespace,S) when is_record(E,xmlElement) ->