summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-02-26 10:02:39 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-03-24 13:59:32 +1030
commit50ab1de18f52d6b7d5f8b6c5ab79e495d5637f25 (patch)
treedf56199fba9d2ee9064f83b840b5eec02905e428
parent437c80f3e156c8f2f8c661944b719d59ad13169f (diff)
downloadphosphor-mboxd-50ab1de18f52d6b7d5f8b6c5ab79e495d5637f25.zip
phosphor-mboxd-50ab1de18f52d6b7d5f8b6c5ab79e495d5637f25.tar.gz
test: vpnor: Add toc_no_end
Change-Id: I0122a2239df3ec7c83e2bf778d4d8df5a348d495 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r--test/vpnor/Makefile.am.include10
-rw-r--r--test/vpnor/toc_no_end.cpp29
2 files changed, 38 insertions, 1 deletions
diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include
index 94c5377..873012c 100644
--- a/test/vpnor/Makefile.am.include
+++ b/test/vpnor/Makefile.am.include
@@ -86,6 +86,13 @@ test_vpnor_toc_no_start_SOURCES = \
test_vpnor_toc_no_start_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
test_vpnor_toc_no_start_LDADD = $(VPNOR_LDADD)
+test_vpnor_toc_no_end_SOURCES = \
+ common.c \
+ pnor_partition_table.cpp \
+ %reldir%/toc_no_end.cpp
+test_vpnor_toc_no_end_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
+test_vpnor_toc_no_end_LDADD = $(VPNOR_LDADD)
+
if VIRTUAL_PNOR_ENABLED
check_PROGRAMS += \
%reldir%/create_pnor_partition_table \
@@ -96,5 +103,6 @@ check_PROGRAMS += \
%reldir%/write_patch \
%reldir%/toc_no_name \
%reldir%/toc_start_gt_end \
- %reldir%/toc_no_start
+ %reldir%/toc_no_start \
+ %reldir%/toc_no_end
endif
diff --git a/test/vpnor/toc_no_end.cpp b/test/vpnor/toc_no_end.cpp
new file mode 100644
index 0000000..0d90b91
--- /dev/null
+++ b/test/vpnor/toc_no_end.cpp
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright (C) 2018 IBM Corp.
+
+#include "config.h"
+#include <assert.h>
+
+#include "pnor_partition_table.hpp"
+
+static constexpr auto BLOCK_SIZE = 4 * 1024;
+
+int main()
+{
+ namespace vpnor = openpower::virtual_pnor;
+
+ struct pnor_partition part;
+ std::string line;
+
+ line = "partition01=FOO,00001000,,80,ECC,PRESERVED";
+ try
+ {
+ openpower::virtual_pnor::parseTocLine(line, BLOCK_SIZE, part);
+ }
+ catch (vpnor::MalformedTocEntry& e)
+ {
+ return 0;
+ }
+
+ assert(false);
+}
OpenPOWER on IntegriCloud