Skip to content

Commit

Permalink
tests: add tests for install and remove messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Sep 17, 2023
1 parent 76deefc commit aa0132c
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/xbps/xbps-install/behaviour_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,67 @@ reproducible_body() {
atf_check_equal $? 1
}

atf_test_case install_msg

install_msg_head() {
atf_set "descr" "xbps-install(1): show install message"
}

install_msg_body() {
mkdir -p some_repo pkg_A

# install will now show the message
cat <<-EOF >pkg_A/INSTALL.msg
foobar-install-msg
EOF
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..

atf_check -s exit:0 \
-o 'match:foobar-install-msg' \
-e ignore \
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A

# update with the same message will not show the message
cd some_repo
xbps-create -A noarch -n A-1.0_2 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..

atf_check -s exit:0 \
-o 'not-match:foobar-install-msg' \
-e ignore \
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yu

# update with new message will show the message
cat <<-EOF >pkg_A/INSTALL.msg
fizzbuzz-install-msg
EOF
cd some_repo
xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..

atf_check -s exit:0 \
-o 'match:fizzbuzz-install-msg' \
-e ignore \
-- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yu
}

atf_init_test_cases() {
atf_add_test_case install_existent
atf_add_test_case update_existent
atf_add_test_case update_unpacked
atf_add_test_case unpacked_dep
atf_add_test_case reinstall_unpacked_unpack_only
atf_add_test_case reproducible
atf_add_test_case install_msg
}
29 changes: 29 additions & 0 deletions tests/xbps/xbps-remove/basic_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,40 @@ clean_cache_uninstalled_body() {
atf_check_equal $? 0
}

atf_test_case remove_msg

remove_msg_head() {
atf_set "descr" "xbps-rmeove(1): show remove message"
}

remove_msg_body() {
mkdir -p some_repo pkg_A

cat <<-EOF >pkg_A/REMOVE.msg
foobar-remove-msg
EOF
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..

xbps-install -r root -C empty.conf -R some_repo -dvy A
atf_check_equal $? 0

atf_check -s exit:0 \
-o 'match:foobar-remove-msg' \
-e ignore \
-- xbps-remove -r root -C empty.conf -y A
}

atf_init_test_cases() {
atf_add_test_case remove_directory
atf_add_test_case remove_orphans
atf_add_test_case clean_cache
atf_add_test_case clean_cache_dry_run
atf_add_test_case clean_cache_dry_run_perm
atf_add_test_case clean_cache_uninstalled
atf_add_test_case remove_msg
}

0 comments on commit aa0132c

Please sign in to comment.