2016-11-14 20:07:43 +03:00
#!/bin/bash
set -euo pipefail
2016-11-22 06:22:51 +03:00
if test -z " ${ INSIDE_VM :- } " ; then
2016-11-14 20:07:43 +03:00
2016-11-22 06:22:51 +03:00
# do this in the host
. ${ commondir } /libvm.sh
vm_setup
if ! vm_ssh_wait 30; then
echo "ERROR: A running VM is required for 'make vmcheck'."
exit 1
fi
vm_rsync
2017-07-27 17:16:23 +03:00
vm_cmd env INSIDE_VM = 1 /var/roothome/sync/tests/vmcheck/sync.sh
2016-11-22 06:22:51 +03:00
exit 0
2017-09-01 20:33:36 +03:00
fi
2016-11-22 06:22:51 +03:00
2017-09-01 20:33:36 +03:00
set -x
2017-08-03 16:41:18 +03:00
2017-09-01 20:33:36 +03:00
# And then this code path in the VM
2017-08-03 16:41:18 +03:00
2017-09-01 20:33:36 +03:00
ostree admin unlock || :
# Now, overlay our built binaries & config files
INSTTREE = /var/roothome/sync/insttree
Rework vmcheck to use `kola spawn`, move off of PAPR
There's a lot going on here, but essentially:
1. We change the `vmcheck` model so that it always operates on an
immutable base image. It takes that image and dynamically launches a
separate VM for each test using `kola spawn`. This means we can drop
a lot of hacks around re-using the same VMs.
2. Following from 1., `vmoverlay` now takes as input a base image,
overlays the built rpm-ostree bits, then creates a new base image. Of
course, we don't have to do this in CI, because we build FCOS with
the freshly built RPMs (so it uses `SKIP_VMOVERLAY=1`). `vmoverlay`
then will be more for the developer case where one doesn't want to
iterate via `cosa build` to test rpm-ostree changes. I say "will"
because the functionality doesn't exist yet; I'd like to enhance
`cosa dev-overlay` to do this. (Note `vmsync` should still works just
as before too.)
3. `vmcheck` can be run without building the tree first, as
`tests/vmcheck.sh`. The `make vmcheck` target still exists though for
finger compatibility and better meshing with `vmoverlay` in the
developer case.
What's really nice about using kola spawn is that it takes care of a lot
of things for us, such as the qemu command, journal and console
gathering, and SSH.
Similarly to the compose testsuites, we're using parallel here to run
multiple vmcheck tests at once. (On developer laptops, we cap
parallelism at `$(nproc) - 1`).
2019-12-13 20:23:41 +03:00
rsync -rlv $INSTTREE / /
2017-09-01 20:33:36 +03:00
restorecon -v /usr/bin/{ rpm-,} ostree /usr/libexec/rpm-ostreed
2017-10-12 17:07:45 +03:00
overrides_dir = /etc/systemd/system/rpm-ostreed.service.d
mkdir -p $overrides_dir
2017-09-01 20:33:36 +03:00
# For our test suite at least, to catch things like
# https://github.com/projectatomic/rpm-ostree/issues/826
2017-10-12 17:07:45 +03:00
cat > $overrides_dir /fatal-warnings.conf << EOF
2017-06-09 23:16:51 +03:00
[ Service]
Environment = G_DEBUG = fatal-warnings
EOF
2017-09-01 20:33:36 +03:00
2017-10-12 17:07:45 +03:00
# In the developer workflow, it's just not helpful to
# have the daemon auto-exit. But let's keep it as a separate
# override file to make it easy to drop if needed.
cat > $overrides_dir /no-idle-exit.conf << EOF
[ Service]
Environment = RPMOSTREE_DEBUG_DISABLE_DAEMON_IDLE_EXIT = 1
EOF
2017-09-01 20:33:36 +03:00
systemctl daemon-reload
systemctl restart rpm-ostreed