coreos/bootengine — pull request #4 by philips (2013-07-20 08:29:02+00:00)
Title: Add tests

refactor the pre-mount-gptprio code into individual functions and then
add tests for a missing kernel, a bad kexec, a bad root mount and a
normal successful kexec -e. The tests aren't perfect but it adds some
confidence.

Tested manually with a broken kexec:

```
[ 1.162512] dracut: bootengine: mount on /dev/disk/by-partuuid/7130c94a-213a-4e5a-8e26-6cce9662f132 returned 0
[ 1.165585] dracut: bootengine: kexec -l returned 127
[ 1.166515] dracut: //lib/dracut/hooks/pre-mount/80-pre-mount-gptprio.sh: 83: kexec: not found
[ 1.168043] dracut: bootengine: kexec -e returned 127
[ 1.168947] dracut: //lib/dracut/hooks/pre-mount/80-pre-mount-gptprio.sh: 83: kexec: not found
[ 1.170444] dracut: ERROR: bootengine: kexec -e shouldn't return!
[ 1.171483] dracut: cmd_line was root=gptprio: console=tty0 console=ttyS0
[ 1.172620] dracut: root_upper was 7130C94A-213A-4E5A-8E26-6CCE9662F132
[ 1.173728] dracut: bootengine: No kernel found or kexec failed, proceeding with root=block:/dev/disk/by-partuuid/7130c94a-213a-4e5a-8e26-6cce9662f132
[ 1.186630] dracut: Mounted root filesystem /dev/sda3
[ 1.197188] dracut: Switching root
switch_root: failed to unlink tmp: Directory not empty
[ 1.217423] systemd[1]: systemd 204 running in system mode. (+PAM -LIBWRAP -AUDIT -SELINUX +IMA -SYSVINIT -LIBCRYPTSETUP -GCRYPT -ACL -XZ)
[ 1.219507] systemd[1]: Detected virtualization 'kvm'.

Welcome to CoreOS Linux!

[ 1.221343] systemd[1]: No hostname configured.
```