make vagrant-test idempotent

This commit is contained in:
Martin Sehnoutka 2019-07-25 13:27:59 +02:00 committed by Tom Gundersen
parent d975effc42
commit 03a0e4b41c
3 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,8 @@
PACKAGE_NAME=osbuild
VERSION=1
.PHONY: sdist tarball srpm rpm copy-rpms-to-test check-working-directory vagrant-test vagrant-test-keep-running
sdist:
python3 setup.py sdist
find `pwd`/dist -name '*.tar.gz' -printf '%f\n' -exec mv {} . \;
@ -29,11 +31,23 @@ rpm: $(PACKAGE_NAME).spec tarball
rm -r "`pwd`/rpmbuild"
rm -r "`pwd`/build"
copy-rpms-to-test:
copy-rpms-to-test: rpm
- rm test/testing-rpms/*.rpm
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec cp {} test/testing-rpms/ \;
vagrant-test: rpm copy-rpms-to-test
check-working-directory:
@if [ "`git status --porcelain --untracked-files=no | wc -l`" != "0" ]; then \
echo "Uncommited changes, refusing (Use git add . && git commit or git stash to clean your working directory)."; \
exit 1; \
fi
vagrant-test: check-working-directory copy-rpms-to-test
- $(MAKE) -C test destroy
- $(MAKE) -C test up
$(MAKE) -C test run-tests-remotely
- $(MAKE) -C test destroy
vagrant-test-keep-running: check-working-directory copy-rpms-to-test
- $(MAKE) -C test up
- $(MAKE) -C test install-deps
$(MAKE) -C test run-tests-remotely

View file

@ -1,6 +1,9 @@
up:
vagrant up
destroy:
vagrant destroy -f
install-deps:
vagrant provision

2
test/Vagrantfile vendored
View file

@ -2,6 +2,8 @@
# vi: set ft=ruby :
$script = <<-SCRIPT
packages=$(find /vagrant/testing-rpms -name '*.noarch.rpm')
sudo dnf remove -y $(basename -a ${packages[@]} | sed 's/-[0-9].*.rpm$//') || true
sudo dnf install qemu-system-x86 /vagrant/testing-rpms/*.noarch.rpm -y
SCRIPT