Skip to content

Commit 630b413

Browse files
committed
tests: add tests for installing already installed packages
This tests for the regression fixed in 53ba642f.
1 parent c819124 commit 630b413

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/xbps/xbps-install/behaviour_tests.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,36 @@ install_msg_body() {
252252
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yu
253253
}
254254

255+
atf_test_case already_installed
256+
257+
already_installed_head() {
258+
atf_set "descr" "xbps-install(1): various ways to install already installed packages"
259+
}
260+
261+
already_installed_body() {
262+
mkdir -p repo pkg
263+
264+
cd repo
265+
atf_check -o ignore -- xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg
266+
atf_check -e ignore -o ignore -- xbps-rindex -a *.xbps
267+
cd ..
268+
269+
atf_check -o ignore -e ignore -- xbps-install -r root -R repo -y A
270+
atf_check -o ignore -e match:"ERROR: Package \`A' already installed." -- xbps-install -r root -R repo -y A
271+
atf_check -o ignore -e match:"ERROR: Package \`A-1.1_1' already installed." -- xbps-install -r root -R repo -y A-1.1_1
272+
atf_check -s exit:2 -o ignore -e match:"ERROR: Package 'A-1.2_1' not found in repository pool." -- xbps-install -r root -R repo -y A-1.2_1
273+
274+
cd repo
275+
atf_check -o ignore -- xbps-create -A noarch -n A-1.2_1 -s "A pkg" ../pkg
276+
atf_check -e ignore -o ignore -- xbps-rindex -a *.xbps
277+
cd ..
278+
279+
atf_check -o ignore -e ignore -- xbps-install -r root -R repo -y A
280+
atf_check -o ignore -e match:"ERROR: Package \`A' already installed." -- xbps-install -r root -R repo -y A
281+
atf_check -s exit:2 -o ignore -e match:"ERROR: Package 'A-1.1_1' not found in repository pool." -- xbps-install -r root -R repo -y A-1.1_1
282+
atf_check -o ignore -e match:"ERROR: Package \`A-1.2_1' already installed." -- xbps-install -r root -R repo -y A-1.2_1
283+
}
284+
255285
atf_init_test_cases() {
256286
atf_add_test_case install_existent
257287
atf_add_test_case update_existent
@@ -261,4 +291,5 @@ atf_init_test_cases() {
261291
atf_add_test_case reinstall_unpacked_unpack_only
262292
atf_add_test_case reproducible
263293
atf_add_test_case install_msg
294+
atf_add_test_case already_installed
264295
}

0 commit comments

Comments
 (0)