From 53e6f5c75fb037f26d4b316b6123caf2a16babf2 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Fri, 15 Mar 2019 14:34:26 +0100 Subject: [PATCH] tests: add downgrade hold test --- tests/xbps/libxbps/shell/Kyuafile | 1 + tests/xbps/libxbps/shell/Makefile | 1 + tests/xbps/libxbps/shell/downgrade_hold.sh | 41 ++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 tests/xbps/libxbps/shell/downgrade_hold.sh diff --git a/tests/xbps/libxbps/shell/Kyuafile b/tests/xbps/libxbps/shell/Kyuafile index 53a4bf14..1ff87e47 100644 --- a/tests/xbps/libxbps/shell/Kyuafile +++ b/tests/xbps/libxbps/shell/Kyuafile @@ -22,3 +22,4 @@ atf_test_program{name="update_hold"} atf_test_program{name="update_repolock"} atf_test_program{name="cyclic_deps"} atf_test_program{name="conflicts"} +atf_test_program{name="downgrade_hold"} diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile index 4e14e2b5..13649d0b 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/tests/xbps/libxbps/shell/Makefile @@ -7,6 +7,7 @@ TESTSHELL+= replace_test installmode_test obsoletefiles_test TESTSHELL+= issue31_test scripts_test incorrect_deps_test TESTSHELL+= vpkg_test install_test preserve_files_test configure_test TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps conflicts +TESTSHELL+= downgrade_hold EXTRA_FILES = Kyuafile include $(TOPDIR)/mk/test.mk diff --git a/tests/xbps/libxbps/shell/downgrade_hold.sh b/tests/xbps/libxbps/shell/downgrade_hold.sh new file mode 100644 index 00000000..eafd1fc5 --- /dev/null +++ b/tests/xbps/libxbps/shell/downgrade_hold.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env atf-sh + +atf_test_case downgrade_hold + +downgrade_hold_head() { + atf_set "descr" "Tests for pkg downgrade: pkg is on hold mode" +} + +downgrade_hold_body() { + mkdir -p repo pkg_A + cd repo + xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + cd .. + xbps-install -r root --repository=$PWD/repo -yd A + atf_check_equal $? 0 + xbps-pkgdb -r root -m hold A + atf_check_equal $? 0 + out=$(xbps-query -r root -H) + atf_check_equal $out A-1.0_1 + cd repo + xbps-create -A noarch -n A-0.1_1 -s "A pkg" -r "1.0_1" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + cd .. + out=$(xbps-install -r root --repository=$PWD/repo -un) + set -- $out + exp="$1 $2 $3 $4" + atf_check_equal "$exp" "A-0.1_1 hold noarch $PWD/repo" + xbps-install -r root --repository=$PWD/repo -yuvd + atf_check_equal $? 0 + out=$(xbps-query -r root -p pkgver A) + atf_check_equal $out A-1.0_0 +} + +atf_init_test_cases() { + atf_add_test_case downgrade_hold +}