Makefile-tests: add toplevel vm* targets
The `make vmshell` target makes it even easier to immediately try out your changes in a live running Atomic Host. It will automatically provision the VM, sync your latest changes, build, install in a new deployment onto which the VM is rebooted, and drop you in the shell. Closes: #321 Approved by: cgwalters
This commit is contained in:
parent
be3a677125
commit
816194cd58
@ -69,6 +69,19 @@ check-local:
|
||||
@echo " *** NOTE ***"
|
||||
@echo " *** NOTE ***"
|
||||
|
||||
vmbuild:
|
||||
vagrant up # provision if not already done
|
||||
vagrant rsync
|
||||
vagrant ssh -c "cd sync/tests/vmcheck && make install VERSION=$$(git describe)"
|
||||
vagrant ssh -c "sudo systemctl reboot" || :
|
||||
|
||||
vmcheck: vmbuild
|
||||
true # start test harness here
|
||||
|
||||
vmshell: vmbuild
|
||||
sleep 3 # give time to VM to close ssh port
|
||||
vagrant ssh
|
||||
|
||||
testenv:
|
||||
@echo "===== ENTERING TESTENV ====="
|
||||
test_tmpdir=$$(mktemp -d test.XXXXXX) && \
|
||||
|
@ -10,15 +10,12 @@ buildimg:
|
||||
sudo docker build -t $(BUILDER_IMG) -f Dockerfile.builder .
|
||||
|
||||
build:
|
||||
$(BUILDER_RUN) /bin/sh -c \
|
||||
'if ! test -f configure; then env NOCONFIGURE=1 ./autogen.sh; fi'
|
||||
$(BUILDER_RUN) /bin/sh -c \
|
||||
'if ! test -f Makefile; then ./configure --prefix=/usr --libdir=/usr/lib64; fi'
|
||||
$(BUILDER_RUN) /bin/sh -c make -j 4
|
||||
$(BUILDER_RUN) ./autogen.sh --prefix=/usr --libdir=/usr/lib64
|
||||
$(BUILDER_RUN) make -j 4
|
||||
|
||||
install: build
|
||||
sudo sh checkout.sh
|
||||
$(BUILDER_ARGS) -v /etc:/host/etc \
|
||||
-v /ostree/repo/tmp/vmcheck.ro/usr:/host/usr \
|
||||
$(BUILDER_IMG) sudo make install DESTDIR=/host
|
||||
sudo sh commit_and_deploy.sh
|
||||
sudo VERSION=$(VERSION) sh commit_and_deploy.sh
|
||||
|
@ -4,8 +4,13 @@ set -euo pipefail
|
||||
cd /ostree/repo/tmp
|
||||
umount vmcheck.ro
|
||||
|
||||
# would be nice to use --add-metadata-string=version=$(git describe) or so here,
|
||||
# but we don't even have git!
|
||||
cmd="ostree commit -b vmcheck -s '' \
|
||||
--tree=dir=vmcheck \
|
||||
--link-checkout-speedup"
|
||||
|
||||
ostree commit -b vmcheck -s '' --tree=dir=vmcheck --link-checkout-speedup
|
||||
if [ -n "${VERSION:-}" ]; then
|
||||
cmd="$cmd --add-metadata-string=version=$VERSION"
|
||||
fi
|
||||
|
||||
eval $cmd
|
||||
ostree admin deploy vmcheck
|
||||
|
Loading…
Reference in New Issue
Block a user