Skip to content

Commit c137cf0

Browse files
committed
tests: update xbps self-update tests
Integrity checks are no longer bypassed when updating xbps, and the error has been downgraded to a warning.
1 parent 45f0e0f commit c137cf0

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

tests/xbps/libxbps/shell/install_test.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,7 @@ update_xbps_body() {
484484
cd ..
485485
xbps-rindex -d -a repo/*.xbps
486486
atf_check_equal $? 0
487-
out=$(xbps-install -r root --repository=repo -yun)
488-
set -- $out
489-
exp="$1 $2 $3 $4"
490-
atf_check_equal "$exp" "xbps-1.1_1 update noarch $(readlink -f repo)"
487+
atf_check -s exit:0 -o ignore -e match:"^WARNING: The 'xbps-1\.0_1' package is out of date, 'xbps-1\.1_1' is available\.$" -- xbps-install -r root --repository=repo -yn B
491488

492489
xbps-install -r root --repository=repo -yu xbps
493490
atf_check_equal $? 0
@@ -537,10 +534,7 @@ update_xbps_virtual_body() {
537534
cd ..
538535
xbps-rindex -d -a repo/*.xbps
539536
atf_check_equal $? 0
540-
out=$(xbps-install -r root --repository=repo -yun)
541-
set -- $out
542-
exp="$1 $2 $3 $4"
543-
atf_check_equal "$exp" "xbps-git-1.1_1 update noarch $(readlink -f repo)"
537+
atf_check -s exit:0 -o ignore -e match:"^WARNING: The 'xbps-git-1\.0_1' package is out of date, 'xbps-git-1\.1_1' is available\.$" -- xbps-install -r root --repository=repo -yn B
544538

545539
xbps-install -r root --repository=repo -yu xbps
546540
atf_check_equal $? 0

tests/xbps/libxbps/shell/update_itself_test.sh

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ update_xbps_head() {
77
}
88

99
update_xbps_body() {
10-
mkdir -p repo xbps
10+
mkdir -p repo xbps bar
1111
touch xbps/foo
12+
touch bar/bar
1213

1314
cd repo
1415
xbps-create -A noarch -n xbps-1.0_1 -s "xbps pkg" ../xbps
1516
atf_check_equal $? 0
17+
xbps-create -A noarch -n bar-1.0_1 -s "bar pkg" ../bar
18+
atf_check_equal $? 0
1619
xbps-rindex -d -a $PWD/*.xbps
1720
atf_check_equal $? 0
1821
cd ..
1922

20-
xbps-install -r root --repository=$PWD/repo -yd xbps
23+
xbps-install -r root --repository=$PWD/repo -yd xbps bar
2124
atf_check_equal $? 0
2225

2326
out=$(xbps-query -r root -p pkgver xbps)
@@ -26,13 +29,17 @@ update_xbps_body() {
2629
cd repo
2730
xbps-create -A noarch -n xbps-1.1_1 -s "xbps pkg" ../xbps
2831
atf_check_equal $? 0
29-
xbps-rindex -d -a $PWD/xbps-1.1_1.noarch.xbps
32+
xbps-create -A noarch -n bar-1.1_1 -s "bar pkg" ../bar
33+
atf_check_equal $? 0
34+
xbps-rindex -d -a $PWD/*.xbps
3035
atf_check_equal $? 0
3136
cd ..
3237

33-
# EBUSY
34-
xbps-install -r root --repository=$PWD/repo -yud
35-
atf_check_equal $? 16
38+
# Ensure warning is printed
39+
atf_check -s exit:0 -o ignore -e match:"^WARNING: The 'xbps-1\.0_1' package is out of date, 'xbps-1\.1_1' is available\.$" -- xbps-install -r root --repository=$PWD/repo -yd bar
40+
41+
out=$(xbps-query -r root -p pkgver bar)
42+
atf_check_equal $out bar-1.1_1
3643

3744
out=$(xbps-query -r root -p pkgver xbps)
3845
atf_check_equal $out xbps-1.0_1
@@ -51,8 +58,8 @@ update_xbps_with_revdeps_head() {
5158
}
5259

5360
update_xbps_with_revdeps_body() {
54-
mkdir -p repo xbps xbps-dbg baz
55-
touch xbps/foo xbps-dbg/bar baz/blah
61+
mkdir -p repo xbps xbps-dbg bar baz
62+
touch xbps/foo xbps-dbg/bar bar/sailor baz/blah
5663

5764
cd repo
5865
xbps-create -A noarch -n xbps-1.0_1 -s "xbps pkg" ../xbps
@@ -67,6 +74,8 @@ update_xbps_with_revdeps_body() {
6774
cd repo
6875
xbps-create -A noarch -n baz-1.0_1 -s "baz pkg" ../baz
6976
atf_check_equal $? 0
77+
xbps-create -A noarch -n bar-1.0_1 -s "bar pkg" ../bar
78+
atf_check_equal $? 0
7079
xbps-create -A noarch -n xbps-dbg-1.0_1 -s "xbps-dbg pkg" --dependencies "xbps-1.0_1" ../xbps-dbg
7180
atf_check_equal $? 0
7281
xbps-rindex -d -a $PWD/*.xbps
@@ -87,12 +96,11 @@ update_xbps_with_revdeps_body() {
8796
atf_check_equal $? 0
8897
cd ..
8998

90-
# first time, xbps must be updated (returns EBUSY)
91-
xbps-install -r root --repository=$PWD/repo -yud
92-
atf_check_equal $? 16
99+
# first time, warning must be printed
100+
atf_check -s exit:0 -o ignore -e match:"^WARNING: The 'xbps-1\.0_1' package is out of date, 'xbps-1\.1_1' is available\.$" -- xbps-install -r root --repository=$PWD/repo -yd bar
93101

94-
xbps-install -r root --repository=$PWD/repo -yu xbps
95-
atf_check_equal $? 0
102+
# don't print warning while updating xbps
103+
atf_check -s exit:0 -o ignore -e not-match:"^WARNING: The 'xbps-1\.0_1' package is out of date, 'xbps-1\.1_1' is available\.$" -- xbps-install -r root --repository=$PWD/repo -yu xbps
96104

97105
out=$(xbps-query -r root -p pkgver xbps)
98106
atf_check_equal $out xbps-1.1_1
@@ -152,11 +160,8 @@ update_xbps_with_uptodate_revdeps_body() {
152160
atf_check_equal $? 0
153161
cd ..
154162

155-
xbps-install -r root --repository=$PWD/repo -yud
156-
atf_check_equal $? 16
157-
158-
xbps-install -r root --repository=$PWD/repo -yu xbps
159-
atf_check_equal $? 0
163+
# don't print warning while updating xbps
164+
atf_check -s exit:0 -o ignore -e not-match:"^WARNING: The 'xbps-1\.0_1' package is out of date, 'xbps-1\.1_1' is available\.$" -- xbps-install -r root --repository=$PWD/repo -yu xbps
160165

161166
out=$(xbps-query -r root -p pkgver xbps)
162167
atf_check_equal $out xbps-1.1_1
@@ -174,6 +179,8 @@ update_xbps_with_indirect_revdeps_head() {
174179
update_xbps_with_indirect_revdeps_body() {
175180
mkdir -p repo pkg
176181

182+
atf_expect_fail "Integrity checks are no longer bypassed for xbps self-update: https://github.com/void-linux/xbps/pull/597"
183+
177184
cd repo
178185
xbps-create -A noarch -n xbps-1.0_1 -s "xbps pkg" --dependencies "libcrypto-1.0_1 cacerts>=0" ../pkg
179186
atf_check_equal $? 0

0 commit comments

Comments
 (0)