mnesia: Improve tests

Need to re-raise the match macro if inside transaction
mnesia: Fix timing issue

Be sure to gather release_tid msgs even though we have a mnesia_down
in the queue.
mnesia: Handle failed net_loads better

In case of a failed net load and no more available copies,
remove the table from late_load_queue, otherwise tables
can not be forced loaded.
hipe,compiler: Fix Map literals pretty printing
dialyzer: Add Maps type mismatch test
Support maps in cerl:ann_make_tree/3
Comment fix
Add check that request table is empty to failover suite

The way in which this suite causes transport connections to be broken -
by stopping the service - makes it prone to orphaning entries in the
request table, which is a bug we're about to fix.
Fix leaking request table

A new connection writes the pid to the table diameter_request. The
normal handling is that loss of a connection leads to a watchdog state
change in the service process, which removes the entry, but this usually
won't happen in the case of diameter:stop_service/1 since the service
process is terminated without waiting for watchdog transitions.

The request table should really be service-specific, so that the table
is deleted when the service is stopped, which requires passing the table
identifier into request processes and handling that the table may not
exist. Just clear out the service-specific entries at service process
termination for now.
Fix watchdog table leak

Commit ef5fddcb (diameter-1.4.1, R16B) caused the leak in the case of an
accepting watchdog with restrict_connections = false. It (correctly)
ensured the state remained at INITIAL but a subsequent 'close' message
to terminate the process was ignored since the state was not DOWN. In
fact, no 'close' was sent since there was no state transition or
previous connection: the former triggers the message from
diameter_service, the latter from diameter_watchdog. The message is now
sent to self() from the watchdog itself.

Send 'close' in the same way when multiple connections to the same peer
are allowed, to avoid waiting for a watchdog timer expiry for the
process to terminate in this case.
Simplify sending of 'close' to watchdog

There's no need to send the message immediately if there's no transport
configuration since that in itself means the service process will tell
the watchdogs to die.
Count result codes in CEA/DWA/DPA

Corresponding counters for other answer messages have been counted
previously, but those for CEA, DWA, and DPA have been missing since
diameter itself sends these messages and the implementation is as bit
more separate than it might be. The counters are keyed on values of the
following form.

  {{ApplicationId, CommandCode, 0 = Rbit}, send|recv, {'Result-Code', RC}}
Count decode errors independently of result codes

Since the former doesn't exclude the latter.

Counter values are returned by diameter:service_info/2. They can
currently only be retrieved for a service, not for individual transports
or peer connections.
Count decode errors in incoming requests

Errors were only counted in incoming answers. Counters are keyed on
tuples of the same form:

  {{ApplicationId, CommandCode, Rbit}, recv, error}
hipe: fix a bug concerning typed record fields
Count encode errors in outgoing messages

Only decode errors were counted previously. Keys are of the form
{Id, send, error}, where Id is:

  {ApplicationId, CommandCode, Rbit} | unknown

The latter will be the case if not even a #diameter_header{} can be
constructed.
Ensure watchdog dies with transport if DPA was sent

A DPR/DPA exchange should always cause the watchdog process in question
to die with the transport, so that a subsequent connection with the same
peer doesn't result in a 3 x DWR/DWA exchange. Commit 5903d6db saw to
this for the sending of DPR but neglected the corresponding problem for
DPA.

In the case of sending DPR (the aforementioned commit), note that
there's no distinction between receiving DPA as expected and not: the
watchdog dies with the transport regardless.

diameter_watchdog must be loaded first at upgrade.
Run examples suite over both TCP and SCTP

This was supposed to already be the case (in what passes for my memory),
and detects that commit ed6395a6 is horrifically broken: diameter is
unable to send CEA over SCTP.
Anchor path regexps in examples suite

They match emacs backup files and more without the anchor, although this
doesn't stop the matches from finding files the suite isn't (yet)
intended to test: files under development, not yet commited, etc.
Fix diameter_sctp function_clause

Introduced in commit ed6395a6. The {stream, Id} transport_data set upon
reception is passed back to us by default when receiving the answer to a
request message, so even capabilities exchange failed.