tests: new test case for #234.

This checks that automatic-install obj in packages is properly
respected while performing recursive removal.
This commit is contained in:
Juan RP 2020-02-22 08:42:58 +01:00
parent c8d676f10e
commit 0005b3ecc0
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368
3 changed files with 63 additions and 1 deletions

View File

@ -26,4 +26,5 @@ atf_test_program{name="conflicts_test"}
atf_test_program{name="hold_test"}
atf_test_program{name="ignore_test"}
atf_test_program{name="preserve_test"}
atf_test_program{name="orphans_test"}
atf_test_program{name="noextract_files_test"}

View File

@ -9,7 +9,7 @@ TESTSHELL+= vpkg_test install_test preserve_files_test configure_test
TESTSHELL+= update_shlibs_test update_hold_test update_repolock_test
TESTSHELL+= cyclic_deps_test conflicts_test update_itself_test
TESTSHELL+= hold_test ignore_test preserve_test
TESTSHELL+= noextract_files_test
TESTSHELL+= noextract_files_test orphans_test
EXTRA_FILES = Kyuafile
include $(TOPDIR)/mk/test.mk

View File

@ -0,0 +1,61 @@
#!/usr/bin/env atf-sh
atf_test_case tc1
tc1_head() {
atf_set "descr" "Tests for pkg orphans: https://github.com/void-linux/xbps/issues/234"
}
tc1_body() {
mkdir -p repo pkg_A
cd repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=0" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n C-1.0_1 -s "C pkg" --dependencies "B>=0" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "C>=0" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repo=repo -yd D
atf_check_equal $? 0
out="$(xbps-query -r root -m)"
atf_check_equal $? 0
atf_check_equal "$out" "D-1.0_1"
xbps-remove -r root -Ryd D
atf_check_equal $? 0
out="$(xbps-query -r root -l|wc -l)"
atf_check_equal $? 0
atf_check_equal "$out" "0"
xbps-install -r root --repo=repo -yd A
atf_check_equal $? 0
out="$(xbps-query -r root -m)"
atf_check_equal $? 0
atf_check_equal "$out" "A-1.0_1"
xbps-install -r root --repo=repo -yd D
atf_check_equal $? 0
xbps-remove -r root -Ryd D
atf_check_equal $? 0
out="$(xbps-query -r root -m)"
atf_check_equal $? 0
atf_check_equal "$out" "A-1.0_1"
xbps-install -r root --repo=repo -yd D
atf_check_equal $? 0
xbps-pkgdb -r root -m auto A
atf_check_equal $? 0
xbps-remove -r root -Ryd D
atf_check_equal $? 0
out="$(xbps-query -r root -l|wc -l)"
atf_check_equal $? 0
atf_check_equal "$out" "0"
}
atf_init_test_cases() {
atf_add_test_case tc1
}