tests: add two more tests for preserving and force removal of conf files

This commit is contained in:
Duncan Overbruck 2019-08-06 13:07:23 +02:00
parent f0d62b9a80
commit 7b66a2885b

View File

@ -552,6 +552,69 @@ remove_modified_files_body() {
atf_check_equal $rv 0
}
atf_test_case keep_modified_conf_files
keep_modified_conf_files_head() {
atf_set "descr" "Tests for package removal: keep modified conf files in rootdir"
}
keep_modified_conf_files_body() {
mkdir some_repo
mkdir -p pkg_A/bin
echo "1234" >pkg_A/bin/ash
echo "1234" >pkg_A/bin/sh
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --config-files "/bin/ash /bin/sh" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -y A
atf_check_equal $? 0
echo "keep" >root/bin/sh
echo "keep" >root/bin/ash
xbps-remove -r root -yvd A
atf_check_equal $? 0
rv=1
if [ -e root/bin/sh -a -e root/bin/ash ]; then
rv=0
fi
atf_check_equal $rv 0
}
atf_test_case remove_modified_conf_files
remove_modified_conf_files_head() {
atf_set "descr" "Tests for package removal: force remove modified conf files in rootdir"
}
remove_modified_conf_files_body() {
mkdir some_repo
mkdir -p pkg_A/bin
echo "1234" >pkg_A/bin/ash
echo "1234" >pkg_A/bin/sh
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --config-files "/bin/ash /bin/sh" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -y A
atf_check_equal $? 0
echo "don't keep" >root/bin/sh
echo "don't keep" > root/bin/ash
xbps-remove -r root -yvdf A
atf_check_equal $? 0
rv=0
[ -e root/bin/sh ] && rv=1
[ -e root/bin/ash ] && rv=1
atf_check_equal $rv 0
}
atf_init_test_cases() {
atf_add_test_case keep_base_symlinks
atf_add_test_case keep_modified_symlinks
@ -572,4 +635,6 @@ atf_init_test_cases() {
atf_add_test_case remove_directory
atf_add_test_case keep_modified_files
atf_add_test_case remove_modified_files
atf_add_test_case keep_modified_conf_files
atf_add_test_case remove_modified_conf_files
}