[Skiboot] [PATCH 5/5] external/ffspart: Add tests
Cyril Bur
cyril.bur at au1.ibm.com
Fri Mar 17 16:13:09 AEDT 2017
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
external/ffspart/Makefile | 6 +++++
external/ffspart/test/Makefile.check | 20 +++++++++++++++++
external/ffspart/test/files/03-tiny-pnor.in | 4 ++++
external/ffspart/test/files/03-tiny-pnor.out | Bin 0 -> 2560 bytes
.../ffspart/test/files/03.1-tiny-pnor-backup.in | 4 ++++
.../ffspart/test/files/03.1-tiny-pnor-backup.out | Bin 0 -> 2864 bytes
external/ffspart/test/files/04-tiny-pnor2.in | 4 ++++
external/ffspart/test/files/04-tiny-pnor2.out | Bin 0 -> 2560 bytes
external/ffspart/test/files/05-hdr-overlap.in | 4 ++++
.../ffspart/test/files/05.1-hdr-overlap-backup.in | 3 +++
external/ffspart/test/files/06-small-flash.in | 5 +++++
external/ffspart/test/files/07-big-files.in | 4 ++++
external/ffspart/test/files/08-small-files.in | 4 ++++
external/ffspart/test/files/10-bad-input.in | 4 ++++
external/ffspart/test/files/11-long-name.in | 4 ++++
external/ffspart/test/files/12-bad-numbers-base.in | 4 ++++
external/ffspart/test/files/13-bad-numbers-size.in | 4 ++++
external/ffspart/test/files/14-bad-input-flags.in | 4 ++++
.../test/files/15-overlapping-partitions.in | 4 ++++
external/ffspart/test/make-check-test | 1 +
external/ffspart/test/results/00-usage.err | 0
external/ffspart/test/results/00-usage.out | 21 +++++++++++++++++
external/ffspart/test/results/01-param-sanity.err | 1 +
external/ffspart/test/results/01-param-sanity.out | 21 +++++++++++++++++
external/ffspart/test/results/02-param-sides.err | 1 +
external/ffspart/test/results/02-param-sides.out | 21 +++++++++++++++++
external/ffspart/test/results/05-hdr-overlap.err | 2 ++
external/ffspart/test/results/05-hdr-overlap.out | 5 +++++
.../test/results/05.1-hdr-overlap-backup.err | 2 ++
.../test/results/05.1-hdr-overlap-backup.out | 4 ++++
external/ffspart/test/results/06-small-flash.err | 1 +
external/ffspart/test/results/06-small-flash.out | 3 +++
external/ffspart/test/results/07-big-files.err | 1 +
external/ffspart/test/results/07-big-files.out | 2 ++
external/ffspart/test/results/08-small-files.err | 0
external/ffspart/test/results/08-small-files.out | 5 +++++
external/ffspart/test/results/10-bad-input.err | 1 +
external/ffspart/test/results/10-bad-input.out | 1 +
external/ffspart/test/results/11-long-name.err | 2 ++
external/ffspart/test/results/11-long-name.out | 5 +++++
.../ffspart/test/results/12-bad-numbers-base.err | 1 +
.../ffspart/test/results/12-bad-numbers-base.out | 1 +
.../ffspart/test/results/13-bad-numbers-size.err | 1 +
.../ffspart/test/results/13-bad-numbers-size.out | 1 +
.../ffspart/test/results/14-bad-input-flags.err | 1 +
.../ffspart/test/results/14-bad-input-flags.out | 1 +
.../test/results/15-overlapping-partitions.err | 1 +
.../test/results/15-overlapping-partitions.out | 3 +++
external/ffspart/test/test-ffspart | 5 +++++
external/ffspart/test/tests/00-usage | 12 ++++++++++
external/ffspart/test/tests/01-param-sanity | 12 ++++++++++
external/ffspart/test/tests/02-param-sides | 12 ++++++++++
external/ffspart/test/tests/03-tiny-pnor | 15 +++++++++++++
external/ffspart/test/tests/03.1-tiny-pnor-backup | 15 +++++++++++++
external/ffspart/test/tests/04-tiny-pnor2 | 25 +++++++++++++++++++++
external/ffspart/test/tests/05-hdr-overlap | 15 +++++++++++++
.../ffspart/test/tests/05.1-hdr-overlap-backup | 15 +++++++++++++
external/ffspart/test/tests/06-small-flash | 12 ++++++++++
external/ffspart/test/tests/07-big-files | 22 ++++++++++++++++++
external/ffspart/test/tests/08-small-files | 22 ++++++++++++++++++
external/ffspart/test/tests/10-bad-input | 11 +++++++++
external/ffspart/test/tests/11-long-name | 11 +++++++++
external/ffspart/test/tests/12-bad-numbers-base | 11 +++++++++
external/ffspart/test/tests/13-bad-numbers-size | 11 +++++++++
external/ffspart/test/tests/14-bad-input-flags | 11 +++++++++
.../ffspart/test/tests/15-overlapping-partitions | 11 +++++++++
66 files changed, 440 insertions(+)
create mode 100644 external/ffspart/test/Makefile.check
create mode 100644 external/ffspart/test/files/03-tiny-pnor.in
create mode 100644 external/ffspart/test/files/03-tiny-pnor.out
create mode 100644 external/ffspart/test/files/03.1-tiny-pnor-backup.in
create mode 100644 external/ffspart/test/files/03.1-tiny-pnor-backup.out
create mode 100644 external/ffspart/test/files/04-tiny-pnor2.in
create mode 100644 external/ffspart/test/files/04-tiny-pnor2.out
create mode 100644 external/ffspart/test/files/05-hdr-overlap.in
create mode 100644 external/ffspart/test/files/05.1-hdr-overlap-backup.in
create mode 100644 external/ffspart/test/files/06-small-flash.in
create mode 100644 external/ffspart/test/files/07-big-files.in
create mode 100644 external/ffspart/test/files/08-small-files.in
create mode 100644 external/ffspart/test/files/10-bad-input.in
create mode 100644 external/ffspart/test/files/11-long-name.in
create mode 100644 external/ffspart/test/files/12-bad-numbers-base.in
create mode 100644 external/ffspart/test/files/13-bad-numbers-size.in
create mode 100644 external/ffspart/test/files/14-bad-input-flags.in
create mode 100644 external/ffspart/test/files/15-overlapping-partitions.in
create mode 100755 external/ffspart/test/make-check-test
create mode 100644 external/ffspart/test/results/00-usage.err
create mode 100644 external/ffspart/test/results/00-usage.out
create mode 100644 external/ffspart/test/results/01-param-sanity.err
create mode 100644 external/ffspart/test/results/01-param-sanity.out
create mode 100644 external/ffspart/test/results/02-param-sides.err
create mode 100644 external/ffspart/test/results/02-param-sides.out
create mode 100644 external/ffspart/test/results/05-hdr-overlap.err
create mode 100644 external/ffspart/test/results/05-hdr-overlap.out
create mode 100644 external/ffspart/test/results/05.1-hdr-overlap-backup.err
create mode 100644 external/ffspart/test/results/05.1-hdr-overlap-backup.out
create mode 100644 external/ffspart/test/results/06-small-flash.err
create mode 100644 external/ffspart/test/results/06-small-flash.out
create mode 100644 external/ffspart/test/results/07-big-files.err
create mode 100644 external/ffspart/test/results/07-big-files.out
create mode 100644 external/ffspart/test/results/08-small-files.err
create mode 100644 external/ffspart/test/results/08-small-files.out
create mode 100644 external/ffspart/test/results/10-bad-input.err
create mode 100644 external/ffspart/test/results/10-bad-input.out
create mode 100644 external/ffspart/test/results/11-long-name.err
create mode 100644 external/ffspart/test/results/11-long-name.out
create mode 100644 external/ffspart/test/results/12-bad-numbers-base.err
create mode 100644 external/ffspart/test/results/12-bad-numbers-base.out
create mode 100644 external/ffspart/test/results/13-bad-numbers-size.err
create mode 100644 external/ffspart/test/results/13-bad-numbers-size.out
create mode 100644 external/ffspart/test/results/14-bad-input-flags.err
create mode 100644 external/ffspart/test/results/14-bad-input-flags.out
create mode 100644 external/ffspart/test/results/15-overlapping-partitions.err
create mode 100644 external/ffspart/test/results/15-overlapping-partitions.out
create mode 100755 external/ffspart/test/test-ffspart
create mode 100644 external/ffspart/test/tests/00-usage
create mode 100644 external/ffspart/test/tests/01-param-sanity
create mode 100644 external/ffspart/test/tests/02-param-sides
create mode 100644 external/ffspart/test/tests/03-tiny-pnor
create mode 100644 external/ffspart/test/tests/03.1-tiny-pnor-backup
create mode 100644 external/ffspart/test/tests/04-tiny-pnor2
create mode 100644 external/ffspart/test/tests/05-hdr-overlap
create mode 100644 external/ffspart/test/tests/05.1-hdr-overlap-backup
create mode 100644 external/ffspart/test/tests/06-small-flash
create mode 100644 external/ffspart/test/tests/07-big-files
create mode 100644 external/ffspart/test/tests/08-small-files
create mode 100644 external/ffspart/test/tests/10-bad-input
create mode 100644 external/ffspart/test/tests/11-long-name
create mode 100644 external/ffspart/test/tests/12-bad-numbers-base
create mode 100644 external/ffspart/test/tests/13-bad-numbers-size
create mode 100644 external/ffspart/test/tests/14-bad-input-flags
create mode 100644 external/ffspart/test/tests/15-overlapping-partitions
diff --git a/external/ffspart/Makefile b/external/ffspart/Makefile
index 922ff75f..a9b8cfa8 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 00000000..b1a1a3ce
--- /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 00000000..517dc47b
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..32e998d677a7abd4b7249d7957824d430e33dc64
GIT binary patch
literal 2560
zcmWG=3<_ajU|@ve1|ZD};WBUm*(e~uG5B^tVo?c-AcVvC9|(X<kU7i{8pNb7=%3fq
z>F?)?ZYbD3sQpYpNvOrx>~CObK-WzI-(aKlzmRZ$bR8@}0hs at xeg`SRZa;$nx_09E
zt9Kaw2=NGVMGFC7e8KGpy9Ht*_3eMRTxYkNe`pYzi`kIu2fKw<_U~Mvy$%%5qhK at y
UMnhmU1V%$(Gz3ONfU*z(0L5)}P5=M^
literal 0
HcmV?d00001
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 00000000..517dc47b
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..85c23e32deb6405f51643baa523621d554b377cf
GIT binary patch
literal 2864
zcmWG=3<_ajU|@ve1|ZD_;WBUm*(e~uG5AJ7Vo?c-AcVvC9|(X<kU7i{8pNb7=%3fq
z>F?)?ZYbD3sQpYpNvOrx>~CObK-WzI-(aKlzmRZ$bR8@}0hs at xeg`SRZa;$nx_09E
zt9Kaw2=NGVMGFB|kY!N+gWUo#k^1((TduR)%|A2<&Beg<0=FOR7FyZAbAk3cCr4-R
z(17>=NU{an#DQc#*e$s2hscmiuH3Wj6)2oX!DtAKhQMeD42KYa7Nnrc0)!iYc(ncp
N1_CxPTK|vM{{XxyIGg|g
literal 0
HcmV?d00001
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 00000000..34bfbde9
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..dad94b8c6f15b8fea8d779a09ed4edc8a4f1b4f1
GIT binary patch
literal 2560
zcmWG=3<_ajU|@ve1|ZD};WBUm*(e~uG5B^tVo?c-AcVvC9|(X<kU7i{8pNb7=%3fq
z>F?)?ZYbD3sQpYpNvOrx>~CObK-WzI-(aKlzmRZ$bR8@}0hs at xeg`SRZa;$nx_09E
zt9Kaw2=NGVMGFC7e8KGpy9Ht*_3eMRTxYkNe`pYzi`kIu2fKw<_U~Mvy$%%5)C7hj
a92kvoU_8Qs$p{D3EK5es8V!M=76Je~UPB=O
literal 0
HcmV?d00001
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 00000000..0dd37116
--- /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 00000000..c6cf6e65
--- /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 00000000..a4af6205
--- /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 00000000..34bfbde9
--- /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 00000000..34bfbde9
--- /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 00000000..6015a521
--- /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 00000000..a194de0c
--- /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 00000000..f3de343a
--- /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 00000000..56fd5df1
--- /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 00000000..c483f57f
--- /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 00000000..47c3837d
--- /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 00000000..94352867
--- /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 00000000..e69de29b
diff --git a/external/ffspart/test/results/00-usage.out b/external/ffspart/test/results/00-usage.out
new file mode 100644
index 00000000..19eedc74
--- /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 00000000..7b8bb3ba
--- /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 00000000..19eedc74
--- /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 00000000..faf9d9ff
--- /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 00000000..19eedc74
--- /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 00000000..c0ab238a
--- /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 00000000..96136976
--- /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 00000000..2adbf79a
--- /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 00000000..dbcdcb1d
--- /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 00000000..a95149bd
--- /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 00000000..c59579eb
--- /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 00000000..f179a53d
--- /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 00000000..83929738
--- /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 00000000..e69de29b
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 00000000..9c39b050
--- /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 00000000..08d2fcff
--- /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 00000000..aad57ac2
--- /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 00000000..824062ec
--- /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 00000000..030fc11b
--- /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 00000000..7312b034
--- /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 00000000..aad57ac2
--- /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 00000000..592fec20
--- /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 00000000..aad57ac2
--- /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 00000000..fecdb6ea
--- /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 00000000..aad57ac2
--- /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 00000000..d92f443e
--- /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 00000000..874953b2
--- /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 00000000..7e38a4e3
--- /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 00000000..0ca453f4
--- /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 00000000..9e28c45d
--- /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 00000000..cd7984b8
--- /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 00000000..e7783394
--- /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 00000000..a622ca67
--- /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 00000000..a7e79ab5
--- /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 00000000..2fa050b1
--- /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 00000000..5814ffff
--- /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 00000000..b49f4578
--- /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 00000000..2381824f
--- /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 00000000..fb2a98b3
--- /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 00000000..e2f418ce
--- /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 00000000..893aad47
--- /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 00000000..e2f418ce
--- /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 00000000..e2f418ce
--- /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 00000000..e2f418ce
--- /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 00000000..26c24d00
--- /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
--
2.12.0
More information about the Skiboot
mailing list