Testsuite: Run UIs in Qemu and check running processes and more (#982)

* Testsuite: Run UIs in Qemu and check running processes (and other changes)

* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
  it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
  built before running tests (otherwise tests would hang without any output
  while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
  plasma-mobile currently, easy to extend), runs it via Qemu and checks the
  running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
  our source tree, so we don't need to clone their git repo anymore. Now it
  is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.

* Various fixes
* Build device-packages for the device arch and don't raise an
  exception, but print a note if --ignore-depends is not specified
  and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
  check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
  completion
* Exit with 1 when showing usage in check_checksums.py
This commit is contained in:
Oliver Smith 2018-02-02 00:16:29 +00:00 committed by GitHub
parent 5eb75afc08
commit 5e85d72ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 996 additions and 60 deletions

View file

@ -18,8 +18,9 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import logging
import os
import shutil
import re
import signal
import shutil
import pmb.build
import pmb.chroot
@ -218,6 +219,11 @@ def resize_image(args, img_size_new, img_path):
raise RuntimeError("The system image size must be " + img_size_str + " or greater")
def sigterm_handler(number, frame):
raise RuntimeError("pmbootstrap was terminated by another process,"
" and killed the Qemu VM it was running.")
def run(args):
"""
Run a postmarketOS image in qemu
@ -253,13 +259,15 @@ def run(args):
logging.info("* (ssh) ssh -p {port} {user}@localhost".format(**vars(args)))
logging.info("* (telnet) telnet localhost " + str(args.port + 1))
# Run Qemu (or Qemu + SPICE)
# Run Qemu (or Qemu + SPICE) and kill it together with pmbootstrap
process = None
try:
signal.signal(signal.SIGTERM, sigterm_handler)
process = pmb.helpers.run.user(args, qemu, background=spice_enabled)
if spice:
pmb.helpers.run.user(args, spice)
except KeyboardInterrupt:
# Don't show a trace when pressing ^C
pass
finally:
if process: