diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/skiboot/external/ffspart/test | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/skiboot/external/ffspart/test')
65 files changed, 464 insertions, 0 deletions
diff --git a/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.in b/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.in new file mode 100644 index 000000000..961c3fefa --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.in @@ -0,0 +1,4 @@ +ONE,0x00400,0x00000100,EL,,/dev/zero +TWO,0x00500,0x00000100,EF,,/dev/zero +THREE,0x600,0x00000100,EF,,/dev/zero +FOUR,0x0700,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.out b/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.out Binary files differnew file mode 100644 index 000000000..e00fa5c0e --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/03-tiny-pnor.out diff --git a/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.in b/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.in new file mode 100644 index 000000000..7fc12ba4f --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00000100,EL,,SEDCATCH_1 +TWO,0x00000400,0x00000100,EF,,SEDCATCH_2 +THREE,0x00000500,0x00000100,EF,,SEDCATCH_3 +FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4 diff --git a/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.out b/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.out Binary files differnew file mode 100644 index 000000000..617c4ef44 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/04-tiny-pnor2.out diff --git a/roms/skiboot/external/ffspart/test/files/05-hdr-overlap.in b/roms/skiboot/external/ffspart/test/files/05-hdr-overlap.in new file mode 100644 index 000000000..8af94d2d7 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/05-hdr-overlap.in @@ -0,0 +1,4 @@ +ONE,0x00000200,0x00000100,EV,,/dev/zero +TWO,0x00000300,0x00000100,EF,,/dev/zero +THREE,0x00000400,0x00000100,EF,,/dev/zero +FOUR,0x00000500,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/06-small-flash.in b/roms/skiboot/external/ffspart/test/files/06-small-flash.in new file mode 100644 index 000000000..a717888b3 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/06-small-flash.in @@ -0,0 +1,5 @@ +ONE,0x00000300,0x00000100,EV,,/dev/zero +TWO,0x00000400,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero +FIVE,0x00000700,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/07-big-files.in b/roms/skiboot/external/ffspart/test/files/07-big-files.in new file mode 100644 index 000000000..0369bf665 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/07-big-files.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00000100,EV,,SEDCATCH_1 +TWO,0x00000400,0x00000100,EF,,SEDCATCH_2 +THREE,0x00000500,0x00000100,EF,,SEDCATCH_3 +FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4 diff --git a/roms/skiboot/external/ffspart/test/files/08-small-files.in b/roms/skiboot/external/ffspart/test/files/08-small-files.in new file mode 100644 index 000000000..0369bf665 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/08-small-files.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00000100,EV,,SEDCATCH_1 +TWO,0x00000400,0x00000100,EF,,SEDCATCH_2 +THREE,0x00000500,0x00000100,EF,,SEDCATCH_3 +FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4 diff --git a/roms/skiboot/external/ffspart/test/files/10-bad-input.in b/roms/skiboot/external/ffspart/test/files/10-bad-input.in new file mode 100644 index 000000000..5c4c90ee6 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/10-bad-input.in @@ -0,0 +1,4 @@ +ONE0x00000300,0x00000100,EV,,/dev/zero +TWO,0x00000400,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/11-long-name.in b/roms/skiboot/external/ffspart/test/files/11-long-name.in new file mode 100644 index 000000000..bd32ea89a --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/11-long-name.in @@ -0,0 +1,4 @@ +This_is_more_than_15_characters,0x00000300,0x00000100,EV,,/dev/zero +This_is_exactly,0x00000400,0x00000100,EF,,/dev/zero +This_is_one_le,0x00000500,0x00000100,EF,,/dev/zero +This_is_one_more,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/12-bad-numbers-base.in b/roms/skiboot/external/ffspart/test/files/12-bad-numbers-base.in new file mode 100644 index 000000000..8f6fd27a9 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/12-bad-numbers-base.in @@ -0,0 +1,4 @@ +ONE,0xg0000300,0x00000100,EV,,/dev/zero +TWO,0x00000400,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/13-bad-numbers-size.in b/roms/skiboot/external/ffspart/test/files/13-bad-numbers-size.in new file mode 100644 index 000000000..b1dacc738 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/13-bad-numbers-size.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00001g00,EV,,/dev/zero +TWO,0x00000400,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/14-bad-input-flags.in b/roms/skiboot/external/ffspart/test/files/14-bad-input-flags.in new file mode 100644 index 000000000..dcf18f248 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/14-bad-input-flags.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00000100,EVZ,,/dev/zero +TWO,0x00000400,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/15-overlapping-partitions.in b/roms/skiboot/external/ffspart/test/files/15-overlapping-partitions.in new file mode 100644 index 000000000..e496afa17 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/15-overlapping-partitions.in @@ -0,0 +1,4 @@ +ONE,0x00000300,0x00000100,EV,,/dev/zero +TWO,0x00000350,0x00000100,EF,,/dev/zero +THREE,0x00000500,0x00000100,EF,,/dev/zero +FOUR,0x00000600,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/16-create-blank.in b/roms/skiboot/external/ffspart/test/files/16-create-blank.in new file mode 100644 index 000000000..7cff6bf01 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/16-create-blank.in @@ -0,0 +1,4 @@ +ONE,0x00400,0x00000100,EL,, +TWO,0x00500,0x00000100,EF,, +THREE,0x600,0x00000100,EF,, +FOUR,0x0700,0x00000100,EF,, diff --git a/roms/skiboot/external/ffspart/test/files/16-create-blank.out b/roms/skiboot/external/ffspart/test/files/16-create-blank.out Binary files differnew file mode 100644 index 000000000..43b9583b3 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/16-create-blank.out diff --git a/roms/skiboot/external/ffspart/test/files/17-toc.in b/roms/skiboot/external/ffspart/test/files/17-toc.in new file mode 100644 index 000000000..6020e0fe2 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/17-toc.in @@ -0,0 +1,5 @@ +@0,0x0, +ONE,0x00400,0x00000100,EL,,/dev/zero +TWO,0x00500,0x00000100,EF,,/dev/zero +THREE,0x600,0x00000100,EF,,/dev/zero +FOUR,0x0700,0x00000100,EF,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/files/17-toc.out b/roms/skiboot/external/ffspart/test/files/17-toc.out Binary files differnew file mode 100644 index 000000000..e00fa5c0e --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/17-toc.out diff --git a/roms/skiboot/external/ffspart/test/files/18-eraseblock-gt-first-partition.in b/roms/skiboot/external/ffspart/test/files/18-eraseblock-gt-first-partition.in new file mode 100644 index 000000000..bed913682 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/files/18-eraseblock-gt-first-partition.in @@ -0,0 +1,2 @@ +@0,0x0, +FIRST,0x400,0x100,,,/dev/zero diff --git a/roms/skiboot/external/ffspart/test/make-check-test b/roms/skiboot/external/ffspart/test/make-check-test new file mode 100755 index 000000000..943528678 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/make-check-test @@ -0,0 +1 @@ +make -C external/ffspart/ check diff --git a/roms/skiboot/external/ffspart/test/results/00-usage.err b/roms/skiboot/external/ffspart/test/results/00-usage.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/00-usage.err diff --git a/roms/skiboot/external/ffspart/test/results/00-usage.out b/roms/skiboot/external/ffspart/test/results/00-usage.out new file mode 100644 index 000000000..cf7213d7b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/00-usage.out @@ -0,0 +1,19 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -e -s size -c num -i layout_file -p pnor_file ... + + Options: + -e, --allow_empty + Create partition as blank if not specified (sets ECC if flag set) + + -s, --block_size=size + Size (in hex with leading 0x) of the blocks on the flash in bytes + + -c, --block_count=num + Number of blocks on the flash + + -i, --input=file + File containing the required partition data + + -p, --pnor=file + Output file to write data + diff --git a/roms/skiboot/external/ffspart/test/results/01-param-sanity.err b/roms/skiboot/external/ffspart/test/results/01-param-sanity.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/01-param-sanity.err diff --git a/roms/skiboot/external/ffspart/test/results/01-param-sanity.out b/roms/skiboot/external/ffspart/test/results/01-param-sanity.out new file mode 100644 index 000000000..cf7213d7b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/01-param-sanity.out @@ -0,0 +1,19 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -e -s size -c num -i layout_file -p pnor_file ... + + Options: + -e, --allow_empty + Create partition as blank if not specified (sets ECC if flag set) + + -s, --block_size=size + Size (in hex with leading 0x) of the blocks on the flash in bytes + + -c, --block_count=num + Number of blocks on the flash + + -i, --input=file + File containing the required partition data + + -p, --pnor=file + Output file to write data + diff --git a/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.err b/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.err diff --git a/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.out b/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.out new file mode 100644 index 000000000..cf7213d7b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/01.1-param-sanity.out @@ -0,0 +1,19 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -e -s size -c num -i layout_file -p pnor_file ... + + Options: + -e, --allow_empty + Create partition as blank if not specified (sets ECC if flag set) + + -s, --block_size=size + Size (in hex with leading 0x) of the blocks on the flash in bytes + + -c, --block_count=num + Number of blocks on the flash + + -i, --input=file + File containing the required partition data + + -p, --pnor=file + Output file to write data + diff --git a/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.err b/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.err new file mode 100644 index 000000000..ff8aca201 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.err @@ -0,0 +1,5 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Adding partition 'THREE' would cause partition 'ONE' at 0x00000200 to overlap with the header +Couldn't add 'THREE' partition to default TOC: 107 +Failed to parse input file 'FILE' at line 3 diff --git a/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.out b/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/05-hdr-overlap.out diff --git a/roms/skiboot/external/ffspart/test/results/06-small-flash.err b/roms/skiboot/external/ffspart/test/results/06-small-flash.err new file mode 100644 index 000000000..a5316a90e --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/06-small-flash.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't add 'TWO' partition to default TOC: 108 +Failed to parse input file 'FILE' at line 2 diff --git a/roms/skiboot/external/ffspart/test/results/06-small-flash.out b/roms/skiboot/external/ffspart/test/results/06-small-flash.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/06-small-flash.out diff --git a/roms/skiboot/external/ffspart/test/results/07-big-files.err b/roms/skiboot/external/ffspart/test/results/07-big-files.err new file mode 100644 index 000000000..bfb6fa022 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/07-big-files.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +File 'FILE_ONE' for partition 'ONE' is too large, 257 > 227 +Failed to parse input file 'FILE' at line 1 diff --git a/roms/skiboot/external/ffspart/test/results/07-big-files.out b/roms/skiboot/external/ffspart/test/results/07-big-files.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/07-big-files.out diff --git a/roms/skiboot/external/ffspart/test/results/08-small-files.err b/roms/skiboot/external/ffspart/test/results/08-small-files.err new file mode 100644 index 000000000..c902b642b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/08-small-files.err @@ -0,0 +1,2 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero diff --git a/roms/skiboot/external/ffspart/test/results/08-small-files.out b/roms/skiboot/external/ffspart/test/results/08-small-files.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/08-small-files.out diff --git a/roms/skiboot/external/ffspart/test/results/10-bad-input.err b/roms/skiboot/external/ffspart/test/results/10-bad-input.err new file mode 100644 index 000000000..01c43d81a --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/10-bad-input.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't parse 'ONE0x00000300' partition length +Failed to parse input file 'FILE' at line 1 diff --git a/roms/skiboot/external/ffspart/test/results/10-bad-input.out b/roms/skiboot/external/ffspart/test/results/10-bad-input.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/10-bad-input.out diff --git a/roms/skiboot/external/ffspart/test/results/11-long-name.err b/roms/skiboot/external/ffspart/test/results/11-long-name.err new file mode 100644 index 000000000..cf8dcc325 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/11-long-name.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +WARNING: Long partition name will get truncated to 'This_is_more_tha' +WARNING: Long partition name will get truncated to 'This_is_one_more' diff --git a/roms/skiboot/external/ffspart/test/results/11-long-name.out b/roms/skiboot/external/ffspart/test/results/11-long-name.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/11-long-name.out diff --git a/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.err b/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.err new file mode 100644 index 000000000..cdd836eac --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't parse 'ONE' partition base address +Failed to parse input file 'FILE' at line 1 diff --git a/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.out b/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/12-bad-numbers-base.out diff --git a/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.err b/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.err new file mode 100644 index 000000000..19078d5db --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't parse 'ONE' partition length +Failed to parse input file 'FILE' at line 1 diff --git a/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.out b/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/13-bad-numbers-size.out diff --git a/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.err b/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.err new file mode 100644 index 000000000..613525c3d --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't parse 'ONE' partition flags +Failed to parse input file 'FILE' at line 1 diff --git a/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.out b/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/14-bad-input-flags.out diff --git a/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.err b/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.err new file mode 100644 index 000000000..c81d3c0e4 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.err @@ -0,0 +1,4 @@ +WARNING: Attempting to parse a partition line without any TOCs created. + Generating a default TOC at zero +Couldn't add 'TWO' partition to default TOC: 107 +Failed to parse input file 'FILE' at line 2 diff --git a/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.out b/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/roms/skiboot/external/ffspart/test/results/15-overlapping-partitions.out diff --git a/roms/skiboot/external/ffspart/test/test-ffspart b/roms/skiboot/external/ffspart/test/test-ffspart new file mode 100755 index 000000000..7e38a4e37 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/test-ffspart @@ -0,0 +1,5 @@ +#! /bin/sh + +. test/test.sh + +run_tests "test/tests/*" "test/results" "test/files" diff --git a/roms/skiboot/external/ffspart/test/tests/00-usage b/roms/skiboot/external/ffspart/test/tests/00-usage new file mode 100644 index 000000000..0ca453f4d --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/00-usage @@ -0,0 +1,12 @@ +#! /bin/sh + +run_binary "./ffspart" +if [ "$?" -ne 1 ] ; then + fail_test +fi + +strip_version_from_result "ffspart" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/01-param-sanity b/roms/skiboot/external/ffspart/test/tests/01-param-sanity new file mode 100644 index 000000000..d63736006 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/01-param-sanity @@ -0,0 +1,12 @@ +#! /bin/sh + +run_binary "./ffspart" "-c 3 -i /dev/null -p /dev/null" +if [ "$?" -ne 1 ] ; then + fail_test +fi + +strip_version_from_result "ffspart" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/01.1-param-sanity b/roms/skiboot/external/ffspart/test/tests/01.1-param-sanity new file mode 100644 index 000000000..1ce1f906c --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/01.1-param-sanity @@ -0,0 +1,12 @@ +#! /bin/sh + +run_binary "./ffspart" "-s 1 -i /dev/null -p /dev/null" +if [ "$?" -ne 1 ] ; then + fail_test +fi + +strip_version_from_result "ffspart" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/03-tiny-pnor b/roms/skiboot/external/ffspart/test/tests/03-tiny-pnor new file mode 100644 index 000000000..e7783394b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/03-tiny-pnor @@ -0,0 +1,15 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +if ! cmp -n $((0x100)) $DATA_DIR/$CUR_TEST.out $DATA_DIR/$CUR_TEST.gen ; then + echo "Output differs" + fail_test +fi + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/04-tiny-pnor2 b/roms/skiboot/external/ffspart/test/tests/04-tiny-pnor2 new file mode 100644 index 000000000..3db5f1e29 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/04-tiny-pnor2 @@ -0,0 +1,25 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +i=1; +while [ $i -lt 5 ] ; do + j=0; + while [ $j -lt $((0xe0)) ] ; do + echo -n "$i" >> $DATA_DIR/$CUR_TEST.$i; + j=$(expr $j + 1); + done + sed -i "s|SEDCATCH_$i|$DATA_DIR\/$CUR_TEST.$i|" $DATA_DIR/$CUR_TEST.in + i=$(expr $i + 1); +done + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +if ! cmp -n $((0x500)) $DATA_DIR/$CUR_TEST.out $DATA_DIR/$CUR_TEST.gen ; then + echo "Output differs" + fail_test +fi + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/05-hdr-overlap b/roms/skiboot/external/ffspart/test/tests/05-hdr-overlap new file mode 100644 index 000000000..39a1a1406 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/05-hdr-overlap @@ -0,0 +1,14 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 6 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/06-small-flash b/roms/skiboot/external/ffspart/test/tests/06-small-flash new file mode 100644 index 000000000..7c41e33f0 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/06-small-flash @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 4 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 6 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/07-big-files b/roms/skiboot/external/ffspart/test/tests/07-big-files new file mode 100644 index 000000000..f7a0064d9 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/07-big-files @@ -0,0 +1,26 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +i=1; +while [ $i -lt 5 ] ; do + j=0; + while [ $j -lt $((0x101)) ] ; do + echo -n "$i" >> $DATA_DIR/$CUR_TEST.$i; + j=$(expr $j + 1); + done + sed -i "s|SEDCATCH_$i|$DATA_DIR\/$CUR_TEST.$i|" $DATA_DIR/$CUR_TEST.in + i=$(expr $i + 1); +done + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -eq 0 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.1|FILE_ONE|" "$STDERR_OUT" + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/08-small-files b/roms/skiboot/external/ffspart/test/tests/08-small-files new file mode 100644 index 000000000..1e4f3b3be --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/08-small-files @@ -0,0 +1,22 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +i=1; +while [ $i -lt 5 ] ; do + j=0; + while [ $j -lt $((0xe0)) ] ; do + echo -n "$i" >> $DATA_DIR/$CUR_TEST.$i; + j=$(expr $j + 1); + done + sed -i "s|SEDCATCH_$i|$DATA_DIR\/$CUR_TEST.$i|" $DATA_DIR/$CUR_TEST.in + i=$(expr $i + 1); +done + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/10-bad-input b/roms/skiboot/external/ffspart/test/tests/10-bad-input new file mode 100644 index 000000000..d7c433262 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/10-bad-input @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -eq 0 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/11-long-name b/roms/skiboot/external/ffspart/test/tests/11-long-name new file mode 100644 index 000000000..893aad478 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/11-long-name @@ -0,0 +1,11 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/12-bad-numbers-base b/roms/skiboot/external/ffspart/test/tests/12-bad-numbers-base new file mode 100644 index 000000000..d7c433262 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/12-bad-numbers-base @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -eq 0 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/13-bad-numbers-size b/roms/skiboot/external/ffspart/test/tests/13-bad-numbers-size new file mode 100644 index 000000000..d7c433262 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/13-bad-numbers-size @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -eq 0 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/14-bad-input-flags b/roms/skiboot/external/ffspart/test/tests/14-bad-input-flags new file mode 100644 index 000000000..d7c433262 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/14-bad-input-flags @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -eq 0 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/15-overlapping-partitions b/roms/skiboot/external/ffspart/test/tests/15-overlapping-partitions new file mode 100644 index 000000000..6d85748d0 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/15-overlapping-partitions @@ -0,0 +1,13 @@ +#! /bin/sh +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 6 ] ; then + fail_test +fi + +sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT" + +diff_with_result + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/16-create-blank b/roms/skiboot/external/ffspart/test/tests/16-create-blank new file mode 100644 index 000000000..02640e4e6 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/16-create-blank @@ -0,0 +1,15 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen --allow_empty" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +if ! cmp $DATA_DIR/$CUR_TEST.out $DATA_DIR/$CUR_TEST.gen ; then + echo "Output differs" + fail_test +fi + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/17-toc b/roms/skiboot/external/ffspart/test/tests/17-toc new file mode 100644 index 000000000..e7783394b --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/17-toc @@ -0,0 +1,15 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +if ! cmp -n $((0x100)) $DATA_DIR/$CUR_TEST.out $DATA_DIR/$CUR_TEST.gen ; then + echo "Output differs" + fail_test +fi + +pass_test diff --git a/roms/skiboot/external/ffspart/test/tests/18-eraseblock-gt-first-partition b/roms/skiboot/external/ffspart/test/tests/18-eraseblock-gt-first-partition new file mode 100644 index 000000000..662665172 --- /dev/null +++ b/roms/skiboot/external/ffspart/test/tests/18-eraseblock-gt-first-partition @@ -0,0 +1,45 @@ +#! /bin/sh + +EXPECTED="ID=01 FIRST 0x00000400..0x00000500 (actual=0x00000100) [----------]" +FFSIMG=$DATA_DIR/$CUR_TEST.gen + +command -v pflash > /dev/null || echo "skipping test: pflash required but not found in PATH" && exit 0 + + +# https://github.com/open-power/skiboot/issues/205 +touch $FFSIMG + +# Use a block size that works with the existing codebase +run_binary "./ffspart" "-s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $FFSIMG" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +CONTENTS=$(pflash -i -F $FFSIMG | grep FIRST) + +if [ "$CONTENTS" != "$EXPECTED" ]; then + echo "Actual: $CONTENTS" + echo "Expected: $EXPECTED" + fail_test +fi + +# Use a block size that fails with the existing codebase. This test is expected +# to fail; change it to expect pass when the issue is fixed. +# https://github.com/open-power/skiboot/issues/202 +run_binary "./ffspart" "-s 0x1000 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $FFSIMG" +if [ "$?" -ne 0 ] ; then + fail_test +fi + +CONTENTS=$(pflash -i -F $FFSIMG | grep FIRST) + +if [ "$CONTENTS" != "$EXPECTED" ]; then + echo "This case should be marked as fail but ffspart has bugs" + echo "https://github.com/open-power/skiboot/issues/202" + echo "Actual: $CONTENTS" + echo "Expected: $EXPECTED" + pass_test +fi + + +pass_test |