vmtest: ensure we collect /var/log/journal only once
Appending the journal script to the collect_scripts parameter
modified a share class variable which resulted in more than
one call to the script to collect the journal. The script itself
was not defensive about repeated calls and would copy the
journal dir more than once which resulted in filling the capacity
of the output disk.
These two changes ensure we run it once and if it's added repeatedly
it won't attempt to copy /var/log/journal to the output disk more
than once.
Don't allow reads of /proc and modprobe zfs through
New zfs_supported check reads /proc/filesystems to see if
zfs is already available and attempts to modprobe. These things
fail under launchpad sbuilds. Make sure to mock out the calls to
these functions and provide positive values for the failing unittest.
vmtest: enable persistent journal and collect at boot time
Target OSes which use systemd-journald may or maynot enable a
persistent journal on the root filesystem. If the target release
supports journald, issue the commands to create a persistent
journal. During the boot phase, issue commands to flush the
journal and collect (and compress) the journal as the last
script before tar'ing the collect data.
Rename vmtest_pollinate.yaml to vmtest_defaults.yaml. This
file is included in all vmtest runs.
This adds some decorators and functions to easily time function call.
It was originally done to get an idea on how much time we spend waiting
for udevadm settle, but the code is generally useful.
Note that the 'cmd_install' timer unfortunately doesn't make it
into the saved-off log as the message is appended after it is copied.
parse_dpkg_version: support non-numeric in version string.
This fixes parse_dpkg_version for packages with non-numeric (0-9.)
in their versions. It also improves it to work for native packages.
Native packages do not have '-'. Also adds tests of parse_dpkg_version.