aboutsummaryrefslogtreecommitdiff
path: root/tests/pkg-verify.testscript
blob: bbe245414fe8903ee4af4de94321a2827c75948b (plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# file      : tests/pkg-verify.testscript
# license   : MIT; see accompanying LICENSE file

.include common.testscript

# Source repository:
#
# pkg-verify
# |-- foo-1.tar.gz
# |-- foo-2.tar.gz         (manifest with unknown name)
# |-- libbaz-1.0.0.tar.gz  (manifest with unsatisfiable toolchain constraint)
# `-- not-a-package.tar.gz

: valid-package
:
$* $src/foo-1.tar.gz 2>'valid package foo 1'

: manifest
:
$* --manifest $src/foo-1.tar.gz >>EOO
  : 1
  name: foo
  version: 1
  summary: The "Foo" utility
  license: MIT
  url: http://www.example.org/foo
  email: foo-users@example.org
  EOO

: no-package
:
$* 2>>EOE != 0
error: archive path argument expected
  info: run 'bpkg help pkg-verify' for more information
EOE

: not-a-package
:
{
  : verbose
  :
  $* $src/not-a-package.tar.gz 2>>/~%EOE% != 0
  %.+
  %error: .+/not-a-package.tar.gz does not appear to be a bpkg package%
  EOE

  : silent
  :
  $* --silent $src/not-a-package.tar.gz != 0
}

: unknown-name
:
: Test that package manifest that contains an unknown name is properly handled.
:
{
  : verbose
  :
  $* $src/foo-2.tar.gz 2>>/~%EOE% != 0
  foo-2/manifest:10:1: error: unknown name 'color' in package manifest
  %  info: package archive .+/foo-2.tar.gz%
  EOE

  : silent
  :
  $* --silent $src/foo-2.tar.gz != 0

  : ignore
  :
  $* --ignore-unknown $src/foo-2.tar.gz 2>'valid package foo 2'
}

: manifest-expand
:
$* --deep --ignore-unknown --manifest $src/foo-2.tar.gz >>EOO
  : 1
  name: foo
  version: 2
  summary: The "Foo" utility
  license: MIT
  description:
  \
  This package contains the foo utility.

  \
  description-type: text/plain
  changes:
  \
  Version 2

    * First public release.

  \
  changes-type: text/plain
  url: http://www.example.org/foo
  email: foo-users@example.org
  depends: bar == 2
  bootstrap-build:
  \
  project = foo

  \
  EOO

: incomplete-dependency
:
$* --ignore-unknown --manifest $src/foo-2.tar.gz >>EOO
  : 1
  name: foo
  version: 2
  summary: The "Foo" utility
  license: MIT
  description-file: README
  changes-file: NEWS
  url: http://www.example.org/foo
  email: foo-users@example.org
  depends: bar == $
  EOO

: no-bootstrap-build
:
{
  : no-deep
  :
  $* --manifest $src/foo-3.tar.gz >>EOO
    : 1
    name: foo
    version: 3
    summary: The "Foo" utility
    license: MIT
    description-file: README
    changes-file: NEWS
    url: http://www.example.org/foo
    email: foo-users@example.org
    depends: bar == $
    EOO

  : deep
  :
  $* --deep --manifest $src/foo-3.tar.gz 2>>/~%EOE% != 0
    %error: unable to find bootstrap.build file in package archive .+/foo-3.tar.gz%
    EOE
}

: compatibility
:
{
  : fail
  :
  $* --manifest $src/libbaz-1.0.0.tar.gz 2>>/~%EOE% != 0
    %error: unable to satisfy constraint \(build2 >= 65536.0.0\) for package .+/libbaz-1.0.0.tar.gz%
    %  info: available build2 version is .+%
    EOE

  : success
  :
  $* --manifest --ignore-unknown $src/libbaz-1.0.0.tar.gz >>EOO
    : 1
    name: libbaz
    version: 1.0.0
    summary: libbaz
    license: MIT
    description: libbaz library
    url: http://example.org
    email: pkg@example.org
    depends: * build2 >= 65536.0.0
    depends: * bpkg >= 65536.0.0
    EOO
}