For some reason that I was unable to determine, trying to cover
the case failure to fork during the second fork causes an error
when running the testsuite with coverage, such as:
$ ./coverage.sh -j16 --enable-color tests/LC28-010__daemon_utest
We get a crash during the execution of the at_exit handling when
the coverage framework tries to create a file in the root ("/")
directory, presumably to save the coverage information. I couldn't
figure out why this was happening, nor could I find a fix. Since
the code we're trying is not expected to change much over time,
and the second fork error handling is only about damage control,
I gave up on the idea. Instead, I commented out the corresponding
testing code, so as for it to be available should we try to solve
that mystery again, and I added a "pragma nocover" in run_in_daemon.
This had the side-effect of dropping one call to syslog that was
contributing to full coverage. This commit simply extends the unit
test to include a call to that function as well.
TN: U627-007
Change-Id: Iaacfd174747ff43a921f5d17e3a74900ad96a78e
This commit makes sure that the stdout and stderr output has been
flushed so that no output is left buffered by the time we call os.fork.
Otherwise, if there was any output still buffered, we would be getting
the same output printed multiple times, once by the parent process,
and once by each child process.
Found while working on the transition to Python 3.x (U530-006).
TN: U619-004
Change-Id: I9c38bfc410041e58de2a8f5d7d340f7bff599df4
This commit changes a couple of exception handlers to avoid using
a syntax which is no longer valid in Python 2.x, using a syntax
which is valid in both Python 2.x and Python 3.x insteadl.
This is good preparation for the transition to Python 3.x, and
this also makes sure the current version of this module now passes
AdaCore's internal style checker.
Change-Id: I80bd4ab61eb7bc3caa23a900cbdce66748f670b6
In preparation for the transition to Python 3, convert to using the
print function. The special import
from __future__ import print_function
in Python 2.7 makes "print" become the function and not the statement.
In Python 3, it has no effect. Once the transition is done and we
exclusively use Python 3, we can simply remove the imports.
The testsuite shows no regressions.
This allows the main script to return without having to wait
for all emails to be sent, especially since there is a delay
of several seconds being introduced between each email being
sent.
For LC28-010.