Reload HA configuration when policy is changed.

After policy is changed make sure that HA configuration is reloaded.
This is needed by the cf-serverd as we don't want to restart it all
the time HA configuration is changed.
Audit getaddrinfo() uses for proper freeing, redmine #6539.
redmine6531: Fix some strings of 9s to be of sensible lengths.

We got weirdness on Solaris and Aches because integers were rejected
as invalid if they happened to exceed 1410065407 (0x540be3ff),
a.k.a. on(2014,8,6,6,50,7); which just happens to be an imminent date
we tried to use.  (Yes, imminent; month and day are zero-based, not
quite what one might have expected.)  We discovered this was the upper
bound for signed integers, 9999999999 (ten 9s), wrapped into a 32-bit
int's range.  The lower bound was eleven 9s, negated; and the range
for unsigned ints was from zero to this eleven 9s value, so we even
had inconsistency between the upper bound of signed int and the
matching bound for unsigned.  Head.  Desk.

At the same time, CF_HIGHINIT and CF_LOWINIT (were undocumented and)
had likewise different numbers of 9s to them.  This made no sense
either.  So I've amended the sequences of 9s so that: corresponding
bounds actually match; and the values that result are faithfully
represented as 32-bit int values.  I've also added relevant comments.
The use of strings of 9s as bounds remains eccentric, but at least
it's not brokenly so.
Truncate over-long strings of 9s.

We use long strings of 9s as bounding values for integers.  On 32-bit
values, if those long strings exceed 999999999 the resulting int wraps
and is smaller, so don't use more than nine 9s in a row.

In contrib/cfengine.el, avoid repetition of these strings of 9s by
defining two new constants for the ranges that involve them.
Quote a value abused as a function in cfengine-mode's elisp.

M-x byte-compile-file (to check my 9s-fix was sound) revealed a use of
a string literal as a function, which it seemed likely was meant to be
a quoted value, so I did that.  There remain three unbound variable
reference grumbles from compilation, but I can't immediately see what
to do about them.
Ignore compiled emacs lisp files in contrib/.
Use a define consistently for all waiting for stop/exit.
Increase range of allowed integers to the full 32-bit range.

Narrowing to 999999999 made the range too small for time_t values
(e.g. the return from on(), which is what started all of this anyway)
that represent roughly the present time.  So expand the range as far
as we sensibly can, to the max ranges for signed 32-bit integers
(values are stored in int variables, even the CF_VALRANGE ones that
clearly think they're unsigned).
Follow-up revision of promise_knowledge.cf

Match the new ranges for integer values.
Get rid of spaces between arguments on test help screen.

It makes it easier to read, since the number of options is getting
quite big.
Merge pull request #1931 from ediosyncratic/bounds-sanity-fix

Bounds sanity fix
Merge pull request #1926 from pasinskim/ha

Reload HA configuration when policy is changed.
Notice and act on changes to call-collect reporting interval.

When we CheckFileChanges() we may pick up a change of policy that
changes this reporting interval; be sure to act on any such change.
Implement parallel acceptance testing.

The implementation is based on generating a custom Makefile from
within testall, and then invoking a sub make command to execute the
tests in parallel. Since not all tests can run in parallel for various
reasons, tests that reside in a /serial/ or /unsafe/ directory will be
carried out serially.

Care has also been taken to ensure that timed tests will not hog the
make job slots, but unfortunately it has to occupy at least one slot,
which means that if your make -j flag contains exactly the number of
cores you have, one core will be mostly idle as long as any timed
tests are running. The recommended workaround is to raise the number
of jobs a bit above your core count (which is recommended practice
regardless).

The way the makefile is constructed is so that each parallel test has
its own rule, all the timed and serial tests each have one group rule,
and the serial rule is made to depend on all the other rules, so that
it runs last, and in isolation.

Note that for the sub make invokation to communicate with the job
server correctly, the testall script has to be run with a '+' prefix
from within the Makefile, hence it was removed from the TESTS variable
and executed manually instead.

testall was also changed so that it supports carrying out tests while
only writing to the workdir. This is necessary so that each invokation
will not overwrite each other's logs.

The parallel test harness of automake was considered (see
http://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness)
as an alternative, but was disqualified for a number of reasons. The
two main obstacles were:

- The list of tests has to be generated in configure, and cannot be
  easily regenerated on every run, which means that if you add a test
  it will not be picked up unless you reconfigure the project.

- Timed tests would be problematic because they have to run together
  in order to be efficient. If they don't, each test will wait its
  entire wait period before allowing the next test to run. Automake
  however, requires each test to be executed by a separate rule.
Carve up cf-serverd's StartServer() for readability.

The function had grown to over 200 lines; time for some housekeeping.
Broke out assorted chunks of it into local static functions, each
adequately self-contained, with names to make clear what's happening.
Make clean-up of lock-specific policy unconditional.

There's a policy used solely as framework for the promise whose lock
ensures we don't have two of cf-serverd running at the same time.
This is entirely disconnected from the policy potentially used by
threads, so there's no need to protect its destruction from happening
while there are threads running; it can be deleted as soon as its lock
is released.
Merge pull request #1929 from jimis/getaddrinfo_audit-redmine6539

Audit getaddrinfo() uses for proper freeing, redmine #6539.
Merge pull request #1920 from kacfengine/parallel_testall

Implement parallel acceptance testing.
Casting necessary for the case size_t is smaller than int.
Casting is not needed, but is good practice

Always cast negative values in unsigned types since in some cases bugs
might be hidden. See:

https://www.securecoding.cert.org/confluence/display/seccode/INT18-C.+Evaluate+integer+expressions+in+a+larger+size+before+comparing+or+assigning+to+that+size#INT18-C.Evaluateintegerexpressionsinalargersizebeforecomparingorassigningtothatsize-NoncompliantCodeExample%28size_t%29