blob: 091d2f02fdcbdc71c2e76b04ff7223a289e20d9f (
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
# file : tests/cfg-link.testscript
# license : MIT; see accompanying LICENSE file
.include common.testscript
cfg_create += 2>!
cfg_info += --link
test.arguments += -d cfg
cfg_uuid = '18f48b4b-b5d9-4712-b98c-1930df1c4228'
acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
: success
:
{
$cfg_create -d cfg --name 'main';
$cfg_create -d acfg --name 'shared' --uuid "$acfg_uuid" &acfg/***;
# Try to link self configuration.
#
$* cfg 2>>/~"%EOE%" != 0;
%error: linking configuration .+/cfg/ with itself%
% info: uuid: .{36}%
EOE
# Try to link configuration under the same name.
#
$* acfg --name 'main' 2>>/~"%EOE%" != 0;
%error: linking configuration .+/acfg/ using current configuration name 'main'%
info: consider specifying alternative name with --name
EOE
# Link configuration.
#
$* acfg 2>>/~"%EOE%";
%linked with configuration .+/acfg/%
uuid: $acfg_uuid
type: target
name: shared
id: 1
EOE
$cfg_info -d cfg >>/~"%EOO%";
path: $~/cfg/
%uuid: .{36}%
type: target
name: main
path: $~/acfg/
uuid: $acfg_uuid
type: target
name: shared
EOO
$cfg_info -d cfg2 --backlink >>/"EOO";
path: $~/cfg2/
uuid: $uuid2
type: target
name: shared
# Test that the recreated configuration can be implicitly re-linked.
#
rm -r cfg;
$cfg_create -d cfg --name 'test' --uuid "$cfg_uuid" &cfg/***;
$* acfg 2>>/~"%EOE%";
%warning: current configuration .+/cfg/ is already implicitly linked with .+/acfg/%
%linked with configuration .+/acfg/%
uuid: $acfg_uuid
type: target
name: shared
id: 1
EOE
# Test that the repeated link is reported.
#
$* acfg 2>>/~%EOE% != 0;
%error: configuration with uuid .{36} is already linked as \.\./acfg/%
EOE
# Test that the integrity check fails.
#
mv acfg acfg.tmp;
$cfg_create -d acfg --name 'shared';
$pkg_status -d cfg libfoo 2>>/~"%EOE%" != 0;
error: configuration acfg/ uuid mismatch
% info: uuid .+%
info: linked with cfg/ as $acfg_uuid
EOE
# Test that the path clash is reported.
#
$* acfg 2>>/~%EOE% != 0;
%error: configuration with path .+/acfg/ is already linked%
EOE
# Test that the name clash is reported.
#
$cfg_create -d acfg2 --name 'shared' &acfg2/***;
$* acfg2 --name 'shared' 2>>/EOE != 0;
error: configuration with name shared is already linked as ../acfg/
info: consider specifying alternative name with --name
EOE
# Link the second configuration.
#
$* acfg2 2>>/~%EOE%;
warning: configuration with name shared is already linked as ../acfg/, linking as unnamed
%linked with configuration .+/acfg2/%
% uuid: .{36}%
type: target
id: 2
EOE
# Restore the integrity.
#
$cfg_info -d cfg >- 2>>/~%EOE% != 0;
error: configuration acfg/ uuid mismatch
% info: uuid .{36}%
% info: linked with cfg/ as .{36}%
EOE
rm -r acfg;
mv acfg.tmp acfg;
$cfg_info -d cfg >>/~"%EOO%";
path: $~/cfg/
%uuid: .{36}%
type: target
name: test
path: $~/acfg/
uuid: $acfg_uuid
type: target
name: shared
path: $~/acfg2/
%uuid: .{36}%
type: target
name: shared
EOO
$pkg_status -d cfg libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown';
# Test that the configuration type mismatch is reported.
#
mv cfg cfg.tmp;
$cfg_create -d cfg --type host --uuid "$cfg_uuid";
$* -d acfg2 cfg 2>>/EOE != 0;
error: configuration cfg/ type mismatch
info: type host
info: implicitly linked with acfg2/ as target
EOE
rm -r cfg;
mv cfg.tmp cfg;
# Make the implicit link explicit.
#
$* -d acfg2 cfg 2>>/~"%EOE%";
%linked with configuration .+/cfg/%
uuid: $cfg_uuid
type: target
name: test
id: 1
EOE
$cfg_info -d acfg2 >>/~"%EOO%";
path: $~/acfg2/
%uuid: .{36}%
type: target
name: shared
path: $~/cfg/
%uuid: .{36}%
type: target
name: test
EOO
$pkg_status -d cfg libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown';
$* -d acfg2 cfg 2>>/~%EOE% != 0;
%error: configuration with uuid .{36} is already linked as \.\./cfg/%
EOE
# Test that the implicit link path clash is reported.
#
rm -r cfg;
$cfg_create -d cfg --name 'test' &cfg/***;
$* acfg2 2>>/~%EOE% != 0;
%error: current configuration .+/cfg/ is already linked with .+/acfg2/%
EOE
# Test that the repeated implicit link is reported.
#
$cfg_create -d cfg2 --uuid "$cfg_uuid";
$* -d cfg2 acfg2 2>>/~"%EOE%" != 0;
%error: current configuration $cfg_uuid is already linked with .+/acfg2/%
EOE
# Make sure that current configuration is implicitly linked as unnamed.
#
# @@ Make sure that's really the case when the cfg-list command is
# implemented.
#
rm -r cfg2;
$cfg_create -d cfg2 --name 'test' &cfg2/***;
$* -d cfg2 acfg2 2>>/~%EOE%;
%linked with configuration .+/acfg2/%
% uuid: .{36}%
type: target
name: shared
id: 1
EOE
# Test that the integrity check fails.
#
$pkg_status -d cfg2 libfoo 2>>/~"%EOE%" != 0;
error: configuration cfg/ uuid mismatch
% info: uuid .+%
info: linked with acfg2/ as $cfg_uuid
EOE
rm -r cfg;
$cfg_create -d cfg --name 'test' --uuid "$cfg_uuid" &cfg/***;
$pkg_status -d cfg2 libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown'
}
|