1#!/bin/sh
2
3#
4# Test file concatenation
5#
6
7. "$(cd "$(dirname "$0")" && pwd)/common.sh"
8
9cat >$CONFIG <<EOF
10file-resource TEST {
11        host-path = "${TESTFILE_1K};${TESTFILE_150K};${TESTFILE_1K_CORRUPT}"
12}
13
14task complete {
15	on-resource TEST { raw_write(0) }
16}
17EOF
18
19cat >$EXPECTED_META_CONF <<EOF
20file-resource "TEST" {
21length=152048
22blake2b-256="792ac899e67b886626954873c976baa23d9d9c3b379410515041e9e94687e13a"
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
35cat $TESTFILE_1K $TESTFILE_150K $TESTFILE_1K_CORRUPT > $WORK/cat.bin
36cmp $WORK/cat.bin $UNZIPDIR/data/TEST
37
38# Check that applying the firmware does the expected thing
39$FWUP_APPLY -a -d $IMGFILE -i $FWFILE -t complete
40cmp_bytes 151024 $WORK/cat.bin $IMGFILE
41
42# Check that the verify logic works on this file
43$FWUP_VERIFY -V -i $FWFILE
44