Skip to content

Commit

Permalink
Test for action:raw "offset", both bytes and sector
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Shakhov committed May 10, 2022
1 parent cb74f21 commit 7cf2576
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ jobs:
test: { name: "partitioning", case: "partitioning" }
- backend: { name: "uml", backend: "--fakemachine-backend=uml" }
test: { name: "partitioning", case: "partitioning" }
- backend: { name: "qemu", backend: "--fakemachine-backend=qemu" }
test: { name: "action-raw-offset", case: "action-raw-offset" }
- backend: { name: "uml", backend: "--fakemachine-backend=uml" }
test: { name: "action-raw-offset", case: "action-raw-offset" }
name: ${{matrix.test.name}} on ${{matrix.backend.name}}
steps:
- name: Repository checkout
Expand Down
Binary file added tests/action-raw-offset/overlays/test/test-blk.raw
Binary file not shown.
42 changes: 42 additions & 0 deletions tests/action-raw-offset/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- $sector1 := 80 -}}
{{- $offset1 := 40960 -}}
{{- $sector2 := 82 -}}

{{- $image_test := "test.img" -}}
{{- $sample := "overlays/test/test-blk.raw" -}}

architecture: arm64

actions:
- action: overlay
description: Deploy test block
source: overlays/test

- action: image-partition
description: Create {{ $image_test }}
imagename: {{ $image_test }}
imagesize: {{ sector 128 }}
partitiontype: msdos

- action: raw
description: Writing by bytes to {{ $image_test }}, offset {{ $offset1 }}
origin: filesystem
source: /test-blk.raw
offset: {{ $offset1 }}

- action: raw
description: Writing by sector to {{ $image_test }}, offset {{ sector $sector2 }}, sector {{ $sector2 }}
origin: filesystem
source: /test-blk.raw
offset: {{ sector $sector2 }}

- action: run
description: Run the test against the result image
chroot: false
postprocess: true
command: >
cd ${ARTIFACTDIR};
dd if={{ $image_test }} of=raw.byte bs=512 skip={{ $sector1 }} count=1 status=none;
dd if={{ $image_test }} of=raw.sector bs=512 skip={{ $sector2 }} count=1 status=none;
diff -s ${RECIPEDIR}/{{ $sample }} raw.byte || exit 1;
diff -s ${RECIPEDIR}/{{ $sample }} raw.sector || exit 2;

0 comments on commit 7cf2576

Please sign in to comment.