tests: new tests to verify pkg install order with real and virtual pkgs.

This commit is contained in:
Juan RP 2014-05-22 13:44:35 +02:00
parent 889e5d665e
commit 1c26b2ef95
3 changed files with 74 additions and 1 deletions

View File

@ -20,6 +20,7 @@ atf_test_program{name="obsoletefiles_test"}
atf_test_program{name="scripts_test"}
atf_test_program{name="incorrect_deps_test"}
atf_test_program{name="vpkg_test"}
atf_test_program{name="install_test"}
include('config/Kyuafile')
include('find_pkg_orphans/Kyuafile')

View File

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

View File

@ -0,0 +1,72 @@
#!/usr/bin/env atf-sh
atf_test_case install_with_deps
install_with_deps_head() {
atf_set "descr" "Tests for pkg installations: install with deps in proper order"
}
install_with_deps_body() {
# Proper order: A B C D
mkdir some_repo
mkdir -p pkg_{A,B,C,D}/usr/bin
cd some_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_B
atf_check_equal $? 0
xbps-create -A noarch -n C-1.0_1 -s "C pkg" --dependencies "A>=0 B>=0" ../pkg_C
atf_check_equal $? 0
xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "C>=0 B>=0" ../pkg_D
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
echo -e "A-1.0_1\nB-1.0_1\nC-1.0_1\nD-1.0_1\n" > exp
xbps-install -C empty.conf -r root --repository=$PWD/some_repo -yn D|awk '{print $1}' > out
echo >> out
echo "exp: '$(cat exp)'" >&2
echo "out: '$(cat out)'" >&2
cmp exp out
atf_check_equal $? 0
}
atf_test_case install_with_vpkg_deps
install_with_vpkg_deps_head() {
atf_set "descr" "Tests for pkg installations: install with virtual pkg updates in proper order"
}
install_with_vpkg_deps_body() {
# Proper order: D C A B
mkdir some_repo
mkdir -p pkg_{A,B,C,D}/usr/bin
cd some_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_B
atf_check_equal $? 0
xbps-create -A noarch -n C-1.0_1 -s "C pkg" --provides="E-1.0_1" --dependencies "D>=0" ../pkg_C
atf_check_equal $? 0
xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "E>=0 B>=0" ../pkg_D
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
echo -e "D-1.0_1\nC-1.0_1\nA-1.0_1\nB-1.0_1\n" > exp
xbps-install -C empty.conf -r root --repository=$PWD/some_repo -yn E|awk '{print $1}' > out
echo >> out
echo "exp: '$(cat exp)'" >&2
echo "out: '$(cat out)'" >&2
cmp exp out
atf_check_equal $? 0
}
atf_init_test_cases() {
atf_add_test_case install_with_deps
atf_add_test_case install_with_vpkg_deps
}