Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright (C) 2018 IBM Corp. |
William A. Kennington III | d5f1d40 | 2018-10-11 13:55:04 -0700 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 5 | extern "C" { |
Andrew Jeffery | 035ad76 | 2019-03-18 13:02:01 +1030 | [diff] [blame] | 6 | #include "backend.h" |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 7 | #include "test/mbox.h" |
| 8 | #include "test/system.h" |
| 9 | } |
| 10 | |
Andrew Jeffery | de08ca2 | 2019-03-18 13:23:46 +1030 | [diff] [blame] | 11 | #include "vpnor/table.hpp" |
Andrew Jeffery | 30bcf84 | 2018-03-26 12:13:20 +1030 | [diff] [blame] | 12 | #include "vpnor/test/tmpd.hpp" |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 13 | |
Andrew Jeffery | 035ad76 | 2019-03-18 13:02:01 +1030 | [diff] [blame] | 14 | #include <cassert> |
| 15 | #include <cstring> |
| 16 | |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 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,00002000,80,", |
| 26 | "partition02=TWO,00002000,00003000,80,", |
| 27 | }; |
| 28 | |
| 29 | int main() |
| 30 | { |
| 31 | namespace test = openpower::virtual_pnor::test; |
| 32 | namespace fs = std::experimental::filesystem; |
| 33 | namespace vpnor = openpower::virtual_pnor; |
| 34 | |
| 35 | struct mbox_context* ctx; |
| 36 | |
| 37 | system_set_reserved_size(MEM_SIZE); |
| 38 | system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); |
| 39 | |
Evan Lojewski | f1e547c | 2019-03-14 14:34:33 +1030 | [diff] [blame] | 40 | ctx = mbox_create_frontend_context(N_WINDOWS, WINDOW_SIZE); |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 41 | |
Evan Lojewski | f1e547c | 2019-03-14 14:34:33 +1030 | [diff] [blame] | 42 | test::VpnorRoot root(&ctx->backend, toc, BLOCK_SIZE); |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 43 | |
| 44 | fs::remove(root.ro() / "TWO"); |
| 45 | |
| 46 | try |
| 47 | { |
Evan Lojewski | f1e547c | 2019-03-14 14:34:33 +1030 | [diff] [blame] | 48 | vpnor::partition::Table table(&ctx->backend); |
Andrew Jeffery | bfe6f80 | 2018-02-27 17:11:17 +1030 | [diff] [blame] | 49 | } |
| 50 | catch (vpnor::InvalidTocEntry& e) |
| 51 | { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | assert(false); |
| 56 | } |