-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprovreq.bats
139 lines (121 loc) · 3.35 KB
/
provreq.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bats
#
# Test PROVIDES/REQUIRES.
#
SUITE="provreq"
load common
setup_file()
{
BUILD_DATE="1970-01-01 01:01:01 +0000"
create_pkg_buildinfo "preserve-1.0" \
"BUILD_DATE=${BUILD_DATE}" \
"CATEGORIES=provreq" \
"PKGPATH=provreq/preserve"
create_pkg_comment "preserve-1.0" "Package should remain at all times"
create_pkg_file "preserve-1.0" "share/doc/preserve"
create_pkg_preserve "preserve-1.0"
create_pkg "preserve-1.0"
create_pkg_buildinfo "provides-1.0" \
"BUILD_DATE=${BUILD_DATE}" \
"CATEGORIES=provreq" \
"PKGPATH=provreq/provides" \
"PROVIDES=${LOCALBASE}/lib/libprovides.so"
create_pkg_comment "provides-1.0" "Package provides libprovides.so"
create_pkg_file "provides-1.0" "lib/libprovides.so"
create_pkg "provides-1.0"
create_pkg_buildinfo "requires-1.0" \
"BUILD_DATE=${BUILD_DATE}" \
"CATEGORIES=provreq" \
"PKGPATH=provreq/requires" \
"REQUIRES=${LOCALBASE}/lib/libprovides.so"
create_pkg_comment "requires-1.0" "Package requires libprovides.so"
create_pkg_file "requires-1.0" "share/doc/requires"
create_pkg "requires-1.0"
create_pkg_summary
start_httpd
}
teardown_file()
{
stop_httpd
}
@test "${SUITE} perform initial pkgin setup" {
export PKG_PATH=${PACKAGES}/All
run pkg_add preserve
[ ${status} -eq 0 ]
run pkgin -fy update
[ ${status} -eq 0 ]
}
@test "${SUITE} attempt to install missing REQUIRES package" {
run pkgin -y install requires
[ ${status} -eq 0 ]
output_match "libprovides.so, needed by requires-1.0 is not present"
run pkg_info -qe requires
[ ${status} -eq 1 ]
}
@test "${SUITE} install PROVIDES package" {
run pkgin -y install provides
[ ${status} -eq 0 ]
}
@test "${SUITE} install REQUIRES package" {
run pkgin -y install requires
[ ${status} -eq 0 ]
}
@test "${SUITE} verify show-* commands" {
for cmd in provides prov; do
run pkgin ${cmd} provides
[ ${status} -eq 0 ]
line_match 1 "libprovides.so"
done
for cmd in requires req; do
run pkgin ${cmd} requires
[ ${status} -eq 0 ]
line_match 1 "libprovides.so"
done
}
#
# Verify the database entries have been loaded, this is useful when developing
# the pkgin parser to ensure they are correctly registered.
#
@test "${SUITE} verify local_provides table" {
if [ ${PKGIN_VERSION} -le 221000 ]; then
colname="local_provides_pkgname"
else
colname="filename"
fi
run pkgdbsql "SELECT DISTINCT ${colname} FROM local_provides;"
[ ${status} -eq 0 ]
line_match 0 "libprovides.so"
}
@test "${SUITE} verify remote_provides table" {
if [ ${PKGIN_VERSION} -le 221000 ]; then
colname="remote_provides_pkgname"
else
colname="filename"
fi
run pkgdbsql "SELECT DISTINCT ${colname} FROM remote_provides;"
[ ${status} -eq 0 ]
line_match 0 "libprovides.so"
}
@test "${SUITE} verify local_requires table" {
if [ ${PKGIN_VERSION} -le 221000 ]; then
colname="local_requires_pkgname"
else
colname="filename"
fi
run pkgdbsql "SELECT DISTINCT ${colname} FROM local_requires;"
[ ${status} -eq 0 ]
line_match 0 "libprovides.so"
}
@test "${SUITE} verify remote_requires table" {
if [ ${PKGIN_VERSION} -le 221000 ]; then
colname="remote_requires_pkgname"
else
colname="filename"
fi
run pkgdbsql "SELECT DISTINCT ${colname} FROM remote_requires;"
[ ${status} -eq 0 ]
line_match 0 "libprovides.so"
}
@test "${SUITE} verify pkg_info" {
compare_pkg_info "pkg_info.final"
}