From 987d374ea9b31e2c1eddea54ce924666d7431e0c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 6 Nov 2013 09:37:38 +0100 Subject: [PATCH] Added an ATF test-case for #6 (close #6; this has been fixed previously). --- tests/xbps/libxbps/Makefile | 1 + tests/xbps/libxbps/common/Kyuafile | 1 + tests/xbps/libxbps/issue6/Makefile | 7 ++++ tests/xbps/libxbps/issue6/issue6_test.sh | 52 ++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 tests/xbps/libxbps/issue6/Makefile create mode 100644 tests/xbps/libxbps/issue6/issue6_test.sh diff --git a/tests/xbps/libxbps/Makefile b/tests/xbps/libxbps/Makefile index 51ecad12..dddd1675 100644 --- a/tests/xbps/libxbps/Makefile +++ b/tests/xbps/libxbps/Makefile @@ -10,6 +10,7 @@ SUBDIRS += util SUBDIRS += find_pkg_obsoletes SUBDIRS += find_pkg_orphans SUBDIRS += pkgdb +SUBDIRS += issue6 SUBDIRS += issue18 SUBDIRS += issue20 diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile index 11f3dfa8..bf440298 100644 --- a/tests/xbps/libxbps/common/Kyuafile +++ b/tests/xbps/libxbps/common/Kyuafile @@ -8,6 +8,7 @@ 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="issue6_test"} atf_test_program{name="issue18_test"} atf_test_program{name="issue20_test"} include('find_pkg_orphans/Kyuafile') diff --git a/tests/xbps/libxbps/issue6/Makefile b/tests/xbps/libxbps/issue6/Makefile new file mode 100644 index 00000000..cfe754f7 --- /dev/null +++ b/tests/xbps/libxbps/issue6/Makefile @@ -0,0 +1,7 @@ +TOPDIR = ../../../.. +-include $(TOPDIR)/config.mk + +TEST = issue6_test + +include ../Makefile.inc +include $(TOPDIR)/mk/test-shell.mk diff --git a/tests/xbps/libxbps/issue6/issue6_test.sh b/tests/xbps/libxbps/issue6/issue6_test.sh new file mode 100644 index 00000000..6cb5a0db --- /dev/null +++ b/tests/xbps/libxbps/issue6/issue6_test.sh @@ -0,0 +1,52 @@ +#! /usr/bin/env atf-sh + +# xbps issue #6. +# How to reproduce it: +# - Create pkg a-0.1_1 (empty). +# - Create two empty dirs on target rootdir. +# /usr/lib/firefox/dictionaries +# /usr/lib/firefox/hyphenation +# - Create pkg a-0.2_1 containing 2 symlinks overwriting existing dirs. +# /usr/lib/firefox/dictionaries -> /usr/share/hunspell +# /usr/lib/firefox/hyphenation -> /usr/share/hyphen +# - Upgrade pkg a to 0.2. + +atf_test_case issue6 + +issue6_head() { + atf_set "descr" "xbps issue #6 (https://github.com/xtraeme/xbps/issues/6)" +} + +issue6_body() { + mkdir repo + cd repo + xbps-create -A noarch -n a-0.1_1 -s "pkg a" . + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + xbps-install -r rootdir --repository=$PWD -y a + atf_check_equal $? 0 + mkdir -p rootdir/usr/lib/firefox/dictionaries + mkdir -p rootdir/usr/lib/firefox/hyphenation + mkdir -p pkg_a/usr/lib/firefox + ln -s /usr/share/hunspell pkg_a/usr/lib/firefox/dictionaries + ln -s /usr/share/hyphen pkg_a/usr/lib/firefox/hyphenation + xbps-create -A noarch -n a-0.2_1 -s "pkg a" pkg_a + atf_check_equal $? 0 + rm -rf pkg_a + xbps-rindex -a *.xbps + atf_check_equal $? 0 + xbps-install -r rootdir --repository=$PWD -yu + atf_check_equal $? 0 + tgt1=$(readlink rootdir/usr/lib/firefox/dictionaries) + tgt2=$(readlink rootdir/usr/lib/firefox/hyphenation) + rval=1 + if [ "$tgt1" = "/usr/share/hunspell" -a "$tgt2" = "/usr/share/hyphen" ]; then + rval=0 + fi + atf_check_equal $rval 0 +} + +atf_init_test_cases() { + atf_add_test_case issue6 +}