tests: add test for removal of ignored package

This commit is contained in:
Duncaen 2019-06-23 12:04:30 +02:00 committed by Duncan Overbruck
parent 11e5190a36
commit 5fc340a838

View File

@ -101,8 +101,40 @@ remove_with_ignored_dep_body() {
atf_check_equal $? 2
}
atf_test_case remove_ignored_dep
remove_ignored_dep_head() {
atf_set "descr" "Tests for pkg remove: pkg is dependency but ignored"
}
remove_ignored_dep_body() {
mkdir -p repo root/xbps.d pkg_A pkg_B
cd repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" -D "B-1.0_1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C xbps.d --repository=$PWD/repo -yd A
atf_check_equal $? 0
echo "ignorepkg=B" > root/xbps.d/ignore.conf
out=$(xbps-remove -r root -C xbps.d -Rn B)
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "B-1.0_1 remove noarch $PWD/repo"
xbps-remove -r root -C xbps.d -Ryvd B
atf_check_equal $? 0
xbps-query -r root A
atf_check_equal $? 0
xbps-query -r root B
atf_check_equal $? 2
}
atf_init_test_cases() {
atf_add_test_case install_with_ignored_dep
atf_add_test_case update_with_ignored_dep
atf_add_test_case remove_with_ignored_dep
atf_add_test_case remove_ignored_dep
}