From b02ef4340b59ba0ddcfd1d258a328feb1888c64a Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Mon, 26 Feb 2018 09:57:17 +1030 Subject: test: vpnor: Add toc_no_name Change-Id: I30325d8dbee300fc93911a7e9e2650fc592a7055 Signed-off-by: Andrew Jeffery --- test/vpnor/Makefile.am.include | 10 +++++++++- test/vpnor/toc_no_name.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/vpnor/toc_no_name.cpp diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include index e58f6ac..f1034a7 100644 --- a/test/vpnor/Makefile.am.include +++ b/test/vpnor/Makefile.am.include @@ -65,6 +65,13 @@ test_vpnor_write_rw_SOURCES = \ test_vpnor_write_rw_LDFLAGS = $(OESDK_TESTCASE_FLAGS) test_vpnor_write_rw_LDADD = $(VPNOR_LDADD) +test_vpnor_toc_no_name_SOURCES = \ + common.c \ + pnor_partition_table.cpp \ + %reldir%/toc_no_name.cpp +test_vpnor_toc_no_name_LDFLAGS = $(OESDK_TESTCASE_FLAGS) +test_vpnor_toc_no_name_LDADD = $(VPNOR_LDADD) + if VIRTUAL_PNOR_ENABLED check_PROGRAMS += \ %reldir%/create_pnor_partition_table \ @@ -72,5 +79,6 @@ check_PROGRAMS += \ %reldir%/write_prsv \ %reldir%/write_ro \ %reldir%/write_rw \ - %reldir%/write_patch + %reldir%/write_patch \ + %reldir%/toc_no_name endif diff --git a/test/vpnor/toc_no_name.cpp b/test/vpnor/toc_no_name.cpp new file mode 100644 index 0000000..06dea8c --- /dev/null +++ b/test/vpnor/toc_no_name.cpp @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2018 IBM Corp. + +#include "config.h" +#include + +#include "pnor_partition_table.hpp" + +static constexpr auto BLOCK_SIZE = 4 * 1024; + +int main() +{ + namespace vpnor = openpower::virtual_pnor; + + const std::string line = "partition01=,00000000,00000400,80,ECC,PRESERVED"; + struct pnor_partition part; + + try + { + vpnor::parseTocLine(line, BLOCK_SIZE, part); + } + catch (vpnor::MalformedTocEntry& e) + { + return 0; + } + + assert(false); +} -- cgit v1.2.1