Implemented reverse conflicts for pkgs in pkgdb and transaction.

This commit is contained in:
Juan RP
2015-10-28 05:23:42 +01:00
parent 2c81984f48
commit a13a7fa896
8 changed files with 172 additions and 15 deletions

View File

@@ -21,3 +21,4 @@ atf_test_program{name="update_shlibs"}
atf_test_program{name="update_hold"}
atf_test_program{name="update_repolock"}
atf_test_program{name="cyclic_deps"}
atf_test_program{name="conflicts"}

View File

@@ -6,7 +6,7 @@ TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
TESTSHELL+= replace_test installmode_test obsoletefiles_test
TESTSHELL+= issue31_test scripts_test incorrect_deps_test
TESTSHELL+= vpkg_test install_test preserve_files_test configure_test
TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps
TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps conflicts
EXTRA_FILES = Kyuafile
include $(TOPDIR)/mk/test.mk

View File

@@ -0,0 +1,88 @@
#!/usr/bin/env atf-sh
atf_test_case conflicts_trans
conflicts_trans_head() {
atf_set "descr" "Tests for pkg conflicts: conflicting pkgs in transaction"
}
conflicts_trans_body() {
mkdir some_repo
mkdir -p pkg_{A,B}/usr/bin
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "B>=0" ../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 --repository=$PWD/some_repo -dy A B
# EAGAIN, conflicts.
atf_check_equal $? 11
# 0 pkgs installed.
xbps-query -r root -l|wc -l
atf_check_equal $(xbps-query -r root -l|wc -l) 0
}
atf_test_case conflicts_installed
conflicts_installed_head() {
atf_set "descr" "Tests for pkg conflicts: installed pkg conflicts with pkg in transaction"
}
conflicts_installed_body() {
mkdir some_repo
mkdir -p pkg_{A,B}/usr/bin
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "B>=0" ../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 --repository=$PWD/some_repo -dy A
atf_check_equal $? 0
xbps-install -r root --repository=$PWD/some_repo -dy B
atf_check_equal $? 11
xbps-query -r root -l|wc -l
atf_check_equal $(xbps-query -r root -l|wc -l) 1
}
atf_test_case conflicts_trans_installed
conflicts_trans_installed_head() {
atf_set "descr" "Tests for pkg conflicts: pkg in transaction conflicts with installed pkg"
}
conflicts_trans_installed_body() {
mkdir some_repo
mkdir -p pkg_{A,B}/usr/bin
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "B>=0" ../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 --repository=$PWD/some_repo -dy B
atf_check_equal $? 0
xbps-install -r root --repository=$PWD/some_repo -dy A
atf_check_equal $? 11
xbps-query -r root -l|wc -l
atf_check_equal $(xbps-query -r root -l|wc -l) 1
}
atf_init_test_cases() {
atf_add_test_case conflicts_trans
atf_add_test_case conflicts_trans_installed
atf_add_test_case conflicts_installed
}