From 90351bef080ebee449a42e1d9bf158495c4477e0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 12 Dec 2013 17:21:57 +0100 Subject: [PATCH] Added a new test case to reproduce an issue while replacing a pkg multiple times. The test case currently fails; will be fixed shortly in an upcoming commit. --- tests/xbps/libxbps/common/Kyuafile | 2 ++ tests/xbps/libxbps/shell/Makefile | 1 + tests/xbps/libxbps/shell/replace_test.sh | 41 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/xbps/libxbps/shell/replace_test.sh diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile index cfefa124..faf710a9 100644 --- a/tests/xbps/libxbps/common/Kyuafile +++ b/tests/xbps/libxbps/common/Kyuafile @@ -13,5 +13,7 @@ atf_test_program{name="issue18_test"} atf_test_program{name="issue20_test"} atf_test_program{name="conf_files_test"} atf_test_program{name="remove_test"} +atf_test_program{name="replace_test"} + include('find_pkg_orphans/Kyuafile') include('pkgdb/Kyuafile') diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile index c73a00d8..21dbe883 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/tests/xbps/libxbps/shell/Makefile @@ -2,6 +2,7 @@ TOPDIR = ../../../.. -include $(TOPDIR)/config.mk TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test +TESTSHELL+= replace_test include ../Makefile.inc include $(TOPDIR)/mk/test.mk diff --git a/tests/xbps/libxbps/shell/replace_test.sh b/tests/xbps/libxbps/shell/replace_test.sh new file mode 100644 index 00000000..a83cd0c7 --- /dev/null +++ b/tests/xbps/libxbps/shell/replace_test.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# +# This test case reproduces the following issue: +# +# - A-1.0_1 is installed. +# - B-1.0_1 is going to be installed and it should replace pkg A, but +# incorrectly wants to replace A multiple times, i.e +# replaces="A>=0 A>=0" +# - B-1.0_1 is installed. +# - A-1.0_1 is registered in pkgdb, while it should not. + +atf_test_case replace_dups + +replace_dups_head() { + atf_set "descr" "Tests for package replace: verify dup matches" +} + +replace_dups_body() { + mkdir some_repo root + 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-1.0_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-create -A noarch -n B-1.0_1 -s "B pkg" --replaces "A>=0 A>=0" ../pkg_B + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + xbps-install -C empty.conf -r root --repository=$mydir/some_repo -y A + atf_check_equal $? 0 + xbps-install -C empty.conf -r root --repository=$mydir/some_repo -y B + atf_check_equal $? 0 + result=$(xbps-query -C empty.conf -r root -l|wc -l) + atf_check_equal $result 1 +} + +atf_init_test_cases() { + atf_add_test_case replace_dups +}