]> pd.if.org Git - zpackage/blob - t/extract.t
switch to blake2
[zpackage] / t / extract.t
1 #!/bin/sh
2
3 . tap.sh
4
5 plan 6
6
7 PF=test.db
8
9 rm -f $PF test.foo
10 echo foo > test.foo
11
12 zpm init test.db
13 okexit create extract test db
14
15 hash=$(zpm-addfile $PF test.foo 2>> test.out)
16 save=$?
17
18 okexit add foo file content
19 okstreq "$hash" 20590a52c4f00588c500328b16d466c982a26fabaa5fa4dcc83052dd0a84f233 foo hash contents
20
21 rm -f foo
22
23 zpm-extract -f $PF $hash test.foo2
24 okexit extract foo file content
25
26 sha=$(zpm-hash test.foo2)
27 okstreq $hash $sha extracted hash matches
28
29 sha=$(zpm-extract -f $PF $hash - | zpm-hash)
30 okstreq $hash $sha stdout extract hash matches
31
32 finish
33
34 rm -f test.*