tests: new test to verify obsolete files code works in updates and reinstalls.
This commit is contained in:
@@ -15,6 +15,7 @@ atf_test_program{name="conf_files_test"}
|
||||
atf_test_program{name="remove_test"}
|
||||
atf_test_program{name="replace_test"}
|
||||
atf_test_program{name="installmode_test"}
|
||||
atf_test_program{name="obsoletefiles_test"}
|
||||
|
||||
include('find_pkg_orphans/Kyuafile')
|
||||
include('pkgdb/Kyuafile')
|
||||
|
@@ -2,7 +2,7 @@ TOPDIR = ../../../..
|
||||
-include $(TOPDIR)/config.mk
|
||||
|
||||
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
|
||||
TESTSHELL+= replace_test installmode_test
|
||||
TESTSHELL+= replace_test installmode_test obsoletefiles_test
|
||||
|
||||
include ../Makefile.inc
|
||||
include $(TOPDIR)/mk/test.mk
|
||||
|
55
tests/xbps/libxbps/shell/obsoletefiles_test.sh
Normal file
55
tests/xbps/libxbps/shell/obsoletefiles_test.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#! /usr/bin/env atf-sh
|
||||
|
||||
# 1- find obsolete files on reinstall (and downgrades).
|
||||
atf_test_case reinstall_obsoletes
|
||||
|
||||
reinstall_obsoletes_update_head() {
|
||||
atf_set "descr" "Test that obsolete files are removed on reinstall"
|
||||
}
|
||||
|
||||
reinstall_obsoletes_body() {
|
||||
#
|
||||
# Simulate a pkg downgrade and make sure that obsolete files
|
||||
# are found and removed properly.
|
||||
#
|
||||
mkdir some_repo
|
||||
mkdir -p pkg_A/usr/bin pkg_B/usr/sbin
|
||||
touch -f pkg_A/usr/bin/foo pkg_A/usr/bin/blah
|
||||
touch -f pkg_B/usr/sbin/baz
|
||||
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n A-1.1_1 -s "foo 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-1.1_1
|
||||
atf_check_equal $? 0
|
||||
|
||||
rm -f some_repo/*
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n A-1.0_1 -s "foo pkg" ../pkg_B
|
||||
atf_check_equal $? 0
|
||||
xbps-rindex -a *.xbps
|
||||
atf_check_equal $? 0
|
||||
|
||||
cd ..
|
||||
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yvf A-1.0_1
|
||||
atf_check_equal $? 0
|
||||
|
||||
rv=0
|
||||
if [ ! -f root/usr/sbin/baz ]; then
|
||||
rv=1
|
||||
fi
|
||||
for f in usr/bin/foo usr/bin/blah; do
|
||||
if [ -f root/$f ]; then
|
||||
rv=1
|
||||
fi
|
||||
done
|
||||
atf_check_equal $rv 0
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case reinstall_obsoletes
|
||||
}
|
Reference in New Issue
Block a user