Added an ATF test-case for #6 (close #6; this has been fixed previously).

This commit is contained in:
Juan RP 2013-11-06 09:37:38 +01:00
parent c1fafcd339
commit 987d374ea9
4 changed files with 61 additions and 0 deletions

View File

@ -10,6 +10,7 @@ SUBDIRS += util
SUBDIRS += find_pkg_obsoletes
SUBDIRS += find_pkg_orphans
SUBDIRS += pkgdb
SUBDIRS += issue6
SUBDIRS += issue18
SUBDIRS += issue20

View File

@ -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')

View File

@ -0,0 +1,7 @@
TOPDIR = ../../../..
-include $(TOPDIR)/config.mk
TEST = issue6_test
include ../Makefile.inc
include $(TOPDIR)/mk/test-shell.mk

View File

@ -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
}