Skip to content

Commit

Permalink
external/ffspart: Use new interface
Browse files Browse the repository at this point in the history
This also updated the pflash tests which use ffspart to generate pnors

Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
cyrilbur-ibm authored and stewartsmith committed Apr 9, 2018
1 parent 1622957 commit 9bd1bef
Show file tree
Hide file tree
Showing 60 changed files with 485 additions and 400 deletions.
535 changes: 331 additions & 204 deletions external/ffspart/ffspart.c

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions external/ffspart/test/files/03-tiny-pnor.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00400,0x00000100,EL,,/dev/zero
TWO,0x00500,0x00000100,EF,,/dev/zero
THREE,0x600,0x00000100,EF,,/dev/zero
FOUR,0x0700,0x00000100,EF,,/dev/zero
4 changes: 0 additions & 4 deletions external/ffspart/test/files/03.1-tiny-pnor-backup.in

This file was deleted.

Binary file not shown.
8 changes: 4 additions & 4 deletions external/ffspart/test/files/04-tiny-pnor2.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00000100,EL,,SEDCATCH_1
TWO,0x00000400,0x00000100,EF,,SEDCATCH_2
THREE,0x00000500,0x00000100,EF,,SEDCATCH_3
FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4
8 changes: 4 additions & 4 deletions external/ffspart/test/files/05-hdr-overlap.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000200,0x00000100,EV,,/dev/zero
TWO,0x00000300,0x00000100,EF,,/dev/zero
THREE,0x00000400,0x00000100,EF,,/dev/zero
FOUR,0x00000500,0x00000100,EF,,/dev/zero
3 changes: 0 additions & 3 deletions external/ffspart/test/files/05.1-hdr-overlap-backup.in

This file was deleted.

10 changes: 5 additions & 5 deletions external/ffspart/test/files/06-small-flash.in
Original file line number Diff line number Diff line change
@@ -1,5 +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
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
8 changes: 4 additions & 4 deletions external/ffspart/test/files/07-big-files.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00000100,EV,,SEDCATCH_1
TWO,0x00000400,0x00000100,EF,,SEDCATCH_2
THREE,0x00000500,0x00000100,EF,,SEDCATCH_3
FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4
8 changes: 4 additions & 4 deletions external/ffspart/test/files/08-small-files.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00000100,EV,,SEDCATCH_1
TWO,0x00000400,0x00000100,EF,,SEDCATCH_2
THREE,0x00000500,0x00000100,EF,,SEDCATCH_3
FOUR,0x00000600,0x00000100,EF,,SEDCATCH_4
8 changes: 4 additions & 4 deletions external/ffspart/test/files/10-bad-input.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE0x00000300,0x00000100,EV,,/dev/zero
TWO,0x00000400,0x00000100,EF,,/dev/zero
THREE,0x00000500,0x00000100,EF,,/dev/zero
FOUR,0x00000600,0x00000100,EF,,/dev/zero
8 changes: 4 additions & 4 deletions external/ffspart/test/files/11-long-name.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
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
8 changes: 4 additions & 4 deletions external/ffspart/test/files/12-bad-numbers-base.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0xg0000300,0x00000100,EV,,/dev/zero
TWO,0x00000400,0x00000100,EF,,/dev/zero
THREE,0x00000500,0x00000100,EF,,/dev/zero
FOUR,0x00000600,0x00000100,EF,,/dev/zero
8 changes: 4 additions & 4 deletions external/ffspart/test/files/13-bad-numbers-size.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00001g00,EV,,/dev/zero
TWO,0x00000400,0x00000100,EF,,/dev/zero
THREE,0x00000500,0x00000100,EF,,/dev/zero
FOUR,0x00000600,0x00000100,EF,,/dev/zero
8 changes: 4 additions & 4 deletions external/ffspart/test/files/14-bad-input-flags.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00000100,EVZ,,/dev/zero
TWO,0x00000400,0x00000100,EF,,/dev/zero
THREE,0x00000500,0x00000100,EF,,/dev/zero
FOUR,0x00000600,0x00000100,EF,,/dev/zero
8 changes: 4 additions & 4 deletions external/ffspart/test/files/15-overlapping-partitions.in
Original file line number Diff line number Diff line change
@@ -1,4 +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
ONE,0x00000300,0x00000100,EV,,/dev/zero
TWO,0x00000350,0x00000100,EF,,/dev/zero
THREE,0x00000500,0x00000100,EF,,/dev/zero
FOUR,0x00000600,0x00000100,EF,,/dev/zero
1 change: 0 additions & 1 deletion external/ffspart/test/results/01-param-sanity.err
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Greater than two sides is not supported
5 changes: 0 additions & 5 deletions external/ffspart/test/results/01-param-sanity.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ Usage: ./ffspart [options] -s size -c num -i layout_file -p pnor_file ...
-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)
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ Usage: ./ffspart [options] -s size -c num -i layout_file -p pnor_file ...
-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)
1 change: 0 additions & 1 deletion external/ffspart/test/results/02-param-sides.err

This file was deleted.

5 changes: 4 additions & 1 deletion external/ffspart/test/results/05-hdr-overlap.err
Original file line number Diff line number Diff line change
@@ -1,2 +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 entry 'THREE' 0x00000400 for 0x00000100
Couldn't add 'THREE' partition to default TOC: 107
Failed to parse input file 'FILE' at line 3
3 changes: 0 additions & 3 deletions external/ffspart/test/results/05-hdr-overlap.out
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
Adding 'ONE' 0x00000200, 0x00000100
Adding 'TWO' 0x00000300, 0x00000100
Adding 'THREE' 0x00000400, 0x00000100
2 changes: 0 additions & 2 deletions external/ffspart/test/results/05.1-hdr-overlap-backup.err

This file was deleted.

4 changes: 0 additions & 4 deletions external/ffspart/test/results/05.1-hdr-overlap-backup.out

This file was deleted.

5 changes: 4 additions & 1 deletion external/ffspart/test/results/06-small-flash.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Couldn't add entry 'TWO' 0x00000400 for 0x00000100
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
2 changes: 0 additions & 2 deletions external/ffspart/test/results/06-small-flash.out
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
Adding 'ONE' 0x00000300, 0x00000100
Adding 'TWO' 0x00000400, 0x00000100
5 changes: 4 additions & 1 deletion external/ffspart/test/results/07-big-files.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Data file for partition 'ONE' is too large
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
Failed to parse input file 'FILE' at line 1
1 change: 0 additions & 1 deletion external/ffspart/test/results/07-big-files.out
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Adding 'ONE' 0x00000300, 0x00000100
2 changes: 2 additions & 0 deletions external/ffspart/test/results/08-small-files.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WARNING: Attempting to parse a partition line without any TOCs created.
Generating a default TOC at zero
4 changes: 0 additions & 4 deletions external/ffspart/test/results/08-small-files.out
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
Adding 'ONE' 0x00000300, 0x00000100
Adding 'TWO' 0x00000400, 0x00000100
Adding 'THREE' 0x00000500, 0x00000100
Adding 'FOUR' 0x00000600, 0x00000100
5 changes: 4 additions & 1 deletion external/ffspart/test/results/10-bad-input.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Invalid input file format: Couldn't parse 'ONE0x00000300' partition length
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
6 changes: 4 additions & 2 deletions external/ffspart/test/results/11-long-name.err
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
WARNING: Long partition 'This_is_more_than_15_characters' name will get truncated
WARNING: Long partition 'This_is_one_more' name will get truncated
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'
4 changes: 0 additions & 4 deletions external/ffspart/test/results/11-long-name.out
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
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
5 changes: 4 additions & 1 deletion external/ffspart/test/results/12-bad-numbers-base.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Invalid input file format: Couldn't parse 'ONE' partition base address
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
5 changes: 4 additions & 1 deletion external/ffspart/test/results/13-bad-numbers-size.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Invalid input file format: Couldn't parse 'ONE' partition length
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
5 changes: 4 additions & 1 deletion external/ffspart/test/results/14-bad-input-flags.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Unknown flag 'Z'
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
5 changes: 4 additions & 1 deletion external/ffspart/test/results/15-overlapping-partitions.err
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Couldn't add entry 'TWO' 0x00000350 for 0x00000100
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
2 changes: 0 additions & 2 deletions external/ffspart/test/results/15-overlapping-partitions.out
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
Adding 'ONE' 0x00000300, 0x00000100
Adding 'TWO' 0x00000350, 0x00000100
6 changes: 1 addition & 5 deletions external/ffspart/test/tests/01-param-sanity
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#! /bin/sh

#This test has become a little redundant now.
#TODO Do more sanity checking
return 0

run_binary "./ffspart" "-s 1 -c 3 -i /dev/null -p /dev/null"
run_binary "./ffspart" "-c 3 -i /dev/null -p /dev/null"
if [ "$?" -ne 1 ] ; then
fail_test
fi
Expand Down
12 changes: 12 additions & 0 deletions external/ffspart/test/tests/01.1-param-sanity
Original file line number Diff line number Diff line change
@@ -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
16 changes: 0 additions & 16 deletions external/ffspart/test/tests/02-param-sides

This file was deleted.

19 changes: 0 additions & 19 deletions external/ffspart/test/tests/03.1-tiny-pnor-backup

This file was deleted.

7 changes: 3 additions & 4 deletions external/ffspart/test/tests/05-hdr-overlap
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
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
if [ "$?" -ne 6 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test
19 changes: 0 additions & 19 deletions external/ffspart/test/tests/05.1-hdr-overlap-backup

This file was deleted.

5 changes: 3 additions & 2 deletions external/ffspart/test/tests/06-small-flash
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
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
if [ "$?" -ne 6 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test
4 changes: 4 additions & 0 deletions external/ffspart/test/tests/07-big-files
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ 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
2 changes: 2 additions & 0 deletions external/ffspart/test/tests/10-bad-input
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$?" -eq 0 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test
2 changes: 2 additions & 0 deletions external/ffspart/test/tests/12-bad-numbers-base
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$?" -eq 0 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test
2 changes: 2 additions & 0 deletions external/ffspart/test/tests/13-bad-numbers-size
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$?" -eq 0 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test
2 changes: 2 additions & 0 deletions external/ffspart/test/tests/14-bad-input-flags
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$?" -eq 0 ] ; then
fail_test
fi

sed -i "s|$DATA_DIR/$CUR_TEST.in|FILE|" "$STDERR_OUT"

diff_with_result

pass_test

0 comments on commit 9bd1bef

Please sign in to comment.