summaryrefslogtreecommitdiff
path: root/yarns/create-deploy.yarn
blob: 6b15eefaf16150be07b8a1d53abb3ddd04824a93 (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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
Trebuchet tests for the creating and deploying of binary deltas
===============================================================

The following scenarios test tbdiff-deploy's ability to correctly transform
the content of a target directory, to that of a source directory, given an
appropriate binary delta created by tbdiff-create.


Changing of a file's contents
-----------------------------

The simple tests that follow check that file contents is as expected; if the
contents of the given files are different, the test will fail.


    SCENARIO Changing the contents of a regular file works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' containing '1' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' containing '2' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the files 'A_dir/foo_file' and 'B_dir/foo_file' have the same contents


    SCENARIO Changing the contents of a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir/1_dir'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND a regular file called 'bar_file' in directory 'B_dir/1_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directories 'A_dir/1_dir' and 'B_dir/1_dir' have the same contents


Changing of a file's ownership
------------------------------

Trebuchet also takes into account POSIX metadata such as ownership, these
scenarios are written to test that functionality.


    SCENARIO Changing the group that owns a regular file works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' in directory 'B_dir'
    AND the file 'B_dir/foo_file' is owned by the group '893'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the file 'A_dir/foo_file' is owned by the group '893'


    SCENARIO Changing the group that owns a named pipe works
    GIVEN a directory called 'A_dir'
    AND a named pipe called 'foo_pipe' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a named pipe called 'foo_pipe' in directory 'B_dir'
    AND the named pipe 'B_dir/foo_pipe' is owned by the group '594'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the named pipe 'A_dir/foo_pipe' is owned by the group '594'


    SCENARIO Changing the group that owns a symbolic link works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'A_dir/foo_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' in directory 'B_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'B_dir/foo_file' in directory 'B_dir'
    AND the symbolic link 'B_dir/link_to_foo_file' is owned by the group '608'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the symbolic link 'A_dir/link_to_foo_file' is owned by the group '608'


    SCENARIO Changing the group that owns a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND the directory 'B_dir/1_dir' is owned by the group '675'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directory 'A_dir/1_dir' is owned by the group '675'


Changing of a file's permissions
--------------------------------

These scenarios test that file permissions are correctly changed upon the
deployment of a binary delta.


    SCENARIO Changing the permissions of a regular file works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' in directory 'B_dir'
    AND the file 'B_dir/foo_file' has its permissions set to 'ugo=rw'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the file 'A_dir/foo_file' has the permissions '-rw-rw-rw-'


    SCENARIO Changing the permissions of a named pipe works
    GIVEN a directory called 'A_dir'
    AND a named pipe called 'foo_pipe' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a named pipe called 'foo_pipe' in directory 'B_dir'
    AND the named pipe 'B_dir/foo_pipe' has its permissions set to 'ug=rw,o=r'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the named pipe 'A_dir/foo_pipe' has the permissions 'prw-rw-r--'


    SCENARIO Changing the permissions of a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND the directory 'B_dir/1_dir' has its permissions set to 'g=,uo=rwx'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directory 'A_dir/1_dir' has the permissions 'drwx---rwx'


Adding and removing of files
----------------------------

The following scenarios check that the deployment of a binary delta
successfully removes and creates the appropriate files.


    SCENARIO Adding and removing of regular files works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'minus_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'plus_file' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the file 'A_dir/minus_file' no longer exists
    AND the directory 'A_dir' contains the regular file 'plus_file'


    SCENARIO Adding and removing of named pipes works
    GIVEN a directory called 'A_dir'
    AND a named pipe called 'minus_pipe' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a named pipe called 'plus_pipe' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the named pipe 'A_dir/minus_pipe' no longer exists
    AND the directory 'A_dir' contains the named pipe 'plus_pipe'


    SCENARIO Adding and removing of symbolic links works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'minus_file' in directory 'A_dir'
    AND a symbolic link called 'link_to_minus_file' referring to 'A_dir/minus_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'plus_file' in directory 'B_dir'
    AND a symbolic link called 'link_to_plus_file' referring to 'B_dir/plus_file' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the symbolic link 'A_dir/link_to_minus_file' no longer exists
    AND the directory 'A_dir' contains the symbolic link 'link_to_plus_file'


    SCENARIO Adding and removing of directories works
    GIVEN a directory called 'A_dir'
    AND a directory called 'minus_dir' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a directory called 'plus_dir' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directory 'A_dir/minus_dir' no longer exists
    AND the directory 'A_dir' contains the directory 'plus_dir'


    SCENARIO Adding and removing of character devices works
    GIVEN a directory called 'A_dir'
    AND a character device called 'minus_chardev' with major number '1' and minor number '3' in directory 'A_dir' 
    AND a directory called 'B_dir'
    AND a character device called 'plus_chardev' with major number '1' and minor number '3' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the character device 'A_dir/minus_chardev' no longer exists
    AND the directory 'A_dir' contains the character device 'plus_chardev'


    SCENARIO Adding and removing of block devices works
    GIVEN a directory called 'A_dir'
    AND a block device called 'minus_blockdev' with major number '1' and minor number '3' in directory 'A_dir' 
    AND a directory called 'B_dir'
    AND a block device called 'plus_blockdev' with major number '1' and minor number '3' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the block device 'A_dir/minus_blockdev' no longer exists
    AND the directory 'A_dir' contains the block device 'plus_blockdev'


Changing modification time of a file
------------------------------------

In the following scenarios we check that modification times are correctly
changed, if modification times are not identical, the test fails.


    SCENARIO Changing the modification time of a regular file works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' containing '1' in directory 'A_dir'
    AND the file 'A_dir/foo_file' has its modification time set to '1381758015'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' containing '2' in directory 'B_dir'
    AND the file 'B_dir/foo_file' has its modification time set to '683074800'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the files 'A_dir/foo_file' and 'B_dir/foo_file' have the same modification time


    SCENARIO Changing the modification time of a named pipe works
    GIVEN a directory called 'A_dir'
    AND a named pipe called 'foo_pipe' in directory 'A_dir'
    AND the named pipe 'A_dir/foo_pipe' has its modification time set to '1381758015'
    AND a directory called 'B_dir'
    AND a named pipe called 'foo_pipe' in directory 'B_dir'
    AND the named pipe 'B_dir/foo_pipe' has its modification time set to '683074800'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the named pipes 'A_dir/foo_pipe' and 'B_dir/foo_pipe' have the same modification time


    SCENARIO Changing the modification time of a symbolic link works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'A_dir/foo_file' in directory 'A_dir'
    AND the symbolic link 'A_dir/link_to_foo_file' has its modification time set to '1381758015'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' in directory 'B_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'B_dir/foo_file' in directory 'B_dir'
    AND the symbolic link 'B_dir/link_to_foo_file' has its modification time set to '683074800'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the symbolic links 'A_dir/link_to_foo_file' and 'B_dir/link_to_foo_file' have the same modification time


    SCENARIO Changing the modification time of a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND the directory 'A_dir/1_dir' has its modification time set to '1381758015'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND the directory 'B_dir/1_dir' has its modification time set to '683074800'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directories 'A_dir/1_dir' and 'B_dir/1_dir' have the same modification time


Changing what a symbolic link refers to
---------------------------------------

Here we check that referenced files of symbolic links are correctly transformed.


    SCENARIO Changing what a symbolic link refers to works
    GIVEN a directory called 'A_dir'
    AND a regular file called 'foo_file' in directory 'A_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'A_dir/foo_file' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a regular file called 'foo_file' in directory 'B_dir'
    AND a symbolic link called 'link_to_foo_file' referring to 'B_dir/foo_file' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the symbolic links 'A_dir/link_to_foo_file' and 'B_dir/link_to_foo_file' refer to the same thing


Setting special file permissions for directories
------------------------------------------------

This scenario checks that the sticky bit of a directory has been changed
appropriately upon the deployment of a binary delta.


    SCENARIO Setting the sticky bit of a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND the directory 'B_dir/1_dir' has its permissions set to '+t'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directory 'A_dir/1_dir' has its sticky bit set


And this scenario checks that the setgid bit of a directory is set accordingly. 


    SCENARIO Setting the setgid bit of a directory works
    GIVEN a directory called 'A_dir'
    AND a directory called '1_dir' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a directory called '1_dir' in directory 'B_dir'
    AND the directory 'B_dir/1_dir' has its permissions set to 'g+s'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the directory 'A_dir/1_dir' has its setgid bit set


Changing the device numbers of special files
--------------------------------------------

These scenarios check that the minor and major device numbers of special files
are appropriately changed when a patch has been generated and deployed. 


    SCENARIO Changing a character special file's device numbers works
    GIVEN a directory called 'A_dir'
    AND a character device called 'foo_chardev' with major number '3' and minor number '9' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a character device called 'foo_chardev' with major number '1' and minor number '3' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the character devices 'A_dir/foo_chardev' and 'B_dir/foo_chardev' have the same device numbers


    SCENARIO Changing a block special file's device numbers works
    GIVEN a directory called 'A_dir'
    AND a block device called 'foo_blockdev' with major number '2' and minor number '7' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a block device called 'foo_blockdev' with major number '1' and minor number '3' in directory 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the block devices 'A_dir/foo_blockdev' and 'B_dir/foo_blockdev' have the same device numbers


Changing, adding and removing of sockets
----------------------------------------

Sockets can only be moved, linked or removed by the file system, creation is
only performed by the program that acts as the server, tbdiff won't be doing
that so the only sensible operation is removal.


    SCENARIO Removing of a socket works
    GIVEN a directory called 'A_dir'
    AND a socket called 'minus_socket' in directory 'A_dir'
    AND a directory called 'B_dir'
    WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir'
    THEN the socket 'A_dir/minus_socket' no longer exists


    SCENARIO Creation of a socket doesn't work
    GIVEN a directory called 'A_dir'
    AND a directory called 'B_dir'
    AND a socket called 'minus_socket' in directory 'B_dir'
    WHEN tbdiff-create attempts to create a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    THEN stderr contains "tbdiff-create cannot create sockets"


    SCENARIO Changing a socket doesn't work
    GIVEN a directory called 'A_dir'
    AND a socket called 'foo_socket' in directory 'A_dir'
    AND a directory called 'B_dir'
    AND a socket called 'foo_socket' in directory 'B_dir'
    WHEN tbdiff-create attempts to create a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff'
    THEN stderr contains "tbdiff-create cannot create sockets"

IMPLEMENTS
==========

Implementations for the creating and deploying of binary deltas
---------------------------------------------------------------


    IMPLEMENTS GIVEN a regular file called '([^']+)' containing '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_3" ] && mkdir -p "$DATADIR/$MATCH_3"
    echo "$MATCH_2" > "$DATADIR/$MATCH_3/$MATCH_1"

    IMPLEMENTS GIVEN a regular file called '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2"
    touch "$DATADIR/$MATCH_2/$MATCH_1"


    IMPLEMENTS GIVEN the (?:file|directory|named pipe|symbolic link) '([^']+)' is owned by the group '([^']+)'
    chgrp -h "$MATCH_2" "$DATADIR/$MATCH_1"


    IMPLEMENTS GIVEN the (?:file|directory|named pipe) '([^']+)' has its permissions set to '([^']+)'
    chmod "$MATCH_2" "$DATADIR/$MATCH_1"


    IMPLEMENTS GIVEN the (?:file|directory|named pipe|symbolic link) '([^']+)' has its modification time set to '([^']+)'
    "$SRCDIR/symtime" "$DATADIR/$MATCH_1" "$MATCH_2"


    IMPLEMENTS GIVEN a named pipe called '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2"
    mkfifo "$DATADIR/$MATCH_2/$MATCH_1"


    IMPLEMENTS GIVEN a symbolic link called '([^']+)' referring to '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_3" ] && mkdir -p "$DATADIR/$MATCH_3"
    ln -s "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3/$MATCH_1"


    IMPLEMENTS GIVEN a directory called '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2"
    mkdir "$DATADIR/$MATCH_2/$MATCH_1"


    IMPLEMENTS GIVEN a (character|block) device called '([^']+)' with major number '([0-9]+)' and minor number '([0-9]+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_5" ] && mkdir -p "$DATADIR/$MATCH_5"
    mknod "$DATADIR/$MATCH_5/$MATCH_2" "$(echo "$MATCH_1" | head -c 1)" "$MATCH_3" "$MATCH_4"


    IMPLEMENTS GIVEN a socket called '([^']+)'(?: in directory '([^']+)')?
    [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2"
    "$SRCDIR/sockbind" "$DATADIR/$MATCH_2/$MATCH_1"

    IMPLEMENTS WHEN tbdiff-create (attempts to create|creates) a binary delta between directories '([^']+)' and '([^']+)', called '([^']+)'
    set "$SRCDIR/tbdiff-create/tbdiff-create" "$DATADIR/$MATCH_4" "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3"
    if [ $MATCH_1 == creates ]; then "$@"
    else
    set +e; "$@" 2> "$DATADIR/stderr"; set -e
    fi


    IMPLEMENTS WHEN tbdiff-deploy applies the delta '([^']+)' to '([^']+)'
    cd "$DATADIR/$MATCH_2"
    "$SRCDIR/tbdiff-deploy/tbdiff-deploy" "$DATADIR/$MATCH_1"


    IMPLEMENTS THEN the (?:files|directories) '([^']+)' and '([^']+)' have the same contents
    diff "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2"


    IMPLEMENTS THEN the (?:file|directory|named pipe|symbolic link) '([^']+)' is owned by the group '([^']+)'
    test "$(stat -c %g "$DATADIR/$MATCH_1")" = "$MATCH_2"


    IMPLEMENTS THEN the (?:file|directory|named pipe) '([^']+)' has the permissions '([^']+)'
    test "$(stat -c %A "$DATADIR/$MATCH_1")" = "$MATCH_2"


    IMPLEMENTS THEN the (?:file|directory|named pipe|symbolic link|(?:character|block) device|socket) '([^']+)' no longer exists
    test ! -e "$DATADIR/$MATCH_1"


    IMPLEMENTS THEN the (?:files|directories|named pipes|symbolic links) '([^']+)' and '([^']+)' have the same modification time
    test "$(stat -c %y "$DATADIR/$MATCH_1")" = "$(stat -c %y "$DATADIR/$MATCH_2")"


    IMPLEMENTS THEN the directory '([^']+)' contains the symbolic link '([^']+)'
    test -h "$DATADIR/$MATCH_1/$MATCH_2"


    IMPLEMENTS THEN the symbolic links '([^']+)' and '([^']+)' refer to the same thing
    test "$(readlink "$DATADIR/$MATCH_1")" = "$(readlink "$DATADIR/$MATCH_2")"


    IMPLEMENTS THEN the directory '([^']+)' has its sticky bit set
    test -k "$DATADIR/$MATCH_1"


    IMPLEMENTS THEN the directory '([^']+)' has its setgid bit set 
    test -g "$DATADIR/$MATCH_1"


    IMPLEMENTS THEN the directory '([^']+)' contains the ((?:character|block) device|named pipe|directory|regular file) '([^']+)'
    test -"$(echo "$MATCH_2" | sed -r 's/(named|regular) //' | head -c 1)" "$DATADIR/$MATCH_1/$MATCH_3"


    IMPLEMENTS THEN the (?:block|character) devices '([^']+)' and '([^']+)' have the same device numbers
    test "$(stat -c '%t %T' "$DATADIR/$MATCH_1")" = "$(stat -c '%t %T' "$DATADIR/$MATCH_2")"


    IMPLEMENTS THEN (\S+) contains "([^"]+)"
    grep "$MATCH_2" "$DATADIR/$MATCH_1"