Skip to content

Commit f07d967

Browse files
committed
tests: move the repository stage into the repodata file
1 parent 806d80a commit f07d967

File tree

3 files changed

+31
-43
lines changed

3 files changed

+31
-43
lines changed

tests/xbps/xbps-rindex/add_test.sh

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,13 @@ revert_body() {
4242
mkdir -p some_repo pkg_A
4343
touch pkg_A/file00
4444
cd some_repo
45-
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" ../pkg_A
46-
atf_check_equal $? 0
47-
xbps-rindex -d -a $PWD/*.xbps
48-
atf_check_equal $? 0
49-
xbps-create -A noarch -n foo-1.0_1 -r "1.1_1" -s "foo pkg" ../pkg_A
50-
atf_check_equal $? 0
51-
xbps-rindex -d -a $PWD/*.xbps
52-
atf_check_equal $? 0
45+
atf_check -o ignore -e ignore -- xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" ../pkg_A
46+
atf_check -o ignore -e ignore -- xbps-rindex -d -a $PWD/*.xbps
47+
atf_check -o ignore -e ignore -- xbps-create -A noarch -n foo-1.0_1 -r "1.1_1" -s "foo pkg" ../pkg_A
48+
atf_check -o ignore -e ignore -- xbps-rindex -d -a $PWD/*.xbps
5349
cd ..
54-
result="$(xbps-query -r root -C empty.conf --repository=some_repo -s '')"
55-
expected="[-] foo-1.0_1 foo pkg"
56-
rv=0
57-
if [ "$result" != "$expected" ]; then
58-
echo "result: $result"
59-
echo "expected: $expected"
60-
rv=1
61-
fi
62-
atf_check_equal $rv 0
50+
atf_check -o "inline:[-] foo-1.0_1 foo pkg\n" -e empty -- \
51+
xbps-query -r root -C empty.conf --repository=some_repo -Rs ''
6352
}
6453

6554
atf_test_case stage
@@ -76,36 +65,36 @@ stage_body() {
7665
atf_check_equal $? 0
7766
xbps-rindex -d -a $PWD/*.xbps
7867
atf_check_equal $? 0
79-
[ -f *-stagedata ]
80-
atf_check_equal $? 1
68+
atf_check -o inline:" 1 $PWD (RSA unsigned)\n" -- \
69+
xbps-query -r ../root -i --repository=$PWD -L
8170

8271
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "libfoo.so.2" ../pkg_A
8372
atf_check_equal $? 0
8473
xbps-rindex -d -a $PWD/*.xbps
8574
atf_check_equal $? 0
86-
[ -f *-stagedata ]
87-
atf_check_equal $? 1
75+
atf_check -o inline:" 1 $PWD (RSA unsigned)\n" -- \
76+
xbps-query -r ../root -i --repository=$PWD -L
8877

8978
xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "libfoo.so.2" ../pkg_B
9079
atf_check_equal $? 0
9180
xbps-rindex -d -a $PWD/*.xbps
9281
atf_check_equal $? 0
93-
[ -f *-stagedata ]
94-
atf_check_equal $? 1
82+
atf_check -o inline:" 2 $PWD (RSA unsigned)\n" -- \
83+
xbps-query -r ../root -i --repository=$PWD -L
9584

9685
xbps-create -A noarch -n foo-1.2_1 -s "foo pkg" --shlib-provides "libfoo.so.3" ../pkg_A
9786
atf_check_equal $? 0
9887
xbps-rindex -d -a $PWD/*.xbps
9988
atf_check_equal $? 0
100-
[ -f *-stagedata ]
101-
atf_check_equal $? 0
89+
atf_check -o inline:" 2 $PWD (Staged) (RSA unsigned)\n" -- \
90+
xbps-query -r ../root -i --repository=$PWD -L
10291

10392
xbps-create -A noarch -n bar-1.1_1 -s "foo pkg" --shlib-requires "libfoo.so.3" ../pkg_A
10493
atf_check_equal $? 0
10594
xbps-rindex -d -a $PWD/*.xbps
10695
atf_check_equal $? 0
107-
[ -f *-stagedata ]
108-
atf_check_equal $? 1
96+
atf_check -o inline:" 2 $PWD (RSA unsigned)\n" -- \
97+
xbps-query -r ../root -i --repository=$PWD -L
10998
}
11099

111100
atf_test_case stage_resolve_bug
@@ -136,25 +125,25 @@ stage_resolve_bug_body() {
136125
atf_check_equal $? 0
137126
xbps-rindex -d -a $PWD/*.xbps
138127
atf_check_equal $? 0
139-
[ -f *-stagedata ]
140-
atf_check_equal $? 1
128+
atf_check -o inline:" 4 $PWD (RSA unsigned)\n" -- \
129+
xbps-query -r ../root -i --repository=$PWD -L
141130

142131
# trigger staging
143132
xbps-create -A noarch -n provider-1.0_2 -s "foo pkg" --shlib-provides "libfoo.so.1" ../provider
144133
atf_check_equal $? 0
145134
xbps-rindex -d -a $PWD/*.xbps
146135
atf_check_equal $? 0
147-
[ -f *-stagedata ]
148-
atf_check_equal $? 0
136+
atf_check -o inline:" 4 $PWD (Staged) (RSA unsigned)\n" -- \
137+
xbps-query -r ../root -i --repository=$PWD -L
149138

150139
# then add a new provider not containing the provides field. This resulted in
151140
# a stage state despites the library is resolved through libprovides
152141
xbps-create -A noarch -n provider-1.0_3 -s "foo pkg" ../provider
153142
atf_check_equal $? 0
154143
xbps-rindex -d -a $PWD/*.xbps
155144
atf_check_equal $? 0
156-
[ -f *-stagedata ]
157-
atf_check_equal $? 0
145+
atf_check -o inline:" 4 $PWD (Staged) (RSA unsigned)\n" -- \
146+
xbps-query -r ../root -i --repository=$PWD -L
158147

159148
# resolve staging
160149
# the actual bug appeared here: libfoo.so.1 is still provided by libprovider, but
@@ -163,8 +152,8 @@ stage_resolve_bug_body() {
163152
atf_check_equal $? 0
164153
xbps-rindex -d -a $PWD/*.xbps
165154
atf_check_equal $? 0
166-
[ -f *-stagedata ]
167-
atf_check_equal $? 1
155+
atf_check -o inline:" 4 $PWD (RSA unsigned)\n" -- \
156+
xbps-query -r ../root -i --repository=$PWD -L
168157
}
169158

170159
atf_init_test_cases() {

tests/xbps/xbps-rindex/clean_test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ remove_from_stage_body() {
6969
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "foo.so.2" ../pkg_A
7070
atf_check_equal $? 0
7171
xbps-rindex -d -a $PWD/*.xbps
72-
atf_check_equal $? 0
73-
[ -f *-stagedata ]
72+
atf_check -o inline:" 2 $PWD (Staged) (RSA unsigned)\n" -- \
73+
xbps-query -r ../root -i --repository=$PWD -L
7474
atf_check_equal $? 0
7575
rm foo-1.1_1*
76+
xbps-rindex -c .
77+
atf_check -o inline:" 1 $PWD (RSA unsigned)\n" -- \
78+
xbps-query -r ../root -i --repository=$PWD -L
7679
cd ..
77-
xbps-rindex -c some_repo
78-
[ -f *-stagedata ]
79-
atf_check_equal $? 1
8080
}
8181

8282
atf_init_test_cases() {

tests/xbps/xbps-rindex/remove_test.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ noremove_stage_body() {
2121
atf_check_equal $? 0
2222
xbps-rindex -d -a $PWD/*.xbps
2323
atf_check_equal $? 0
24-
[ -f *-stagedata ]
25-
atf_check_equal $? 0
24+
atf_check -o inline:" 2 $PWD (Staged) (RSA unsigned)\n" -- \
25+
xbps-query -r ../root -i --repository=$PWD -L
2626
xbps-rindex -r some_repo
2727
atf_check_equal $? 0
28-
cd some_repo
2928
[ -f foo-1.0_1* ]
3029
atf_check_equal $? 0
3130
[ -f foo-1.1_1* ]

0 commit comments

Comments
 (0)