aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2018-11-29 10:31:54 +1030
committerStewart Smith <stewart@linux.ibm.com>2018-11-28 20:17:26 -0600
commitad2ca201f46c2d238d78880a155cdf09298edc65 (patch)
tree508e2be0ae4f4cceaeeeaab4078285464c9892cb /external
parent35e735ae24ebb3c49b96b4824c0ff9a46301e9b7 (diff)
downloadskiboot-ad2ca201f46c2d238d78880a155cdf09298edc65.zip
skiboot-ad2ca201f46c2d238d78880a155cdf09298edc65.tar.gz
skiboot-ad2ca201f46c2d238d78880a155cdf09298edc65.tar.bz2
ffspart: Add test for eraseblock size
This test checks that the partitions are correctly laid out when the eraseblock size is greater than the start of the first partition. Currently ffspart fails to create a valid image in this case. There are two tests. The second is expected to fail but it is marked as passing for now. This test requires pflash to work. Currently we leave that as an exercise for the user. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/ffspart/test/files/18-eraseblock-gt-first-partition.in2
-rw-r--r--external/ffspart/test/tests/18-eraseblock-gt-first-partition45
2 files changed, 47 insertions, 0 deletions
diff --git a/external/ffspart/test/files/18-eraseblock-gt-first-partition.in b/external/ffspart/test/files/18-eraseblock-gt-first-partition.in
new file mode 100644
index 0000000..bed9136
--- /dev/null
+++ b/external/ffspart/test/files/18-eraseblock-gt-first-partition.in
@@ -0,0 +1,2 @@
+@0,0x0,
+FIRST,0x400,0x100,,,/dev/zero
diff --git a/external/ffspart/test/tests/18-eraseblock-gt-first-partition b/external/ffspart/test/tests/18-eraseblock-gt-first-partition
new file mode 100644
index 0000000..6626651
--- /dev/null
+++ b/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