diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile index 978d5bbe..fdafd7c6 100644 --- a/tests/xbps/libxbps/common/Kyuafile +++ b/tests/xbps/libxbps/common/Kyuafile @@ -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') diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile index 5c3648fa..a05cb08d 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/tests/xbps/libxbps/shell/Makefile @@ -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 diff --git a/tests/xbps/libxbps/shell/install_test.sh b/tests/xbps/libxbps/shell/install_test.sh new file mode 100644 index 00000000..69527a95 --- /dev/null +++ b/tests/xbps/libxbps/shell/install_test.sh @@ -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 +}