Implement shlib checks for all pkg revdeps in the transaction.

Added three new test cases to verify its correctness.
This commit is contained in:
Juan RP
2014-09-12 11:49:34 +02:00
parent b306adf52b
commit 39aca1bbc9
8 changed files with 249 additions and 76 deletions

View File

@@ -22,6 +22,7 @@ atf_test_program{name="incorrect_deps_test"}
atf_test_program{name="vpkg_test"}
atf_test_program{name="install_test"}
atf_test_program{name="preserve_files_test"}
atf_test_program{name="update_shlibs"}
include('config/Kyuafile')
include('find_pkg_orphans/Kyuafile')

View File

@@ -5,6 +5,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
TESTSHELL+= update_shlibs
include ../Makefile.inc
include $(TOPDIR)/mk/test.mk

View File

@@ -0,0 +1,125 @@
#!/usr/bin/env atf-sh
#
# 1st case:
# - A is updated and contains a soname bump
# - A revdeps are broken
# - ENOEXEC expected (unresolved shlibs)
atf_test_case shlib_bump
shlib_bump_head() {
atf_set "descr" "Tests for pkg updates: update pkg with soname bump"
}
shlib_bump_body() {
mkdir -p repo pkg_A pkg_B
cd repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --shlib-provides "libfoo.so.1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=0" --shlib-requires "libfoo.so.1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -C empty.conf -r root --repository=$PWD/repo -yvd B
atf_check_equal $? 0
cd repo
xbps-create -A noarch -n A-2.0_1 -s "A pkg" --shlib-provides "libfoo.so.2" ../pkg_A
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
# returns ENOEXEC if there are unresolved shlibs
xbps-install -C empty.conf -r root --repository=$PWD/repo -yuvd A
atf_check_equal $? 8
}
# 2nd case:
# - A is updated and contains a soname bump
# - A revdeps are broken but there are updates in transaction
atf_test_case shlib_bump_revdep_in_trans
shlib_bump_revdep_in_trans_head() {
atf_set "descr" "Tests for pkg updates: update pkg with soname bump, updated revdep in trans"
}
shlib_bump_revdep_in_trans_body() {
mkdir -p repo pkg_A pkg_B
cd repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --shlib-provides "libfoo.so.1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=1.0" --shlib-requires "libfoo.so.1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -C empty.conf -r root --repository=$PWD/repo -yvd B
atf_check_equal $? 0
cd repo
xbps-create -A noarch -n A-2.0_1 -s "A pkg" --shlib-provides "libfoo.so.2" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-2.0_1 -s "B pkg" --dependencies "A>=0" --shlib-requires "libfoo.so.2" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -C empty.conf -r root --repository=$PWD/repo -yuvd
atf_check_equal $? 0
res=$(xbps-query -C empty.conf -r root -p pkgver A)
atf_check_equal $res A-2.0_1
res=$(xbps-query -C empty.conf -r root -p pkgver B)
atf_check_equal $res B-2.0_1
}
# 3rd case:
# - A is updated and contains a soname bump
# - A revdeps are broken and there are broken updates in transaction
# - ENOEXEC expected (unresolved shlibs)
atf_test_case shlib_bump_incomplete_revdep_in_trans
shlib_bump_incomplete_revdep_in_trans_head() {
atf_set "descr" "Tests for pkg updates: update pkg with soname bump, updated revdep in trans with unresolved shlibs"
}
shlib_bump_incomplete_revdep_in_trans_body() {
mkdir -p repo pkg_A pkg_B
cd repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --shlib-provides "libfoo.so.1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=1.0" --shlib-requires "libfoo.so.1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -C empty.conf -r root --repository=$PWD/repo -yvd B
atf_check_equal $? 0
cd repo
xbps-create -A noarch -n A-2.0_1 -s "A pkg" --shlib-provides "libfoo.so.2" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "B pkg" --dependencies "A>=0" --shlib-requires "libfoo.so.1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -C empty.conf -r root --repository=$PWD/repo -yuvd
atf_check_equal $? 8
}
atf_init_test_cases() {
atf_add_test_case shlib_bump
atf_add_test_case shlib_bump_incomplete_revdep_in_trans
atf_add_test_case shlib_bump_revdep_in_trans
}