From 2a895523756053b8b145c8513e0c90b81bf2d0b5 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 28 Sep 2014 13:28:56 +0200 Subject: [PATCH] tests: new test to verify pkg files removal with files that only have read bit set. This currently fails but will be fixed in an upcoming change. --- tests/xbps/libxbps/shell/remove_test.sh | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/xbps/libxbps/shell/remove_test.sh b/tests/xbps/libxbps/shell/remove_test.sh index faa1e296..423e7a10 100644 --- a/tests/xbps/libxbps/shell/remove_test.sh +++ b/tests/xbps/libxbps/shell/remove_test.sh @@ -105,8 +105,40 @@ remove_symlinks_from_root_body() { atf_check_equal $rv 0 } +atf_test_case remove_readonly_files + +remove_readonly_files_head() { + atf_set "descr" "Tests for package removal: read-only files" +} + +remove_readonly_files_body() { + mkdir some_repo + mkdir -p pkg_A/usr/bin + echo kjaskjas > pkg_A/usr/bin/foo + echo sskjas > pkg_A/usr/bin/blah + chmod 444 pkg_A/usr/bin/foo + chmod 444 pkg_A/usr/bin/blah + + cd some_repo + xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + xbps-install -r root -C null.conf --repository=$PWD/some_repo -yv A + atf_check_equal $? 0 + xbps-remove -r root -yv A + atf_check_equal $? 0 + rv=0 + if [ -r root/usr/bin/foo -a -r root/usr/bin/blah ]; then + rv=1 + fi + atf_check_equal $rv 0 +} + atf_init_test_cases() { atf_add_test_case keep_base_symlinks + atf_add_test_case remove_readonly_files atf_add_test_case remove_symlinks atf_add_test_case remove_symlinks_from_root }