From ffa5bea178fe3bae280443d091e559d209d133e3 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Tue, 24 Mar 2020 20:54:00 +0100 Subject: [PATCH] tests: add expected failure test case for cc alternatives removal --- tests/xbps/xbps-alternatives/main_test.sh | 46 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/xbps/xbps-alternatives/main_test.sh b/tests/xbps/xbps-alternatives/main_test.sh index fcc3a1df..084069f0 100644 --- a/tests/xbps/xbps-alternatives/main_test.sh +++ b/tests/xbps/xbps-alternatives/main_test.sh @@ -893,12 +893,55 @@ replace_file_with_alternative_body() { xbps-install -r root --repository=repo -ydv -Su atf_check_equal $? 0 - test -L root/usr/bin/file + test -h root/usr/bin/file atf_check_equal $? 0 test "$(readlink -f root/usr/bin/file)" = "pkg-b-file" atf_check_equal $? 0 } +atf_test_case cc_alternatives_removal + +cc_alternatives_removal_head() { + atf_set "descr" "xbps-alternatives: removal of the cc alternatives group" +} +cc_alternatives_removal_body() { + atf_expect_fail "https://github.com/void-linux/xbps/pull/253" + + mkdir -p repo pkg_A/usr/bin + mkdir -p repo pkg_B/usr/bin + touch pkg_A/usr/bin/gcc + touch pkg_B/usr/bin/clang + + cd repo + xbps-create -A noarch -n gcc-1.1_1 -s "gcc pkg" --alternatives "cc:cc:/usr/bin/gcc" ../pkg_A + atf_check_equal $? 0 + xbps-create -A noarch -n clang-1.1_1 -s "clang pkg" --alternatives "cc:cc:/usr/bin/clang" ../pkg_B + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + cd .. + + xbps-install -r root --repository=repo -ydv clang gcc + atf_check_equal $? 0 + + ln -s gcc pkg_A/usr/bin/cc + cd repo + rm -f *.xbps + xbps-create -A noarch -n gcc-1.1_2 -s "gcc pkg" ../pkg_A + atf_check_equal $? 0 + xbps-create -A noarch -n clang-1.1_2 -s "clang pkg" ../pkg_B + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + cd .. + + xbps-install -r root --repository=repo -dvyu gcc clang + atf_check_equal $? 0 + + test -h root/usr/bin/cc + atf_check_equal $? 0 +} + atf_init_test_cases() { atf_add_test_case register_one atf_add_test_case register_one_dangling @@ -921,4 +964,5 @@ atf_init_test_cases() { atf_add_test_case replace_alternative_with_symlink atf_add_test_case keep_provider_on_update atf_add_test_case replace_file_with_alternative + atf_add_test_case cc_alternatives_removal }