diff --git a/mk/test-shell.mk b/mk/test-shell.mk new file mode 100644 index 00000000..f5f2f4c5 --- /dev/null +++ b/mk/test-shell.mk @@ -0,0 +1,21 @@ +-include $(TOPDIR)/config.mk + +.PHONY: all +all: $(TEST) + +.PHONY: clean +clean: + +.PHONY: install +install: all + install -d $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR) + install -m755 $(TEST).sh $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR)/$(TEST) +ifdef EXTRA_FILES + for f in $(EXTRA_FILES); do \ + install -m644 $${f} $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR); \ + done +endif + +.PHONY: uninstall +uninstall: + -rm -f $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR)/$(TEST) diff --git a/tests/libxbps/Makefile b/tests/libxbps/Makefile index 5b8aa23b..7d0f60e0 100644 --- a/tests/libxbps/Makefile +++ b/tests/libxbps/Makefile @@ -10,5 +10,6 @@ SUBDIRS += util SUBDIRS += find_pkg_obsoletes SUBDIRS += find_pkg_orphans SUBDIRS += pkgdb +SUBDIRS += issue18 include ../../mk/subdir.mk diff --git a/tests/libxbps/common/Kyuafile b/tests/libxbps/common/Kyuafile index 8fa94345..59fd8160 100644 --- a/tests/libxbps/common/Kyuafile +++ b/tests/libxbps/common/Kyuafile @@ -8,5 +8,6 @@ atf_test_program{name="pkgpattern_match_test"} atf_test_program{name="plist_match_test"} atf_test_program{name="plist_match_virtual_test"} atf_test_program{name="find_pkg_obsoletes_test"} +atf_test_program{name="issue18_test"} include('find_pkg_orphans/Kyuafile') include('pkgdb/Kyuafile') diff --git a/tests/libxbps/issue18/Makefile b/tests/libxbps/issue18/Makefile new file mode 100644 index 00000000..c5c0e00a --- /dev/null +++ b/tests/libxbps/issue18/Makefile @@ -0,0 +1,7 @@ +TOPDIR = ../../.. +-include $(TOPDIR)/config.mk + +TEST = issue18_test + +include ../Makefile.inc +include $(TOPDIR)/mk/test-shell.mk diff --git a/tests/libxbps/issue18/issue18_test.sh b/tests/libxbps/issue18/issue18_test.sh new file mode 100755 index 00000000..7a4d9275 --- /dev/null +++ b/tests/libxbps/issue18/issue18_test.sh @@ -0,0 +1,32 @@ +#! /usr/bin/env atf-sh + +# xbps issue #18. +# How to reproduce it: +# Generate pkg A-0.1_1 and B-0.1_1. +# Install both pkgs. +# Generate pkg A-0.2_1: conflicts with B<0.1_2. +# Generate pkg B-0.1_2. +# Update all packages. + +atf_test_case issue18 + +issue18_head() { + atf_set "descr" "xbps issue #18 (https://github.com/xtraeme/xbps/issues/18)" +} + +issue18_body() { + mkdir pkg_A pkg_B + atf_check 'xbps-create -A noarch -n A-0.1_1 -s "pkg A" pkg_A' 0 + atf_check 'xbps-create -A noarch -n B-0.1_1 -s "pkg B" pkg_B' 0 + atf_check 'xbps-rindex -a *.xbps' 0 + atf_check 'xbps-install -r rootdir --repository=$PWD -y A B' 0 + + atf_check 'xbps-create -A noarch -n A-0.2_1 -s "pkg A" --conflicts "B<0.1_2" pkg_A' 0 + atf_check 'xbps-create -A noarch -n B-0.1_2 -s "pkg B" pkg_B' 0 + atf_check 'xbps-rindex -a *.xbps' 0 + atf_check 'xbps-install -r rootdir --repository=$PWD -yu' 0 +} + +atf_init_test_cases() { + atf_add_test_case issue18 +}