Skip to content

Commit bbbd792

Browse files
committed
tests: add tests for install and remove messages
1 parent 5df9621 commit bbbd792

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

tests/xbps/xbps-install/behaviour_tests.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,67 @@ reproducible_body() {
175175
atf_check_equal $? 1
176176
}
177177

178+
atf_test_case install_msg
179+
180+
install_msg_head() {
181+
atf_set "descr" "xbps-install(1): show install message"
182+
}
183+
184+
install_msg_body() {
185+
mkdir -p some_repo pkg_A
186+
187+
# install will now show the message
188+
cat <<-EOF >pkg_A/INSTALL.msg
189+
foobar-install-msg
190+
EOF
191+
cd some_repo
192+
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
193+
atf_check_equal $? 0
194+
xbps-rindex -d -a $PWD/*.xbps
195+
atf_check_equal $? 0
196+
cd ..
197+
198+
atf_check -s exit:0 \
199+
-o 'match:foobar-install-msg' \
200+
-e ignore \
201+
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A
202+
203+
# update with the same message will not show the message
204+
cd some_repo
205+
xbps-create -A noarch -n A-1.0_2 -s "A pkg" ../pkg_A
206+
atf_check_equal $? 0
207+
xbps-rindex -d -a $PWD/*.xbps
208+
atf_check_equal $? 0
209+
cd ..
210+
211+
atf_check -s exit:0 \
212+
-o 'not-match:foobar-install-msg' \
213+
-e ignore \
214+
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yu
215+
216+
# update with new message will show the message
217+
cat <<-EOF >pkg_A/INSTALL.msg
218+
fizzbuzz-install-msg
219+
EOF
220+
cd some_repo
221+
xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
222+
atf_check_equal $? 0
223+
xbps-rindex -d -a $PWD/*.xbps
224+
atf_check_equal $? 0
225+
cd ..
226+
227+
atf_check -s exit:0 \
228+
-o 'match:fizzbuzz-install-msg' \
229+
-e ignore \
230+
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yu
231+
}
232+
178233
atf_init_test_cases() {
179234
atf_add_test_case install_existent
180235
atf_add_test_case update_existent
181236
atf_add_test_case update_unpacked
182237
atf_add_test_case unpacked_dep
183238
atf_add_test_case reinstall_unpacked_unpack_only
184239
atf_add_test_case reproducible
240+
atf_add_test_case install_msg
185241
}

tests/xbps/xbps-remove/basic_test.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,40 @@ clean_cache_uninstalled_body() {
176176
atf_check_equal $? 0
177177
}
178178

179+
atf_test_case remove_msg
180+
181+
remove_msg_head() {
182+
atf_set "descr" "xbps-rmeove(1): show remove message"
183+
}
184+
185+
remove_msg_body() {
186+
mkdir -p some_repo pkg_A
187+
188+
cat <<-EOF >pkg_A/REMOVE.msg
189+
foobar-remove-msg
190+
EOF
191+
cd some_repo
192+
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
193+
atf_check_equal $? 0
194+
xbps-rindex -d -a $PWD/*.xbps
195+
atf_check_equal $? 0
196+
cd ..
197+
198+
xbps-install -r root -C empty.conf -R some_repo -dvy A
199+
atf_check_equal $? 0
200+
201+
atf_check -s exit:0 \
202+
-o 'match:foobar-remove-msg' \
203+
-e ignore \
204+
-- xbps-remove -r root -C empty.conf -y A
205+
}
206+
179207
atf_init_test_cases() {
180208
atf_add_test_case remove_directory
181209
atf_add_test_case remove_orphans
182210
atf_add_test_case clean_cache
183211
atf_add_test_case clean_cache_dry_run
184212
atf_add_test_case clean_cache_dry_run_perm
185213
atf_add_test_case clean_cache_uninstalled
214+
atf_add_test_case remove_msg
186215
}

0 commit comments

Comments
 (0)