xref: /openbmc/hiomapd/vpnor/test/toc_overlap.cpp (revision de08ca2d)
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright (C) 2018 IBM Corp.
3 #include "config.h"
4 
5 #include "vpnor/table.hpp"
6 
7 #include <cassert>
8 #include <cstring>
9 
10 extern "C" {
11 #include "test/mbox.h"
12 #include "test/system.h"
13 }
14 
15 #include "vpnor/test/tmpd.hpp"
16 
17 static constexpr auto BLOCK_SIZE = 0x1000;
18 static constexpr auto ERASE_SIZE = BLOCK_SIZE;
19 static constexpr auto PNOR_SIZE = 64 * 1024 * 1024;
20 static constexpr auto MEM_SIZE = 32 * 1024 * 1024;
21 static constexpr auto N_WINDOWS = 1;
22 static constexpr auto WINDOW_SIZE = BLOCK_SIZE * 2;
23 
24 const std::string toc[] = {
25     "partition01=ONE,00001000,00003000,80,",
26     "partition02=TWO,00002000,00004000,80,",
27 };
28 
main()29 int 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_frontend_context(N_WINDOWS, WINDOW_SIZE);
40 
41     try
42     {
43         test::VpnorRoot root(&ctx->backend, toc, BLOCK_SIZE);
44     }
45     catch (std::system_error& e)
46     {
47         return 0;
48     }
49 
50     assert(false);
51 }
52