Skip to content

Commit 790e475

Browse files
committed
tests: another config file test case
1 parent 7753695 commit 790e475

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/xbps/libxbps/shell/conf_files_test.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,37 @@ tc10_body() {
456456
atf_check_equal $? 0
457457
}
458458

459+
# 11th test: update adds a new config file and it exist untracked on disk
460+
# result: backup new file
461+
atf_test_case tc11
462+
463+
tc11_head() {
464+
atf_set "descr" "Tests for configuration file handling: update adds new conf file that previously untracked"
465+
}
466+
467+
tc11_body() {
468+
mkdir repo pkg_a
469+
470+
cd repo
471+
atf_check -o ignore -- xbps-create -A noarch -n a-0.1_1 -s "pkg a" --config-files "/cf1.conf" ../pkg_a
472+
atf_check -o ignore -- xbps-rindex -a $PWD/*.xbps
473+
cd ..
474+
475+
atf_check -o ignore -- xbps-install -C xbps.d -r rootdir --repository=$PWD/repo -yv a
476+
477+
echo "userdata" >rootdir/cf1.conf
478+
479+
cd repo
480+
echo "backup" > ../pkg_a/cf1.conf
481+
atf_check -o ignore -- xbps-create -A noarch -n a-0.2_1 -s "pkg a" --config-files "/cf1.conf" ../pkg_a
482+
atf_check -o ignore -e ignore -- xbps-rindex -a $PWD/*.xbps
483+
cd ..
484+
485+
atf_check -o ignore -- xbps-install -C xbps.d -r rootdir --repository=$PWD/repo -yuv
486+
atf_check -o inline:"userdata\n" -- cat rootdir/cf1.conf
487+
atf_check -o inline:"backup\n" -- cat rootdir/cf1.conf.new-0.2_1
488+
}
489+
459490
# 1st link test: modified configuration link on disk, unmodified on upgrade.
460491
# result: keep link as is on disk.
461492
atf_test_case tcl1
@@ -849,6 +880,7 @@ atf_init_test_cases() {
849880
atf_add_test_case tc8
850881
atf_add_test_case tc9
851882
atf_add_test_case tc10
883+
atf_add_test_case tc11
852884

853885
atf_add_test_case tcl1
854886
atf_add_test_case tcl2

0 commit comments

Comments
 (0)