tests: add downgrade hold test

This commit is contained in:
Duncaen 2019-03-15 14:34:26 +01:00
parent d57a39ef4a
commit 53e6f5c75f
3 changed files with 43 additions and 0 deletions

View File

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

View File

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

View File

@ -0,0 +1,41 @@
#!/usr/bin/env atf-sh
atf_test_case downgrade_hold
downgrade_hold_head() {
atf_set "descr" "Tests for pkg downgrade: pkg is on hold mode"
}
downgrade_hold_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-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repository=$PWD/repo -yd A
atf_check_equal $? 0
xbps-pkgdb -r root -m hold A
atf_check_equal $? 0
out=$(xbps-query -r root -H)
atf_check_equal $out A-1.0_1
cd repo
xbps-create -A noarch -n A-0.1_1 -s "A pkg" -r "1.0_1" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
out=$(xbps-install -r root --repository=$PWD/repo -un)
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "A-0.1_1 hold noarch $PWD/repo"
xbps-install -r root --repository=$PWD/repo -yuvd
atf_check_equal $? 0
out=$(xbps-query -r root -p pkgver A)
atf_check_equal $out A-1.0_0
}
atf_init_test_cases() {
atf_add_test_case downgrade_hold
}