-
Notifications
You must be signed in to change notification settings - Fork 55
/
002_resource_subdir.test
executable file
·69 lines (60 loc) · 1.77 KB
/
002_resource_subdir.test
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
#!/bin/sh
#
# Test resources in subdirectories
#
. "$(cd "$(dirname "$0")" && pwd)/common.sh"
cat >$CONFIG <<EOF
file-resource subdir/onesubdir {
host-path = "${TESTFILE_1K}"
}
file-resource /rootfile {
host-path = "${TESTFILE_1K}"
}
file-resource subdir1/subdir2/twosubdir {
host-path = "${TESTFILE_1K}"
}
task complete {
on-resource subdir/onesubdir { raw_write(0) }
on-resource /rootfile { raw_write(4) }
on-resource subdir1/subdir2/twosubdir { raw_write(8) }
}
EOF
cat >$EXPECTED_META_CONF <<EOF
file-resource "subdir/onesubdir" {
length=1024
blake2b-256="b25c2dfe31707f5572d9a3670d0dcfe5d59ccb010e6aba3b81aad133eb5e378b"
}
file-resource "/rootfile" {
length=1024
blake2b-256="b25c2dfe31707f5572d9a3670d0dcfe5d59ccb010e6aba3b81aad133eb5e378b"
}
file-resource "subdir1/subdir2/twosubdir" {
length=1024
blake2b-256="b25c2dfe31707f5572d9a3670d0dcfe5d59ccb010e6aba3b81aad133eb5e378b"
}
task "complete" {
on-resource "subdir/onesubdir" {
funlist = {"2", "raw_write", "0"}
}
on-resource "/rootfile" {
funlist = {"2", "raw_write", "4"}
}
on-resource "subdir1/subdir2/twosubdir" {
funlist = {"2", "raw_write", "8"}
}
}
EOF
$FWUP_CREATE -c -f $CONFIG -o $FWFILE
# Check that the zip file was created as expected
check_meta_conf
cmp $TESTFILE_1K $UNZIPDIR/data/subdir/onesubdir
cmp $TESTFILE_1K $UNZIPDIR/rootfile
cmp $TESTFILE_1K $UNZIPDIR/data/subdir1/subdir2/twosubdir
# Check that applying the firmware does the expected thing
$FWUP_APPLY -a -d $IMGFILE -i $FWFILE -t complete
dd if=$TESTFILE_1K seek=0 of=$WORK/expected.bin
dd if=$TESTFILE_1K seek=4 of=$WORK/expected.bin
dd if=$TESTFILE_1K seek=8 of=$WORK/expected.bin
cmp_bytes 5120 $IMGFILE $WORK/expected.bin
# Check that the verify logic works on this file
$FWUP_VERIFY -V -i $FWFILE