support/testing: simplify logging by keeping the log file open
authorLuca Ceresoli <luca@lucaceresoli.net>
Wed, 10 May 2017 21:33:46 +0000 (23:33 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 17 May 2017 19:59:58 +0000 (21:59 +0200)
commitd332f2c52192144d6205b68a1a2888eb63e9efb1
treec060f16a1d7aa15db1bd013a4c50083a55d976f2
parentfa3c5cad44b245833612705a88101f3737d02b38
support/testing: simplify logging by keeping the log file open

We currently call infra.smart_open() to open log files each time we
need to write to them.

Opening the file once in the constructor of Builder and Emulator and
writing to it whenever needed is simpler and slightly more efficient.

Remove smart_open and instead create a new open_log_file() function
which just opens the logfile. Also let it compute the filename, in
order to simplify even further the Builder and Emulator code.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/testing/infra/__init__.py
support/testing/infra/builder.py
support/testing/infra/emulator.py