From f2c87a3d2f6df0886124636239d9950ef0abcab0 Mon Sep 17 00:00:00 2001 From: Michael Tritz Date: Wed, 12 Jul 2017 15:31:49 -0500 Subject: pflash option to retrieve PNOR partition flags This commit extends pflash with an option to retrieve and print information for a particular partition, including the content from "pflash -i" and a verbose list of set miscellaneous flags. -i option is also updated to print a short list of flags in addition to the ECC flag, with one character per flag. A test of the new option is included in libflash/test. Signed-off-by: Michael Tritz Reviewed-by: Cyril Bur [stewart@linux.vnet.ibm.com: various test fixes, enable gcov] Signed-off-by: Stewart Smith --- libflash/test/Makefile.check | 7 +++++-- libflash/test/test-miscprint.pnor | Bin 0 -> 3072 bytes libflash/test/test-miscprint.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 libflash/test/test-miscprint.pnor create mode 100755 libflash/test/test-miscprint.sh (limited to 'libflash/test') diff --git a/libflash/test/Makefile.check b/libflash/test/Makefile.check index 1f92b9d2..344cad0a 100644 --- a/libflash/test/Makefile.check +++ b/libflash/test/Makefile.check @@ -4,8 +4,8 @@ LIBFLASH_TEST := libflash/test/test-flash libflash/test/test-ecc libflash/test/t LCOV_EXCLUDE += $(LIBFLASH_TEST:%=%.c) .PHONY : libflash-check libc-coverage -libflash-check: $(LIBFLASH_TEST:%=%-check) $(CORE_TEST:%=%-gcov-run) -libflash-coverage: $(LIBFLASH_TEST:%=%-gcov-run) +libflash-check: $(LIBFLASH_TEST:%=%-check) libflash/test/test-miscprint $(CORE_TEST:%=%-gcov-run) +libflash-coverage: $(LIBFLASH_TEST:%=%-gcov-run) libflash/test/test-miscprint check: libflash-check libc-coverage coverage: libflash-coverage @@ -16,6 +16,9 @@ $(LIBFLASH_TEST:%=%-gcov-run) : %-run: % $(LIBFLASH_TEST:%=%-check) : %-check: % $(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<) +libflash/test/test-miscprint: pflash + $(call Q, RUN-TEST , ./libflash/test/test-miscprint.sh, $@) + libflash/test/stubs.o: libflash/test/stubs.c $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -g -c -o $@ $<, $<) diff --git a/libflash/test/test-miscprint.pnor b/libflash/test/test-miscprint.pnor new file mode 100644 index 00000000..8a84ebaf Binary files /dev/null and b/libflash/test/test-miscprint.pnor differ diff --git a/libflash/test/test-miscprint.sh b/libflash/test/test-miscprint.sh new file mode 100755 index 00000000..b84a6cf4 --- /dev/null +++ b/libflash/test/test-miscprint.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# test-miscprint.pnor is constructed as follows: +# PRESERVED,0x00000300,0x00000100,P,/dev/zero +# READONLY,0x00000400,0x00000100,R,/dev/zero +# REPROVISION,0x00000500,0x00000100,F,/dev/zero +# BACKUP,0x00000600,0x00000100,B,/dev/zero + +wd="libflash/test" +pflash="./external/pflash/pflash" + +pnor="$wd/test-miscprint.pnor" + +output1=$(${pflash} --detail=1 -F "$pnor" | grep "\[P\]") +output2=$(${pflash} --detail=2 -F "$pnor" | grep "\[R\]") +output3=$(${pflash} --detail=3 -F "$pnor" | grep "\[F\]") +output4=$(${pflash} --detail=4 -F "$pnor" | grep "\[B\]") + +if [[ $output1 == "PRESERVED [P]" && $output2 == "READONLY [R]" && + $output3 == "REPROVISION [F]" && $output4 == "BACKUP [B]" ]]; then + echo "Test passed!" + exit 0; +else + echo "Test failed!" + exit 1; +fi + -- cgit v1.2.1