From c992db2bc00ab3d2d6a9e2656ee0df99bfb818ae Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 20 Apr 2014 18:19:12 +0200 Subject: [PATCH] New test cases to detect pkgs with dependencies on itself. --- NEWS | 4 +- tests/xbps/libxbps/common/Kyuafile | 1 + tests/xbps/libxbps/shell/Makefile | 2 +- .../xbps/libxbps/shell/incorrect_deps_test.sh | 49 +++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 tests/xbps/libxbps/shell/incorrect_deps_test.sh diff --git a/NEWS b/NEWS index e875b1e4..cdaabcf6 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,8 @@ xbps-0.36 (???): * libxbps: the dependency solver is now able to detect and ignore invalid - dependencies of a package that are depending on itself, if those are - declared as virtual packages. + dependencies of a package that are depending on itself, either as real + or virtual packages. * xbps-install(8): the -n,--dry-run option does not acquire the pkgdb file lock anymore, so that any user can use this mode even without write permission to diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile index 838557ef..d2eaaa8e 100644 --- a/tests/xbps/libxbps/common/Kyuafile +++ b/tests/xbps/libxbps/common/Kyuafile @@ -18,6 +18,7 @@ atf_test_program{name="replace_test"} atf_test_program{name="installmode_test"} atf_test_program{name="obsoletefiles_test"} atf_test_program{name="scripts_test"} +atf_test_program{name="incorrect_deps_test"} include('find_pkg_orphans/Kyuafile') include('pkgdb/Kyuafile') diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile index 5ddb15fe..76f9acd2 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/tests/xbps/libxbps/shell/Makefile @@ -3,7 +3,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 +TESTSHELL+= issue31_test scripts_test incorrect_deps_test include ../Makefile.inc include $(TOPDIR)/mk/test.mk diff --git a/tests/xbps/libxbps/shell/incorrect_deps_test.sh b/tests/xbps/libxbps/shell/incorrect_deps_test.sh new file mode 100644 index 00000000..ff6425ca --- /dev/null +++ b/tests/xbps/libxbps/shell/incorrect_deps_test.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env atf-sh +# +atf_test_case incorrect_dep + +incorrect_dep_head() { + atf_set "descr" "Tests for package deps: pkg depends on itself" +} + +incorrect_dep_body() { + mkdir some_repo + mkdir -p pkg_B/usr/bin + echo "B-1.0_1" > pkg_B/usr/bin/foo + cd some_repo + xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "B>=0" ../pkg_B + atf_check_equal $? 0 + + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B + atf_check_equal $? 0 +} + +atf_test_case incorrect_dep_vpkg + +incorrect_dep_vpkg_body() { + mkdir some_repo + mkdir -p pkg_A/usr/bin pkg_B/usr/bin + echo "A-1.0_1" > pkg_A/usr/bin/foo + echo "B-1.0_1" > pkg_B/usr/bin/foo + cd some_repo + xbps-create -A noarch -n A-10.1.1_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=7.11_1" --provides "A-331.67_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/some_repo -dy A + atf_check_equal $? 0 + xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B + atf_check_equal $? 0 +} + +atf_init_test_cases() { + atf_add_test_case incorrect_dep + atf_add_test_case incorrect_dep_vpkg +}