tests: add tests to ensure that packages in stage are not removed

This commit is contained in:
Enno Boland 2016-03-21 11:22:42 +01:00
parent 3431715d67
commit b9ce711848
3 changed files with 41 additions and 1 deletions

View File

@ -3,3 +3,4 @@ syntax("kyuafile", 1)
test_suite("xbps-rindex")
atf_test_program{name="add_test"}
atf_test_program{name="clean_test"}
atf_test_program{name="remove_test"}

View File

@ -1,7 +1,7 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
TESTSHELL = add_test clean_test
TESTSHELL = add_test clean_test remove_test
TESTSSUBDIR = xbps/xbps-rindex
EXTRA_FILES = Kyuafile

View File

@ -0,0 +1,39 @@
#! /usr/bin/env atf-sh
# Test that xbps-rindex(8) -c (clean mode) works as expected.
# 1st test: make sure that nothing is removed if there are no changes.
atf_test_case noremove_stage
noremove_stage_head() {
atf_set "descr" "xbps-rindex(8) -r: don't removing if there's staging test"
}
noremove_stage_body() {
mkdir -p some_repo pkg_A pkg_B
cd some_repo
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" --shlib-provides "foo.so.1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "foo.so.1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "foo.so.2" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
[ -f *-stagedata ]
atf_check_equal $? 0
xbps-rindex -r some_repo
atf_check_equal $? 0
cd some_repo
[ -f foo-1.0_1* ]
atf_check_equal $? 0
[ -f foo-1.1_1* ]
atf_check_equal $? 0
[ -f bar-1.0_1* ]
atf_check_equal $? 0
}
atf_init_test_cases() {
atf_add_test_case noremove_stage
}