]> pd.if.org Git - zpackage/blob - t/addfile.t
switch to blake2
[zpackage] / t / addfile.t
1 #!/bin/sh
2
3 # test addfile
4
5 . tap.sh
6
7 plan 7
8
9 PF=test.db
10
11 rm -f $PF test.empty
12 touch test.empty
13
14 zpm init $PF
15 okexit create addfile test db
16
17 hash=$(zpm addfile $PF test.empty 2>> test.out)
18 okexit add empty file content
19 okstreq "$hash" 0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 hash contents
20 appid=$(sqlite3 test.db 'pragma application_id')
21 okstreq $appid 1515209794 application id set
22
23 userv=$(sqlite3 test.db 'pragma user_version')
24 okstreq $userv 1 db version set
25
26 mkdir test.dir
27 zpm-addfile $PF test.dir 2>>test.out
28 failsok fail to add directory
29 rmdir test.dir
30
31 zpm-addfile $PF /dev/null 2>>test.out
32 failsok fail to device file
33
34 finish
35
36 rm -f $PF test.empty