diff options
Diffstat (limited to 'external')
66 files changed, 440 insertions, 0 deletions
diff --git a/external/ffspart/Makefile b/external/ffspart/Makefile index 922ff75..a9b8cfa 100644 --- a/external/ffspart/Makefile +++ b/external/ffspart/Makefile @@ -5,6 +5,12 @@ include ../../external/common/rules.mk all: links arch_links $(EXE) +#Rebuild version.o so that the the version always matches +#what the test suite will get from ./make_version.sh +check: version.o all + @ln -sf ../../test/test.sh test/test.sh + @test/test-ffspart + $(OBJS): | links arch_links .PHONY: VERSION-always diff --git a/external/ffspart/test/Makefile.check b/external/ffspart/test/Makefile.check new file mode 100644 index 0000000..b1a1a3c --- /dev/null +++ b/external/ffspart/test/Makefile.check @@ -0,0 +1,20 @@ +# -*-Makefile-*- + +check: check-ffspart + +#Makefile knows to build it before checking, should also +#make clean before checking. If not, .o files for different +#architectures might be lying around and clean once done to +#avoid the opposite +check-ffspart: ffspart-test-clean + @make CROSS_COMPILE='' -C external/ffspart/ check + @make CROSS_COMPILE='' -C external/ffspart/ clean + +.PHONY: check-ffspart + +clean: ffspart-test-clean + +ffspart-test-clean: + @make -C external/ffspart clean + +.PHONY: ffspart-test-clean diff --git a/external/ffspart/test/files/03-tiny-pnor.in b/external/ffspart/test/files/03-tiny-pnor.in new file mode 100644 index 0000000..517dc47 --- /dev/null +++ b/external/ffspart/test/files/03-tiny-pnor.in @@ -0,0 +1,4 @@ +ONE,0x00000300,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/external/ffspart/test/files/03-tiny-pnor.out b/external/ffspart/test/files/03-tiny-pnor.out Binary files differnew file mode 100644 index 0000000..32e998d --- /dev/null +++ b/external/ffspart/test/files/03-tiny-pnor.out diff --git a/external/ffspart/test/files/03.1-tiny-pnor-backup.in b/external/ffspart/test/files/03.1-tiny-pnor-backup.in new file mode 100644 index 0000000..517dc47 --- /dev/null +++ b/external/ffspart/test/files/03.1-tiny-pnor-backup.in @@ -0,0 +1,4 @@ +ONE,0x00000300,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/external/ffspart/test/files/03.1-tiny-pnor-backup.out b/external/ffspart/test/files/03.1-tiny-pnor-backup.out Binary files differnew file mode 100644 index 0000000..85c23e3 --- /dev/null +++ b/external/ffspart/test/files/03.1-tiny-pnor-backup.out diff --git a/external/ffspart/test/files/04-tiny-pnor2.in b/external/ffspart/test/files/04-tiny-pnor2.in new file mode 100644 index 0000000..34bfbde --- /dev/null +++ b/external/ffspart/test/files/04-tiny-pnor2.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/external/ffspart/test/files/04-tiny-pnor2.out b/external/ffspart/test/files/04-tiny-pnor2.out Binary files differnew file mode 100644 index 0000000..dad94b8 --- /dev/null +++ b/external/ffspart/test/files/04-tiny-pnor2.out diff --git a/external/ffspart/test/files/05-hdr-overlap.in b/external/ffspart/test/files/05-hdr-overlap.in new file mode 100644 index 0000000..0dd3711 --- /dev/null +++ b/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/external/ffspart/test/files/05.1-hdr-overlap-backup.in b/external/ffspart/test/files/05.1-hdr-overlap-backup.in new file mode 100644 index 0000000..c6cf6e6 --- /dev/null +++ b/external/ffspart/test/files/05.1-hdr-overlap-backup.in @@ -0,0 +1,3 @@ +ONE,0x00000200,0x00000100,EV,/dev/zero +TWO,0x00000300,0x00000100,EF,/dev/zero +THREE,0x00000400,0x00000100,EF,/dev/zero diff --git a/external/ffspart/test/files/06-small-flash.in b/external/ffspart/test/files/06-small-flash.in new file mode 100644 index 0000000..a4af620 --- /dev/null +++ b/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/external/ffspart/test/files/07-big-files.in b/external/ffspart/test/files/07-big-files.in new file mode 100644 index 0000000..34bfbde --- /dev/null +++ b/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/external/ffspart/test/files/08-small-files.in b/external/ffspart/test/files/08-small-files.in new file mode 100644 index 0000000..34bfbde --- /dev/null +++ b/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/external/ffspart/test/files/10-bad-input.in b/external/ffspart/test/files/10-bad-input.in new file mode 100644 index 0000000..6015a52 --- /dev/null +++ b/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/external/ffspart/test/files/11-long-name.in b/external/ffspart/test/files/11-long-name.in new file mode 100644 index 0000000..a194de0 --- /dev/null +++ b/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/external/ffspart/test/files/12-bad-numbers-base.in b/external/ffspart/test/files/12-bad-numbers-base.in new file mode 100644 index 0000000..f3de343 --- /dev/null +++ b/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/external/ffspart/test/files/13-bad-numbers-size.in b/external/ffspart/test/files/13-bad-numbers-size.in new file mode 100644 index 0000000..56fd5df --- /dev/null +++ b/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/external/ffspart/test/files/14-bad-input-flags.in b/external/ffspart/test/files/14-bad-input-flags.in new file mode 100644 index 0000000..c483f57 --- /dev/null +++ b/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/external/ffspart/test/files/15-overlapping-partitions.in b/external/ffspart/test/files/15-overlapping-partitions.in new file mode 100644 index 0000000..47c3837 --- /dev/null +++ b/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/external/ffspart/test/make-check-test b/external/ffspart/test/make-check-test new file mode 100755 index 0000000..9435286 --- /dev/null +++ b/external/ffspart/test/make-check-test @@ -0,0 +1 @@ +make -C external/ffspart/ check diff --git a/external/ffspart/test/results/00-usage.err b/external/ffspart/test/results/00-usage.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/external/ffspart/test/results/00-usage.err diff --git a/external/ffspart/test/results/00-usage.out b/external/ffspart/test/results/00-usage.out new file mode 100644 index 0000000..19eedc7 --- /dev/null +++ b/external/ffspart/test/results/00-usage.out @@ -0,0 +1,21 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -s size -c num -i layout_file -p pnor_file ... + + Options: + -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 + + -o, --order=( ADB | ABD ) + Ordering of the TOC, Data and Backup TOC. Currently only ADB (default) + is supported + -p, --pnor=file + Output file to write data + + -t, --sides=( 1 | 2 ) + Number of sides to the flash (Default: 1) diff --git a/external/ffspart/test/results/01-param-sanity.err b/external/ffspart/test/results/01-param-sanity.err new file mode 100644 index 0000000..7b8bb3b --- /dev/null +++ b/external/ffspart/test/results/01-param-sanity.err @@ -0,0 +1 @@ +Greater than two sides is not supported diff --git a/external/ffspart/test/results/01-param-sanity.out b/external/ffspart/test/results/01-param-sanity.out new file mode 100644 index 0000000..19eedc7 --- /dev/null +++ b/external/ffspart/test/results/01-param-sanity.out @@ -0,0 +1,21 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -s size -c num -i layout_file -p pnor_file ... + + Options: + -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 + + -o, --order=( ADB | ABD ) + Ordering of the TOC, Data and Backup TOC. Currently only ADB (default) + is supported + -p, --pnor=file + Output file to write data + + -t, --sides=( 1 | 2 ) + Number of sides to the flash (Default: 1) diff --git a/external/ffspart/test/results/02-param-sides.err b/external/ffspart/test/results/02-param-sides.err new file mode 100644 index 0000000..faf9d9f --- /dev/null +++ b/external/ffspart/test/results/02-param-sides.err @@ -0,0 +1 @@ +Invalid block_count 1 for sides 2 diff --git a/external/ffspart/test/results/02-param-sides.out b/external/ffspart/test/results/02-param-sides.out new file mode 100644 index 0000000..19eedc7 --- /dev/null +++ b/external/ffspart/test/results/02-param-sides.out @@ -0,0 +1,21 @@ +Open-Power FFS format tool VERSION +Usage: ./ffspart [options] -s size -c num -i layout_file -p pnor_file ... + + Options: + -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 + + -o, --order=( ADB | ABD ) + Ordering of the TOC, Data and Backup TOC. Currently only ADB (default) + is supported + -p, --pnor=file + Output file to write data + + -t, --sides=( 1 | 2 ) + Number of sides to the flash (Default: 1) diff --git a/external/ffspart/test/results/05-hdr-overlap.err b/external/ffspart/test/results/05-hdr-overlap.err new file mode 100644 index 0000000..c0ab238 --- /dev/null +++ b/external/ffspart/test/results/05-hdr-overlap.err @@ -0,0 +1,2 @@ +Adding partition 'FOUR' would cause partition 'ONE' at 0x00000200 to overlap with the header +Couldn't add entry 'FOUR' 0x00000500 for 0x00000100 diff --git a/external/ffspart/test/results/05-hdr-overlap.out b/external/ffspart/test/results/05-hdr-overlap.out new file mode 100644 index 0000000..9613697 --- /dev/null +++ b/external/ffspart/test/results/05-hdr-overlap.out @@ -0,0 +1,5 @@ +Adding 'ONE' 0x00000200, 0x00000100 +Adding 'TWO' 0x00000300, 0x00000100 +Adding 'THREE' 0x00000400, 0x00000100 +Adding 'FOUR' 0x00000500, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/05.1-hdr-overlap-backup.err b/external/ffspart/test/results/05.1-hdr-overlap-backup.err new file mode 100644 index 0000000..2adbf79 --- /dev/null +++ b/external/ffspart/test/results/05.1-hdr-overlap-backup.err @@ -0,0 +1,2 @@ +Adding partition 'BACKUP_PART' would cause partition 'ONE' at 0x00000200 to overlap with the header +Failed to create backup part diff --git a/external/ffspart/test/results/05.1-hdr-overlap-backup.out b/external/ffspart/test/results/05.1-hdr-overlap-backup.out new file mode 100644 index 0000000..dbcdcb1 --- /dev/null +++ b/external/ffspart/test/results/05.1-hdr-overlap-backup.out @@ -0,0 +1,4 @@ +Adding 'ONE' 0x00000200, 0x00000100 +Adding 'TWO' 0x00000300, 0x00000100 +Adding 'THREE' 0x00000400, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/06-small-flash.err b/external/ffspart/test/results/06-small-flash.err new file mode 100644 index 0000000..a95149b --- /dev/null +++ b/external/ffspart/test/results/06-small-flash.err @@ -0,0 +1 @@ +Couldn't add entry 'TWO' 0x00000400 for 0x00000100 diff --git a/external/ffspart/test/results/06-small-flash.out b/external/ffspart/test/results/06-small-flash.out new file mode 100644 index 0000000..c59579e --- /dev/null +++ b/external/ffspart/test/results/06-small-flash.out @@ -0,0 +1,3 @@ +Adding 'ONE' 0x00000300, 0x00000100 +Adding 'TWO' 0x00000400, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/07-big-files.err b/external/ffspart/test/results/07-big-files.err new file mode 100644 index 0000000..f179a53 --- /dev/null +++ b/external/ffspart/test/results/07-big-files.err @@ -0,0 +1 @@ +Data file for partition 'ONE' is too large diff --git a/external/ffspart/test/results/07-big-files.out b/external/ffspart/test/results/07-big-files.out new file mode 100644 index 0000000..8392973 --- /dev/null +++ b/external/ffspart/test/results/07-big-files.out @@ -0,0 +1,2 @@ +Adding 'ONE' 0x00000300, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/08-small-files.err b/external/ffspart/test/results/08-small-files.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/external/ffspart/test/results/08-small-files.err diff --git a/external/ffspart/test/results/08-small-files.out b/external/ffspart/test/results/08-small-files.out new file mode 100644 index 0000000..9c39b05 --- /dev/null +++ b/external/ffspart/test/results/08-small-files.out @@ -0,0 +1,5 @@ +Adding 'ONE' 0x00000300, 0x00000100 +Adding 'TWO' 0x00000400, 0x00000100 +Adding 'THREE' 0x00000500, 0x00000100 +Adding 'FOUR' 0x00000600, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/10-bad-input.err b/external/ffspart/test/results/10-bad-input.err new file mode 100644 index 0000000..08d2fcf --- /dev/null +++ b/external/ffspart/test/results/10-bad-input.err @@ -0,0 +1 @@ +Invalid input file format: Couldn't parse 'ONE0x00000300' partition length diff --git a/external/ffspart/test/results/10-bad-input.out b/external/ffspart/test/results/10-bad-input.out new file mode 100644 index 0000000..aad57ac --- /dev/null +++ b/external/ffspart/test/results/10-bad-input.out @@ -0,0 +1 @@ +Freeing hdr diff --git a/external/ffspart/test/results/11-long-name.err b/external/ffspart/test/results/11-long-name.err new file mode 100644 index 0000000..824062e --- /dev/null +++ b/external/ffspart/test/results/11-long-name.err @@ -0,0 +1,2 @@ +WARNING: Long partition 'This_is_more_than_15_characters' name will get truncated +WARNING: Long partition 'This_is_one_more' name will get truncated diff --git a/external/ffspart/test/results/11-long-name.out b/external/ffspart/test/results/11-long-name.out new file mode 100644 index 0000000..030fc11 --- /dev/null +++ b/external/ffspart/test/results/11-long-name.out @@ -0,0 +1,5 @@ +Adding 'This_is_more_than_15_characters' 0x00000300, 0x00000100 +Adding 'This_is_exactly' 0x00000400, 0x00000100 +Adding 'This_is_one_le' 0x00000500, 0x00000100 +Adding 'This_is_one_more' 0x00000600, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/results/12-bad-numbers-base.err b/external/ffspart/test/results/12-bad-numbers-base.err new file mode 100644 index 0000000..7312b03 --- /dev/null +++ b/external/ffspart/test/results/12-bad-numbers-base.err @@ -0,0 +1 @@ +Invalid input file format: Couldn't parse 'ONE' partition base address diff --git a/external/ffspart/test/results/12-bad-numbers-base.out b/external/ffspart/test/results/12-bad-numbers-base.out new file mode 100644 index 0000000..aad57ac --- /dev/null +++ b/external/ffspart/test/results/12-bad-numbers-base.out @@ -0,0 +1 @@ +Freeing hdr diff --git a/external/ffspart/test/results/13-bad-numbers-size.err b/external/ffspart/test/results/13-bad-numbers-size.err new file mode 100644 index 0000000..592fec2 --- /dev/null +++ b/external/ffspart/test/results/13-bad-numbers-size.err @@ -0,0 +1 @@ +Invalid input file format: Couldn't parse 'ONE' partition length diff --git a/external/ffspart/test/results/13-bad-numbers-size.out b/external/ffspart/test/results/13-bad-numbers-size.out new file mode 100644 index 0000000..aad57ac --- /dev/null +++ b/external/ffspart/test/results/13-bad-numbers-size.out @@ -0,0 +1 @@ +Freeing hdr diff --git a/external/ffspart/test/results/14-bad-input-flags.err b/external/ffspart/test/results/14-bad-input-flags.err new file mode 100644 index 0000000..fecdb6e --- /dev/null +++ b/external/ffspart/test/results/14-bad-input-flags.err @@ -0,0 +1 @@ +Unknown flag 'Z' diff --git a/external/ffspart/test/results/14-bad-input-flags.out b/external/ffspart/test/results/14-bad-input-flags.out new file mode 100644 index 0000000..aad57ac --- /dev/null +++ b/external/ffspart/test/results/14-bad-input-flags.out @@ -0,0 +1 @@ +Freeing hdr diff --git a/external/ffspart/test/results/15-overlapping-partitions.err b/external/ffspart/test/results/15-overlapping-partitions.err new file mode 100644 index 0000000..d92f443 --- /dev/null +++ b/external/ffspart/test/results/15-overlapping-partitions.err @@ -0,0 +1 @@ +Couldn't add entry 'TWO' 0x00000350 for 0x00000100 diff --git a/external/ffspart/test/results/15-overlapping-partitions.out b/external/ffspart/test/results/15-overlapping-partitions.out new file mode 100644 index 0000000..874953b --- /dev/null +++ b/external/ffspart/test/results/15-overlapping-partitions.out @@ -0,0 +1,3 @@ +Adding 'ONE' 0x00000300, 0x00000100 +Adding 'TWO' 0x00000350, 0x00000100 +Freeing hdr diff --git a/external/ffspart/test/test-ffspart b/external/ffspart/test/test-ffspart new file mode 100755 index 0000000..7e38a4e --- /dev/null +++ b/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/external/ffspart/test/tests/00-usage b/external/ffspart/test/tests/00-usage new file mode 100644 index 0000000..0ca453f --- /dev/null +++ b/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/external/ffspart/test/tests/01-param-sanity b/external/ffspart/test/tests/01-param-sanity new file mode 100644 index 0000000..9e28c45 --- /dev/null +++ b/external/ffspart/test/tests/01-param-sanity @@ -0,0 +1,12 @@ +#! /bin/sh + +run_binary "./ffspart" "-t 3 -s 1 -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/external/ffspart/test/tests/02-param-sides b/external/ffspart/test/tests/02-param-sides new file mode 100644 index 0000000..cd7984b --- /dev/null +++ b/external/ffspart/test/tests/02-param-sides @@ -0,0 +1,12 @@ +#! /bin/sh + +run_binary "./ffspart" "-t 2 -s 1 -c 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/external/ffspart/test/tests/03-tiny-pnor b/external/ffspart/test/tests/03-tiny-pnor new file mode 100644 index 0000000..e778339 --- /dev/null +++ b/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/external/ffspart/test/tests/03.1-tiny-pnor-backup b/external/ffspart/test/tests/03.1-tiny-pnor-backup new file mode 100644 index 0000000..a622ca6 --- /dev/null +++ b/external/ffspart/test/tests/03.1-tiny-pnor-backup @@ -0,0 +1,15 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-b -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/external/ffspart/test/tests/04-tiny-pnor2 b/external/ffspart/test/tests/04-tiny-pnor2 new file mode 100644 index 0000000..a7e79ab --- /dev/null +++ b/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 $((0x100)) ] ; 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/external/ffspart/test/tests/05-hdr-overlap b/external/ffspart/test/tests/05-hdr-overlap new file mode 100644 index 0000000..2fa050b --- /dev/null +++ b/external/ffspart/test/tests/05-hdr-overlap @@ -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" +#expect this error code, which is FFS_ERR_BAD_PART_BASE becase we're +#going to have too many partitions for header to fit before the first +#partition +if [ "$?" -ne 107 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/05.1-hdr-overlap-backup b/external/ffspart/test/tests/05.1-hdr-overlap-backup new file mode 100644 index 0000000..5814fff --- /dev/null +++ b/external/ffspart/test/tests/05.1-hdr-overlap-backup @@ -0,0 +1,15 @@ +#! /bin/sh + +touch $DATA_DIR/$CUR_TEST.gen + +run_binary "./ffspart" "-b -s 0x100 -c 10 -i $DATA_DIR/$CUR_TEST.in -p $DATA_DIR/$CUR_TEST.gen" +#expect this error code, which is FFS_ERR_BAD_PART_BASE becase we're +#going to have too many partitions for header to fit before the first +#partition +if [ "$?" -ne 107 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/06-small-flash b/external/ffspart/test/tests/06-small-flash new file mode 100644 index 0000000..b49f457 --- /dev/null +++ b/external/ffspart/test/tests/06-small-flash @@ -0,0 +1,12 @@ +#! /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" +#Expect FFS_ERR_BAD_PART_SIZE because the flash is too small +if [ "$?" -ne 108 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/07-big-files b/external/ffspart/test/tests/07-big-files new file mode 100644 index 0000000..2381824 --- /dev/null +++ b/external/ffspart/test/tests/07-big-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 $((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 + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/08-small-files b/external/ffspart/test/tests/08-small-files new file mode 100644 index 0000000..fb2a98b --- /dev/null +++ b/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 $((0xff)) ] ; 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/external/ffspart/test/tests/10-bad-input b/external/ffspart/test/tests/10-bad-input new file mode 100644 index 0000000..e2f418c --- /dev/null +++ b/external/ffspart/test/tests/10-bad-input @@ -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 [ "$?" -eq 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/11-long-name b/external/ffspart/test/tests/11-long-name new file mode 100644 index 0000000..893aad4 --- /dev/null +++ b/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/external/ffspart/test/tests/12-bad-numbers-base b/external/ffspart/test/tests/12-bad-numbers-base new file mode 100644 index 0000000..e2f418c --- /dev/null +++ b/external/ffspart/test/tests/12-bad-numbers-base @@ -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 [ "$?" -eq 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/13-bad-numbers-size b/external/ffspart/test/tests/13-bad-numbers-size new file mode 100644 index 0000000..e2f418c --- /dev/null +++ b/external/ffspart/test/tests/13-bad-numbers-size @@ -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 [ "$?" -eq 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/14-bad-input-flags b/external/ffspart/test/tests/14-bad-input-flags new file mode 100644 index 0000000..e2f418c --- /dev/null +++ b/external/ffspart/test/tests/14-bad-input-flags @@ -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 [ "$?" -eq 0 ] ; then + fail_test +fi + +diff_with_result + +pass_test diff --git a/external/ffspart/test/tests/15-overlapping-partitions b/external/ffspart/test/tests/15-overlapping-partitions new file mode 100644 index 0000000..26c24d0 --- /dev/null +++ b/external/ffspart/test/tests/15-overlapping-partitions @@ -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 107 ] ; then + fail_test +fi + +diff_with_result + +pass_test |