blob: 70a992e98edf13e5ac4b175c15373545205f11fb [file] [log] [blame]
Andrew Jefferyf5a51382018-02-27 16:17:53 +10301// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2018 IBM Corp.
William A. Kennington IIId5f1d402018-10-11 13:55:04 -07003#include "config.h"
4
5#include "vpnor/pnor_partition_table.hpp"
6
Andrew Jefferyf5a51382018-02-27 16:17:53 +10307#include <assert.h>
8#include <string.h>
9
Andrew Jefferyf5a51382018-02-27 16:17:53 +103010extern "C" {
11#include "test/mbox.h"
12#include "test/system.h"
13}
14
Andrew Jeffery30bcf842018-03-26 12:13:20 +103015#include "vpnor/test/tmpd.hpp"
Andrew Jefferyf5a51382018-02-27 16:17:53 +103016
17static constexpr auto BLOCK_SIZE = 0x1000;
18static constexpr auto ERASE_SIZE = BLOCK_SIZE;
19static constexpr auto PNOR_SIZE = 64 * 1024 * 1024;
20static constexpr auto MEM_SIZE = 32 * 1024 * 1024;
21static constexpr auto N_WINDOWS = 1;
22static constexpr auto WINDOW_SIZE = BLOCK_SIZE * 2;
23
24const std::string toc[] = {
25 "partition01=ONE,00001000,00003000,80,",
26 "partition02=TWO,00002000,00004000,80,",
27};
28
29int main()
30{
31 namespace test = openpower::virtual_pnor::test;
32 namespace vpnor = openpower::virtual_pnor;
33
34 struct mbox_context* ctx;
35
36 system_set_reserved_size(MEM_SIZE);
37 system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE);
38
39 ctx = mbox_create_test_context(N_WINDOWS, WINDOW_SIZE);
40
41 test::VpnorRoot root(ctx, toc, BLOCK_SIZE);
42
43 try
44 {
Andrew Jeffery742a1f62018-03-02 09:26:03 +103045 vpnor::partition::Table table(ctx);
Andrew Jefferyf5a51382018-02-27 16:17:53 +103046 }
47 catch (vpnor::InvalidTocEntry& e)
48 {
49 return 0;
50 }
51
52 assert(false);
53}