1#!/bin/sh
2
3#
4# Test the creation and application of a trivial firmware file
5#
6
7. "$(cd "$(dirname "$0")" && pwd)/common.sh"
8
9cat >$CONFIG <<EOF
10file-resource TEST {
11        host-path = "${TESTFILE_1K}"
12}
13
14task complete {
15	on-resource TEST { raw_write(0) }
16}
17EOF
18
19cat >$EXPECTED_META_CONF <<EOF
20file-resource "TEST" {
21length=1024
22blake2b-256="b25c2dfe31707f5572d9a3670d0dcfe5d59ccb010e6aba3b81aad133eb5e378b"
23}
24task "complete" {
25on-resource "TEST" {
26funlist = {"2", "raw_write", "0"}
27}
28}
29EOF
30
31$FWUP_CREATE -c -f $CONFIG -o $FWFILE
32
33# Check that the zip file was created as expected
34check_meta_conf
35cmp $TESTFILE_1K $UNZIPDIR/data/TEST
36
37# Check that applying the firmware does the expected thing
38$FWUP_APPLY -a -d $IMGFILE -i $FWFILE -t complete --verify-writes
39cmp_bytes 1024 $IMGFILE $TESTFILE_1K
40
41# Check that the verify logic works on this file
42$FWUP_VERIFY -V -i $FWFILE
43