Makefile-tests.am: more cleanups and add pkg bar

The new package bar will be used to test conflicting packages.

Closes: #360
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2016-06-24 16:42:27 -04:00 committed by Atomic Bot
parent 65f5678ecb
commit d718b820ef
4 changed files with 52 additions and 13 deletions

View File

@ -7,15 +7,14 @@ AM_TESTS_ENVIRONMENT = \
commondir=$(abs_top_srcdir)/tests/common
CLEANFILES += \
tests/common/compose/yum/repodata/repomd.xml \
tests/common/compose/yum/repo \
tests/common/compose/test-repo.repo \
tests/common/compose/yum/repodata/*.bz2 \
tests/common/compose/yum/repodata/*.gz \
$(NULL)
testpackages = \
tests/common/compose/yum/x86_64/empty-1.0-1.x86_64.rpm \
tests/common/compose/yum/x86_64/foo-1.0-1.x86_64.rpm \
tests/common/compose/yum/repo/packages/x86_64/empty-1.0-1.x86_64.rpm \
tests/common/compose/yum/repo/packages/x86_64/foo-1.0-1.x86_64.rpm \
tests/common/compose/yum/repo/packages/x86_64/bar-1.0-1.x86_64.rpm \
$(NULL)
# Create a rule for each testpkg with their respective spec file as dep.
@ -31,7 +30,7 @@ $(1): tests/common/compose/yum/$(2).spec
--define "_specdir $$$$PWD" \
--define "_builddir $$$$PWD/.build" \
--define "_srcrpmdir $$$$PWD" \
--define "_rpmdir $$$$PWD" \
--define "_rpmdir $$$$PWD/repo/packages" \
--define "_buildrootdir $$$$PWD" && \
rm -rf .build && \
rm -f *.src.rpm)
@ -39,11 +38,12 @@ endef
$(foreach pkg,$(testpackages),$(eval $(call testpkgbuild_template,$(pkg),$(shell basename $(pkg) | cut -d- -f1))))
tests/common/compose/yum/repodata/repomd.xml: $(testpackages)
(cd tests/common/compose/yum && \
tests/common/compose/yum/repo/repodata/repomd.xml: $(testpackages)
(cd tests/common/compose/yum/repo && \
createrepo_c --no-database $$PWD)
tests/common/compose/test-repo.repo: tests/common/compose/test-repo.repo.in tests/common/compose/yum/repodata/repomd.xml
tests/common/compose/test-repo.repo: tests/common/compose/test-repo.repo.in \
tests/common/compose/yum/repo/repodata/repomd.xml
cat $< | sed -e "s|%WHERE%|$(abs_top_srcdir)|" > $@
CLEANFILES += \
@ -80,6 +80,8 @@ check-local:
@echo " *** NOTE ***"
@echo " *** NOTE ***"
.PHONY: vmbuild vmshell vmcheck testenv
vmbuild:
@if [ -z "$(SKIP_VMBUILD)" ]; then \
vagrant up && \
@ -94,7 +96,7 @@ vmshell: vmbuild
vagrant ssh
# set up test environment to somewhat resemble uninstalled tests
vmcheck: vmbuild
vmcheck: vmbuild tests/common/compose/yum/repo/repodata/repomd.xml
@env VMTESTS=1 \
builddir="$(abs_builddir)" \
topsrcdir="$(abs_top_srcdir)" \

View File

@ -1,6 +1,6 @@
[test-repo]
name=test-repo
baseurl=file://%WHERE%/tests/common/compose/yum
baseurl=file://%WHERE%/tests/common/compose/yum/repo
enabled=1
gpgcheck=0
skip_if_unavailable=False

View File

@ -0,0 +1,37 @@
Summary: Awesome utility that allows convenient barbing
Name: bar
Version: 1.0
Release: 1
License: GPL+
Group: Development/Tools
URL: http://bar.bar.com
BuildArch: x86_64
# LONG LIVE BARBING!
Conflicts: foo
%description
%{summary}
%prep
%build
cat > bar << EOF
#!/bin/sh
echo "Happy barbing!"
EOF
chmod a+x bar
%install
mkdir -p %{buildroot}/usr/bin
install bar %{buildroot}/usr/bin
%clean
rm -rf %{buildroot}
%files
/usr/bin/bar
%changelog
* Tue Jun 21 2016 Jonathan Lebon <jlebon@redhat.com> 1.0-1
- First Build

View File

@ -42,12 +42,12 @@ elif vm_has_layered_packages foo; then
assert_not_reached "foo already layered"
fi
vm_send /tmp/vmcheck ${commondir}/compose
vm_send /tmp/vmcheck ${commondir}/compose/yum/repo
cat > vmcheck.repo << EOF
[test-repo]
name=test-repo
baseurl=file:///tmp/vmcheck/compose/yum
baseurl=file:///tmp/vmcheck/repo
EOF
vm_send /etc/yum.repos.d vmcheck.repo