summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: vpnor: Add create_read_window_partition_invalidAndrew Jeffery2018-03-242-1/+71
| | | | | | | | The CREATE_READ_WINDOW request asks for an offset below the one defined partition, between it and the ToC. Change-Id: Iafaa530a3d6b02626106508b81c7aa7eaef9c876 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Raise exception for unmapped offsetsAndrew Jeffery2018-03-242-3/+1
| | | | | | | | | | | | | | | Allow reads and writes of offsets that don't map onto partitions defined in the ToC. Do so by ignoring the mapping failure and filling a window with 0xff in the hole from the requested offset to the following partition. This change also removes the reliance on InternalFailure as the exception of choice for communicating failures. We can do better without the teeth-pulling required by phosphor-logging by translating custom exceptions into phosphor-logging exceptions at the edges. Change-Id: Ibfa961a66b0b979354c6dc226ccbe7e9fbafc16d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_straddle_partitionsAndrew Jeffery2018-03-242-1/+89
| | | | | Change-Id: Icde607847812bcba3c7e2a131d7f46e223d44440 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_tocAndrew Jeffery2018-03-242-1/+96
| | | | | | | | As the handling of the ToC is separate to the mapping of other partitions, ensure we have appropriate coverage of copy_flash. Change-Id: If362c667df65b2648849cab2e0c11ebe0416d254 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_oobAndrew Jeffery2018-03-242-1/+82
| | | | | | | | Attempts to access an offset beyond the end of what's defined in the partition table. Change-Id: I43c55423625261947965155cb1d53ef276a4ed05 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_missing_fileAndrew Jeffery2018-03-242-1/+72
| | | | | Change-Id: I6fb96c921bead334ff178d0d78e9c7e7c7234f0a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_lookup_failedAndrew Jeffery2018-03-242-1/+71
| | | | | Change-Id: I3dbb4a14c5052c1689f930744a59b465b482fb68 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_lookup_foundAndrew Jeffery2018-03-242-1/+67
| | | | | Change-Id: I5243ee9d093445437cc6d75400d1d51ff5885719 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Disallow overlapping partitionsAndrew Jeffery2018-03-241-2/+0
| | | | | Change-Id: I25c6a6c4cee69ce9ba28c238851c7b7c622bb9b3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_overlapAndrew Jeffery2018-03-242-1/+71
| | | | | Change-Id: Iafddb01ad174b27e3f12272e107cc0323d824c81 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Fixes for flag handling in writeUserData()Andrew Jeffery2018-03-241-2/+0
| | | | | | | | | | | | | | This is a collection of small fixes: * Always initialise the field for PARTITION_ECC_PROTECTED so it doesn't contain garbage * Provide a warning when we encounter a flag we don't understand * Ignore empty flags so we don't trigger the unknown flag warning * Unset the READONLY bit if we encounter READWRITE, implementing last-configuration-wins rather than sticky-readonly Change-Id: I3dd45139716fe241f9d3e7997e1269d13de638ca Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_flagsAndrew Jeffery2018-03-242-1/+88
| | | | | | | Exercises the flags associated with FFS properties. Change-Id: Id710784cbbf3115712f7ce55e1fd38c8889b2c1f Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_no_versionAndrew Jeffery2018-03-242-1/+38
| | | | | Change-Id: I17e876fcb18b69d29bcc439e0f270760e015f246 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_no_endAndrew Jeffery2018-03-242-1/+38
| | | | | Change-Id: I0122a2239df3ec7c83e2bf778d4d8df5a348d495 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_no_startAndrew Jeffery2018-03-242-1/+38
| | | | | Change-Id: If712eac2e0f7b2c46e8bd473a5dc1c5b62c534b4 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Disallow ToC entries with start greater than endAndrew Jeffery2018-03-241-3/+0
| | | | | Change-Id: If0861efb0f6bccf82a2df94204821f22198e17b0 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_start_gt_endAndrew Jeffery2018-03-242-1/+40
| | | | | Change-Id: Iaac0e7783f1ceba0d009fcd4865861b0109639e4 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add toc_no_nameAndrew Jeffery2018-03-242-1/+37
| | | | | Change-Id: I30325d8dbee300fc93911a7e9e2650fc592a7055 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Fix partition sizes in create_read_window_partition_existsAndrew Jeffery2018-03-241-21/+15
| | | | | | | | | | The CREATE_READ_WINDOW command supplied by the test case worked by accident more than design with respect to the specified PNOR layout. Make the partition size one block for sanity. Change-Id: I2f3e55c8be309b3940447148289b0c5aced0b094 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Rename create_read_window_vpnorAndrew Jeffery2018-03-242-23/+7
| | | | | | | | For separate tests of access to offsets that do and don't contain a partition. Change-Id: I2466821b81eb721eeffe7db02d177c6f78e06101 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Rename write_flash_pnor to write_patch and clean upAndrew Jeffery2018-03-243-180/+88
| | | | | Change-Id: I36f3946487d0b613fa0ada9bfa777e4d12444fac Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_rw from write_flash_vpnorAndrew Jeffery2018-03-243-11/+112
| | | | | Change-Id: Idec2747e2233eea5631740ed702623b5e4409a1c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_ro from write_flash_vpnorAndrew Jeffery2018-03-243-13/+62
| | | | | Change-Id: I10b82d84cd40d52b0a489dc834269eec1a0d5240 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Extract write_prsv from write_flash_vpnorAndrew Jeffery2018-03-243-21/+78
| | | | | Change-Id: I71641b2c67eebf0b2babd677a46dbc45e0848795 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Reduce clutter by defining VPNOR_LDADDAndrew Jeffery2018-03-241-12/+8
| | | | | | | | Define a new variable to capture the library requirements of the vpnor tests. Change-Id: I966f699a9a96ee943602476d1d1015347cfe9c0b Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: write_flash_vpnor: Remove unused macroAndrew Jeffery2018-03-241-1/+0
| | | | | Change-Id: I635a085283d86a1f672f736a26981901d38ea599 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Populate path members under struct mbox_contextAndrew Jeffery2018-03-244-21/+22
| | | | | Change-Id: I9d18bd108d1c0972a5fefa384152757a2483c103 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: write_flash_vpnor: Integrate VpnorRootAndrew Jeffery2018-03-241-77/+30
| | | | | Change-Id: I5d49a090482d280317e75c7a7e2dc68d7fa265e2 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Make VpnorRoot the parent of ro/rw/prsv/patchAndrew Jeffery2018-03-244-29/+35
| | | | | | | | | | | | Previously it represented any one of the ro/rw/prsv/patch directories. It's better if we can deal with all of them at once, so rework the abstraction. In the process, the patch exploits other features of std::experimental::filesystem to increase readability of the code. Change-Id: I06000709622dd66945cc88cb5333847c69215dc7 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* create_read_window_vpnor: Integrate VpnorRootAndrew Jeffery2018-03-241-24/+19
| | | | | Change-Id: Ibb2ea631d3bb903a6607edac085d3025479e5ff7 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: tmpd: Replace createVpnorRoot() with VpnorRoot classAndrew Jeffery2018-03-244-34/+87
| | | | | | | | | The VpnorRoot class prepares a temporary directory for use as a VPNOR backing store. Implementing it as a class allows us to use RAII to get it to clean up after itself. Change-Id: Ia5a839e751f8dc2126a4c0b474e9a7b8593cfd57 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Add temporary directory helper for virtual PNOR testsAndrew Jeffery2018-03-242-31/+57
| | | | | | | | | Move the createVpnorTree() helper function out from the create_pnor_partition_table test case into its own header. This way multiple tests can make use of its function. Change-Id: Ieb4149e736c7ff87ecdbf7aa586b58baf936cd97 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* create_pnor_partition_table: Extract helper for vpnor treesAndrew Jeffery2018-03-241-19/+44
| | | | | | | | | | | | | | | | The helper function makes use of parseTocLine() which we just spent a bunch of effort on extracting from the Table class. This means the tests and the daemon both share the same parsing code, and thus the same bugs. By passing in an array of ToC line strings we can have enough information to populate a directory tree of test zeroed out files in the read-only directory and write the corresponding ToC file. This way when the code under test is pointed at the read-only directory it can correctly construct the environment dictated by the test code and begin servicing access requests. Change-Id: I229393be5f53913c9f61102bbb5f8f7f9177c39e Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* misc: Replace license blurb with kernel-style SPDX markersAndrew Jeffery2018-03-2434-612/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was roughly achieved by the following shell script: $ git ls-files | grep '\.[ch]p*$' | while read F; do EXT=${F##*.}; cat spdx.$EXT <(sed '/^\/\*$/,/^ \*\/$/d' $F) > ${F}.tmp; mv ${F}.tmp $F; done With the following context: $ cat spdx.c // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. $ cat spdx.h /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright (C) 2018 IBM Corp. */ $ ls -l spdx.* -rw-r--r-- 1 andrew andrew 71 Feb 27 12:02 spdx.c lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.cpp -> spdx.c -rw-r--r-- 1 andrew andrew 77 Feb 27 12:02 spdx.h lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.hpp -> spdx.h The `sed` invocation catches a lot of function documentation, so the hunks were manually added to avoid removing information that we want to keep. Change-Id: I63e49ca2593aa0db0568c7a63bfdead388642e76 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* misc: Add license blurb to unlicensed filesAndrew Jeffery2018-03-243-0/+55
| | | | | | | | | | | | | | | This was roughly achieved with: $ git ls-files | grep '.[ch]p*$' | while read F; do head -n 1 $F | fgrep -v '/*' > /dev/null && echo $F; done | while read L; do cat apache $L > ${L}.tmp; mv ${L}.tmp ${L}; done Some fixups performed by hand to eliminate modifications to files that were hit which should not have been. Change-Id: I9fa5af4644687d8b595a6cf70d6f7575a767d11a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Move related tests to vpnor directoryAndrew Jeffery2018-03-245-76/+76
| | | | | Change-Id: I5fe7f625ad642cef17fe53bd244dcde8fd99f3ad Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Move tests to a separate Makefile fragmentAndrew Jeffery2018-03-241-0/+178
| | | | | Change-Id: I46d5b165ed668ace67ae237b16d65a24586dd87d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Format C++ files according to OpenBMC style guideAndrew Jeffery2018-03-193-61/+51
| | | | | | | We don't touch the C yet as upstream hasn't got such a change in place. Change-Id: Ie6cab4bf99df520bb6655b9b00ae31e762e3c57b Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: system: Return memory size rather than mtd size in LPC ioctlAndrew Jeffery2018-03-191-1/+1
| | | | | | | | | The old behaviour was an outright bug in the system framework. The size of the LPC reserved memory window has nothing to do with the size of the flash. Change-Id: Ie16686ac6df8fb3117fb46aa2eaab082873fd4d0 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: mbox: Type buf parameter to dump_buf() as `const void *`Andrew Jeffery2018-03-192-3/+4
| | | | | | | | This makes it a bit more ergonomic to use by not forcing the caller to cast. Change-Id: I5d40715f4de84f174157a39d459dc1b40a94a949 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Update tmpf to store data in /tmp, reformat namesAndrew Jeffery2018-03-196-7/+22
| | | | | | | | | Cleans up residuals from failed tests in the source tree by moving them to /tmp. Some were annoying to remove with prefixes like 'mbox', so change the pattern as well to include '-store'. Change-Id: I674664a372e7e15ec4c3cd93d33318c4135f33ba Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Fix memory leak in write_flash_vpnorAndrew Jeffery2018-02-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the test suite when configuring the source via `./bootstrap.sh dev` leads to a failure of the write_flash_vpnor test with the report below in test-suite.log. Add the necessary cleanup to ensure the test suite passes cleanly. =================================== mboxd 2.1.0: ./test-suite.log =================================== .. contents:: :depth: 2 FAIL: test/write_flash_vpnor ============================ [ 1519173867.854683139] Write flash @ 0x00003000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.854904248] Didn't find the file in the desired partition so copying[/tmp/prsv.RY6KiO/TEST3] [ 1519173867.854979940] File copied from[/tmp/ro.dUeyxG/TEST3] to [/tmp/prsv.RY6KiO/TEST3] [ 1519173867.855082198] Write flash @ 0x00001000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857098822] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857249802] Write flash @ 0x00002003 for 0x0000001c from 0x7ffe94d51ae0 [ 1519173867.857806832] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51ae0 [ 1519173867.857955823] Write flash @ 0x00002000 for 0x00000001 from 0x7ffe94d51ae0 [ 1519173867.858045089] Write flash @ 0x00002001 for 0x00000001 from 0x7ffe94d51ae1 [ 1519173867.858120016] Write flash @ 0x00002002 for 0x00000001 from 0x7ffe94d51ae2 [ 1519173867.858273459] Write flash @ 0x00002000 for 0x00000008 from 0x7ffe94d51b20 [ 1519173867.855134488] Can't open the RO partition for write[ 1519173867.857323229] Offset is beyond the partition file length[0x00000008] ================================================================= ==15139==ERROR: LeakSanitizer: detected memory leaks Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c4cb52f in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:40 #2 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Direct leak of 2 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f4d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x56371c5003b6 in init(mbox_context*) test/write_flash_vpnor.cpp:115 #2 0x56371c501c36 in main test/write_flash_vpnor.cpp:137 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c3fa0c0 in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2850c0) #2 0x56371c3f3483 in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x27e483) #3 0x56371c3ebf6c in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x276f6c) #4 0x56371c3e3aa4 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x26eaa4) #5 0x56371c3d82c5 in std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2632c5) #6 0x56371c3c623d in openpower::virtual_pnor::endianFixup(std::vector<unsigned char, std::allocator<unsigned char> > const&) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:268 #7 0x56371c3c2366 in openpower::virtual_pnor::partition::Table::Table(std::experimental::filesystem::v1::__cxx11::path&&, unsigned long, unsigned long) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:38 #8 0x56371c4cb844 in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #9 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #10 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c3fa0c0 in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2850c0) #2 0x56371c3f3483 in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x27e483) #3 0x56371c3ebf6c in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x276f6c) #4 0x56371c3e3aa4 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x26eaa4) #5 0x56371c3d82c5 in std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned long) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x2632c5) #6 0x56371c3d1b40 in openpower::virtual_pnor::partition::Table::allocateMemory(std::experimental::filesystem::v1::__cxx11::path const&) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:78 #7 0x56371c3c3006 in openpower::virtual_pnor::partition::Table::preparePartitions() /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:165 #8 0x56371c3c2216 in openpower::virtual_pnor::partition::Table::Table(std::experimental::filesystem::v1::__cxx11::path&&, unsigned long, unsigned long) /home/andrew/src/openbmc/phosphor-mboxd/pnor_partition_table.cpp:36 #9 0x56371c4cb844 in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #10 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #11 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) Indirect leak of 432 byte(s) in 3 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c5176b0 in void std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> >::_M_realloc_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::experimental::filesystem::v1::__cxx11::path::_Type, unsigned long&>(__gnu_cxx::__normal_iterator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt*, std::vector<std::experimental::filesystem::v1::__cxx11::path::_Cmpt, std::allocator<std::experimental::filesystem::v1::__cxx11::path::_Cmpt> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::experimental::filesystem::v1::__cxx11::path::_Type&&, unsigned long&) (/home/andrew/src/openbmc/phosphor-mboxd/test/write_flash_vpnor+0x3a26b0) Indirect leak of 144 byte(s) in 1 object(s) allocated from: #0 0x7f98b42f6458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458) #1 0x56371c4cb74b in vpnor_create_partition_table_from_path /home/andrew/src/openbmc/phosphor-mboxd/mboxd_pnor_partition_table.cpp:45 #2 0x56371c502013 in main test/write_flash_vpnor.cpp:145 #3 0x7f98b225b1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0) SUMMARY: AddressSanitizer: 8778 byte(s) leaked in 8 allocation(s). FAIL test/write_flash_vpnor (exit status: 1) Change-Id: I7d1a5262833146794e0298084e828e14821041b7 Fixes: openbmc/openbmc#2866 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* vpnor table: Set base address to actual offsetAdriana Kobylak2017-11-303-7/+9
| | | | | | | | | | | | | | | | | | | | | The base address for the partitions is used by mboxd to find requested partitions, and for simplicity it's just a continous number sequence. But this data is used by the host as the partition offsets, which are expected to match to the offsets in the openpower xml: https://github.com/open-power/pnor/blob/21d66daff697f8c13fb067340ca621e9208ab1ea/p9Layouts/defaultPnorLayout_64.xml This xml pnor layout has empty spaces in between the partitions, ex: part ends at address 0x2000 and the next partition HBEL starts at 0x8000. Need to set base address to the actual offset that corresponds to the xml file, so that the host traces that display the partition offsets match the data in documented in the xml. This doesn't affect the memory address allocation. Part of openbmc/openbmc#2677 Change-Id: Ica142129aabd195655018a84f9a993596c333457 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* vpnor: Add patch locationAdriana Kobylak2017-08-021-1/+51
| | | | | | | | | | | | | Look for the requested partition in the designated patch location (/usr/local/share/pnor/). If the partition is not found there, continue with the existing logic of looking in the other partition directories. This allows users to use patches in the virtual pnor implementation. Resolves openbmc/openbmc#1551 Change-Id: I7f27dfc9cd69a3f8ab88cb6fa77b2c1096e32841 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* vpnor: add partition version check to the TOCDeepak Kodihalli2017-07-191-1/+2
| | | | | Change-Id: If5497476f03484334396e483e251b1e9434137f3 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* vpnor: make PNOR block size configurableDeepak Kodihalli2017-07-191-2/+4
| | | | | | | | The vpnor code would assume a PNOR FFS block size of 4K. Make it possible to supply this value, since it needn't always be 4K. Change-Id: I21463b05f1047e93705ba82d46f746056568dcc5 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* test: write the vpnor file(flash)Ratan Gupta2017-06-291-0/+217
| | | | | | | | | | | | | | Add the test binary which runs the following test cases 1) Write to the read only partition 2) Write to the RW partition 3) Write to the preserved partition. 4) Write beyond the partition file length. 5) other boundary test cases. Resolves openbmc/openbmc#1479 Change-Id: Ifd4f0e89e434a26e2579415a973fe1bfdbb3e66f Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Read the partition file from the vpnor.Ratan Gupta2017-06-291-1/+5
| | | | | | | | | This fix reads the file from the partition, Memory map to it and then copy the asked memory area to the reserved memory area. Change-Id: I4b2987e628bc4820edfeb1b0a81e5d1cbb8e7cf1 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Read/write window property defines FFS partition file location.Ratan Gupta2017-06-291-0/+2
| | | | | | | | | | | | | | | | | | | | | The BMC loads the PNOR partitions in a read-only volume. So after that there are following two cases: Read: Tries to open the file in read only mode from the partition(READONLY/READWRITE/PRESERVED), Partition Table tells the partition type depends on the offset. if file is not there in the mapped partition then tries to open the file from the read only partition. Write: Tries to open the file in write mode from the partition(READWRITE/PRESERVED), if file is not there in the mapped partition then mailbox daemon will copy the requested partition to the read-write volume to make changes to it. Change-Id: Ic0ef882380b56536ac55feae3ec563de95fdd4a6 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* test: read window from partition fileRatan Gupta2017-06-291-0/+89
| | | | | | | Resolves openbmc/openbmc#1440 Change-Id: I8e6ae35e4c5ba2936a578349e6cea464de6ab40d Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
OpenPOWER on IntegriCloud