From 0005b3ecc08ef3f1979b49f665bb06ef02d10080 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 22 Feb 2020 08:42:58 +0100 Subject: [PATCH] tests: new test case for #234. This checks that automatic-install obj in packages is properly respected while performing recursive removal. --- tests/xbps/libxbps/shell/Kyuafile | 1 + tests/xbps/libxbps/shell/Makefile | 2 +- tests/xbps/libxbps/shell/orphans_test.sh | 61 ++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/xbps/libxbps/shell/orphans_test.sh diff --git a/tests/xbps/libxbps/shell/Kyuafile b/tests/xbps/libxbps/shell/Kyuafile index 944a6d8e..b9c74ed5 100644 --- a/tests/xbps/libxbps/shell/Kyuafile +++ b/tests/xbps/libxbps/shell/Kyuafile @@ -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"} diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile index 022b0a6f..2ee0a8ae 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/tests/xbps/libxbps/shell/Makefile @@ -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 diff --git a/tests/xbps/libxbps/shell/orphans_test.sh b/tests/xbps/libxbps/shell/orphans_test.sh new file mode 100644 index 00000000..dddc13c6 --- /dev/null +++ b/tests/xbps/libxbps/shell/orphans_test.sh @@ -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 +}