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