File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,3 +30,4 @@ atf_test_program{name="orphans_test"}
3030atf_test_program{name="noextract_files_test"}
3131atf_test_program{name="transaction_check_revdeps_test"}
3232atf_test_program{name="repo_test"}
33+ atf_test_program{name="hooks_test"}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ TESTSHELL+= update_shlibs_test update_hold_test update_repolock_test
1010TESTSHELL+ = cyclic_deps_test conflicts_test update_itself_test
1111TESTSHELL+ = hold_test ignore_test preserve_test repo_test
1212TESTSHELL+ = noextract_files_test orphans_test transaction_check_revdeps_test
13+ TESTSHELL+ = hooks_test
1314EXTRA_FILES = Kyuafile
1415
1516include $(TOPDIR ) /mk/test.mk
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env atf-sh
2+
3+ atf_test_case hooks_basic
4+
5+ hooks_basic_head () {
6+ atf_set " descr" " Tests for basic hooks"
7+ }
8+
9+ hooks_basic_body () {
10+ mkdir -p repo pkg_A root/etc/xbps.d/hooks
11+
12+ cat << -EOF > root/etc/xbps.d/hooks/00-pre-hook.hook
13+ [Hook]
14+ When = PreTransaction
15+ Exec = sh -c echo\ pre-hook\ >&2
16+
17+ [Match]
18+ Action = Install
19+ Package = A
20+ EOF
21+
22+ cat << -EOF > root/etc/xbps.d/hooks/00-post-hook.hook
23+ [Hook]
24+ When = PostTransaction
25+ Exec = sh -c echo\ post-hook\ >&2
26+
27+ [Match]
28+ Action = Install
29+ Package = A
30+ EOF
31+
32+ cd repo
33+ atf_check -o ignore -- xbps-create -A noarch -n A-1.0_1 -s " A pkg" ../pkg_A
34+ atf_check -o ignore -- xbps-rindex -a $PWD /* .xbps
35+ cd ..
36+ atf_check \
37+ -o ignore \
38+ -e match:pre-hook \
39+ -e match:post-hook \
40+ -- xbps-install -r root --repository=repo -y A
41+ }
42+
43+ atf_init_test_cases () {
44+ atf_add_test_case hooks_basic
45+ }
You can’t perform that action at this time.
0 commit comments