tests/xbps-alternatives: add a new test.

This new test case checks that provider fallbacks to the first one
when the current provider is removed.

The test fails currently.
This commit is contained in:
Juan RP 2019-06-11 12:49:31 +02:00 committed by Duncan Overbruck
parent c29efcd13b
commit 5af8067973

View File

@ -512,6 +512,42 @@ useless_switch_body() {
atf_check_equal $rv 0
}
atf_test_case remove_defprovider
remove_defprovider_head() {
atf_set "descr" "xbps-alternatives: removing default provider"
}
remove_defprovider_body() {
mkdir -p repo pkg_A/usr/bin pkg_B/usr/bin
touch pkg_A/usr/bin/fileA pkg_B/usr/bin/fileB
cd repo
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "file:/usr/bin/file:/usr/bin/fileA" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "B pkg" --alternatives "file:/usr/bin/file:/usr/bin/fileB" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repository=repo -ydv A
atf_check_equal $? 0
xbps-install -r root --repository=repo -ydv B
atf_check_equal $? 0
xbps-alternatives -s B
atf_check_equal $? 0
xbps-remove -r root -ydv B
atf_check_equal $? 0
lnk=$(readlink -f root/usr/bin/file)
rv=0
if [ "$lnk" = "$PWD/root/usr/bin/fileB" ]; then
rv=1
fi
echo "lnk: $lnk"
atf_check_equal $rv 0
}
atf_init_test_cases() {
atf_add_test_case register_one
atf_add_test_case register_one_dangling
@ -526,4 +562,5 @@ atf_init_test_cases() {
atf_add_test_case update_pkgs
atf_add_test_case less_entries
atf_add_test_case useless_switch
atf_add_test_case remove_defprovider
}