diff options
Diffstat (limited to 'vpnor/test')
29 files changed, 99 insertions, 66 deletions
diff --git a/vpnor/test/create_pnor_partition_table.cpp b/vpnor/test/create_pnor_partition_table.cpp index 3a46e38..ab28180 100644 --- a/vpnor/test/create_pnor_partition_table.cpp +++ b/vpnor/test/create_pnor_partition_table.cpp @@ -1,11 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> +#include <string.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/create_read_window_oob.cpp b/vpnor/test/create_read_window_oob.cpp index 445b0a1..2b8fe6d 100644 --- a/vpnor/test/create_read_window_oob.cpp +++ b/vpnor/test/create_read_window_oob.cpp @@ -1,10 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> #include <string.h> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -41,7 +42,7 @@ int main() { namespace test = openpower::virtual_pnor::test; - struct mbox_context *ctx; + struct mbox_context* ctx; int rc; system_set_reserved_size(MEM_SIZE); diff --git a/vpnor/test/create_read_window_partition_exists.cpp b/vpnor/test/create_read_window_partition_exists.cpp index 12ac19b..f02272d 100644 --- a/vpnor/test/create_read_window_partition_exists.cpp +++ b/vpnor/test/create_read_window_partition_exists.cpp @@ -1,13 +1,15 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> +#include <string.h> + #include <experimental/filesystem> #include <fstream> -#include <string.h> #include <vector> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -47,7 +49,7 @@ namespace test = openpower::virtual_pnor::test; int main() { - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_read_window_partition_invalid.cpp b/vpnor/test/create_read_window_partition_invalid.cpp index 9ed4347..e6747c8 100644 --- a/vpnor/test/create_read_window_partition_invalid.cpp +++ b/vpnor/test/create_read_window_partition_invalid.cpp @@ -1,10 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> #include <string.h> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -37,7 +38,7 @@ int main() { namespace test = openpower::virtual_pnor::test; - struct mbox_context *ctx; + struct mbox_context* ctx; int rc; system_set_reserved_size(MEM_SIZE); diff --git a/vpnor/test/create_read_window_remap.cpp b/vpnor/test/create_read_window_remap.cpp index ea319c1..c05ef02 100644 --- a/vpnor/test/create_read_window_remap.cpp +++ b/vpnor/test/create_read_window_remap.cpp @@ -1,13 +1,15 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> +#include <string.h> + #include <experimental/filesystem> #include <fstream> -#include <string.h> #include <vector> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -41,7 +43,7 @@ int main() uint8_t response[] = {0x04, 0x01, 0xe0, 0xff, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_read_window_size.cpp b/vpnor/test/create_read_window_size.cpp index 1837546..6f9a7ed 100644 --- a/vpnor/test/create_read_window_size.cpp +++ b/vpnor/test/create_read_window_size.cpp @@ -1,10 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> + #include <experimental/filesystem> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -49,7 +51,7 @@ namespace test = openpower::virtual_pnor::test; int main() { - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_read_window_straddle_partitions.cpp b/vpnor/test/create_read_window_straddle_partitions.cpp index e396088..168598d 100644 --- a/vpnor/test/create_read_window_straddle_partitions.cpp +++ b/vpnor/test/create_read_window_straddle_partitions.cpp @@ -47,7 +47,7 @@ int main() namespace test = openpower::virtual_pnor::test; namespace fs = std::experimental::filesystem; - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_read_window_toc.cpp b/vpnor/test/create_read_window_toc.cpp index 32f6523..e0a5548 100644 --- a/vpnor/test/create_read_window_toc.cpp +++ b/vpnor/test/create_read_window_toc.cpp @@ -1,12 +1,13 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <sys/mman.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> +#include <string.h> +#include <sys/mman.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/create_write_window_ro_partition.cpp b/vpnor/test/create_write_window_ro_partition.cpp index 09dbba0..fa53003 100644 --- a/vpnor/test/create_write_window_ro_partition.cpp +++ b/vpnor/test/create_write_window_ro_partition.cpp @@ -1,9 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -39,7 +40,7 @@ namespace test = openpower::virtual_pnor::test; int main() { - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_write_window_rw_partition.cpp b/vpnor/test/create_write_window_rw_partition.cpp index 74b5831..896c284 100644 --- a/vpnor/test/create_write_window_rw_partition.cpp +++ b/vpnor/test/create_write_window_rw_partition.cpp @@ -1,9 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -39,7 +40,7 @@ namespace test = openpower::virtual_pnor::test; int main() { - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(MEM_SIZE, ERASE_SIZE); diff --git a/vpnor/test/create_write_window_unmapped.cpp b/vpnor/test/create_write_window_unmapped.cpp index 47ba57e..e26749e 100644 --- a/vpnor/test/create_write_window_unmapped.cpp +++ b/vpnor/test/create_write_window_unmapped.cpp @@ -1,9 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> -#include "config.h" #include "vpnor/mboxd_pnor_partition_table.h" extern "C" { @@ -40,7 +41,7 @@ namespace test = openpower::virtual_pnor::test; int main() { - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE); diff --git a/vpnor/test/dump_flash.cpp b/vpnor/test/dump_flash.cpp index 905bebd..84a88d8 100644 --- a/vpnor/test/dump_flash.cpp +++ b/vpnor/test/dump_flash.cpp @@ -1,10 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> #include <string.h> -#include "config.h" #include "transport_mbox.h" #include "vpnor/mboxd_pnor_partition_table.h" @@ -18,7 +19,7 @@ extern "C" { struct test_context { uint8_t seq; - struct mbox_context *ctx; + struct mbox_context* ctx; }; // Configure the system and the paritions such that we eventually request a @@ -41,7 +42,7 @@ static const uint8_t get_info[] = {0x02, 0x00, 0x02, 0x00, 0x00, 0x00, static constexpr auto MBOX_CREATE_READ_WINDOW = 4; -static int mbox_create_read_window(struct test_context *tctx, size_t offset, +static int mbox_create_read_window(struct test_context* tctx, size_t offset, size_t len) { union mbox_regs regs; diff --git a/vpnor/test/read_patch.cpp b/vpnor/test/read_patch.cpp index 31a422e..9429d4d 100644 --- a/vpnor/test/read_patch.cpp +++ b/vpnor/test/read_patch.cpp @@ -2,11 +2,12 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include "common.h" -#include "vpnor/mboxd_pnor_partition_table.h" #include <assert.h> +#include "common.h" +#include "vpnor/mboxd_pnor_partition_table.h" + extern "C" { #include "test/mbox.h" #include "test/system.h" @@ -42,7 +43,7 @@ int main() { namespace test = openpower::virtual_pnor::test; - struct mbox_context *ctx; + struct mbox_context* ctx; system_set_reserved_size(MEM_SIZE); system_set_mtd_sizes(PNOR_SIZE, ERASE_SIZE); diff --git a/vpnor/test/tmpd.cpp b/vpnor/test/tmpd.cpp index 1aaa1fb..917fb71 100644 --- a/vpnor/test/tmpd.cpp +++ b/vpnor/test/tmpd.cpp @@ -12,7 +12,7 @@ namespace test namespace fs = std::experimental::filesystem; -size_t VpnorRoot::write(const std::string &name, const void *data, size_t len) +size_t VpnorRoot::write(const std::string& name, const void* data, size_t len) { // write() is for test environment setup - always write to ro section fs::path path = root / "ro" / name; @@ -21,18 +21,18 @@ size_t VpnorRoot::write(const std::string &name, const void *data, size_t len) /* It's not in the ToC */ throw std::invalid_argument(name); - std::ofstream(path).write((const char *)data, len); + std::ofstream(path).write((const char*)data, len); return len; } -size_t VpnorRoot::patch(const std::string &name, const void *data, size_t len) +size_t VpnorRoot::patch(const std::string& name, const void* data, size_t len) { if (!fs::exists(root / "ro" / name)) /* It's not in the ToC */ throw std::invalid_argument(name); - std::ofstream(root / "patch" / name).write((const char *)data, len); + std::ofstream(root / "patch" / name).write((const char*)data, len); return len; } diff --git a/vpnor/test/tmpd.hpp b/vpnor/test/tmpd.hpp index 19890eb..2239f9c 100644 --- a/vpnor/test/tmpd.hpp +++ b/vpnor/test/tmpd.hpp @@ -1,15 +1,18 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright (C) 2018 IBM Corp. */ +#include "config.h" + +#include "vpnor/pnor_partition_table.hpp" + #include <assert.h> #include <string.h> -#include <vector> -#include <fstream> + #include <experimental/filesystem> +#include <fstream> +#include <vector> -#include "config.h" #include "mboxd.h" -#include "vpnor/pnor_partition_table.hpp" namespace openpower { diff --git a/vpnor/test/toc_flags.cpp b/vpnor/test/toc_flags.cpp index c30f7ad..b32b6c2 100644 --- a/vpnor/test/toc_flags.cpp +++ b/vpnor/test/toc_flags.cpp @@ -2,11 +2,13 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" + +#include "vpnor/pnor_partition_table.hpp" + #include <assert.h> #include "common.h" #include "vpnor/pnor_partition_defs.h" -#include "vpnor/pnor_partition_table.hpp" static constexpr auto BLOCK_SIZE = 4 * 1024; static constexpr auto DATA_MASK = ((1 << 24) - 1); diff --git a/vpnor/test/toc_lookup_failed.cpp b/vpnor/test/toc_lookup_failed.cpp index 199a00b..7c68c7d 100644 --- a/vpnor/test/toc_lookup_failed.cpp +++ b/vpnor/test/toc_lookup_failed.cpp @@ -1,12 +1,13 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" #include "xyz/openbmc_project/Common/error.hpp" +#include <assert.h> +#include <string.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/toc_lookup_found.cpp b/vpnor/test/toc_lookup_found.cpp index 411e3f8..507f6d9 100644 --- a/vpnor/test/toc_lookup_found.cpp +++ b/vpnor/test/toc_lookup_found.cpp @@ -1,11 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> +#include <string.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/toc_missing_file.cpp b/vpnor/test/toc_missing_file.cpp index 821653f..117a0bf 100644 --- a/vpnor/test/toc_missing_file.cpp +++ b/vpnor/test/toc_missing_file.cpp @@ -1,11 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> +#include <string.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/toc_no_end.cpp b/vpnor/test/toc_no_end.cpp index f9c5187..1eff2f2 100644 --- a/vpnor/test/toc_no_end.cpp +++ b/vpnor/test/toc_no_end.cpp @@ -2,10 +2,11 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include <assert.h> #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> + static constexpr auto BLOCK_SIZE = 4 * 1024; int main() diff --git a/vpnor/test/toc_no_name.cpp b/vpnor/test/toc_no_name.cpp index d62056f..0415ead 100644 --- a/vpnor/test/toc_no_name.cpp +++ b/vpnor/test/toc_no_name.cpp @@ -2,10 +2,11 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include <assert.h> #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> + static constexpr auto BLOCK_SIZE = 4 * 1024; int main() diff --git a/vpnor/test/toc_no_start.cpp b/vpnor/test/toc_no_start.cpp index 1d20a46..e07c5d4 100644 --- a/vpnor/test/toc_no_start.cpp +++ b/vpnor/test/toc_no_start.cpp @@ -2,10 +2,11 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include <assert.h> #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> + static constexpr auto BLOCK_SIZE = 4 * 1024; int main() diff --git a/vpnor/test/toc_no_version.cpp b/vpnor/test/toc_no_version.cpp index 68cb057..65ed071 100644 --- a/vpnor/test/toc_no_version.cpp +++ b/vpnor/test/toc_no_version.cpp @@ -2,10 +2,11 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include <assert.h> #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> + static constexpr auto BLOCK_SIZE = 4 * 1024; int main() diff --git a/vpnor/test/toc_overlap.cpp b/vpnor/test/toc_overlap.cpp index 94d071c..70a992e 100644 --- a/vpnor/test/toc_overlap.cpp +++ b/vpnor/test/toc_overlap.cpp @@ -1,11 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. -#include <assert.h> -#include <string.h> - #include "config.h" + #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> +#include <string.h> + extern "C" { #include "test/mbox.h" #include "test/system.h" diff --git a/vpnor/test/toc_start_gt_end.cpp b/vpnor/test/toc_start_gt_end.cpp index 69edc63..ea64344 100644 --- a/vpnor/test/toc_start_gt_end.cpp +++ b/vpnor/test/toc_start_gt_end.cpp @@ -2,10 +2,11 @@ // Copyright (C) 2018 IBM Corp. #include "config.h" -#include <assert.h> #include "vpnor/pnor_partition_table.hpp" +#include <assert.h> + static constexpr auto BLOCK_SIZE = 4 * 1024; int main() diff --git a/vpnor/test/write_patch.cpp b/vpnor/test/write_patch.cpp index e5a367d..b735d10 100644 --- a/vpnor/test/write_patch.cpp +++ b/vpnor/test/write_patch.cpp @@ -1,15 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> -#include <experimental/filesystem> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/syslog.h> #include <unistd.h> -#include "config.h" +#include <experimental/filesystem> + #include "common.h" #include "mboxd.h" extern "C" { @@ -35,7 +37,7 @@ int main(void) struct mbox_context _ctx, *ctx = &_ctx; char src[DATA_SIZE]{0}; - void *map; + void* map; int rc; int fd; diff --git a/vpnor/test/write_patch_resize.cpp b/vpnor/test/write_patch_resize.cpp index 28a73ce..866333f 100644 --- a/vpnor/test/write_patch_resize.cpp +++ b/vpnor/test/write_patch_resize.cpp @@ -1,8 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. +#include "config.h" + #include <assert.h> -#include <experimental/filesystem> #include <fcntl.h> #include <stdint.h> #include <sys/ioctl.h> @@ -10,7 +11,8 @@ #include <sys/syslog.h> #include <unistd.h> -#include "config.h" +#include <experimental/filesystem> + #include "common.h" #include "mboxd.h" @@ -35,7 +37,7 @@ int main(void) namespace test = openpower::virtual_pnor::test; struct mbox_context _ctx, *ctx = &_ctx; - void *map; + void* map; int rc; int fd; diff --git a/vpnor/test/write_prsv.cpp b/vpnor/test/write_prsv.cpp index 21a0366..69b4989 100644 --- a/vpnor/test/write_prsv.cpp +++ b/vpnor/test/write_prsv.cpp @@ -30,7 +30,7 @@ int main(void) struct mbox_context _ctx, *ctx = &_ctx; uint8_t src[8]; - void *map; + void* map; int fd; int rc; diff --git a/vpnor/test/write_rw.cpp b/vpnor/test/write_rw.cpp index c40af6a..c9d2b60 100644 --- a/vpnor/test/write_rw.cpp +++ b/vpnor/test/write_rw.cpp @@ -29,7 +29,7 @@ int main(void) struct mbox_context _ctx, *ctx = &_ctx; uint8_t src[8] = {0}; - void *map; + void* map; int rc; int fd; |