summaryrefslogtreecommitdiffstats
path: root/core/test
Commit message (Collapse)AuthorAgeFilesLines
...
* make check: make test runs less noisyStewart Smith2016-07-121-4/+4
| | | | | | | | | | | Run a small wrapper around some unit tests with the QTEST makefile macro (QTEST=Quiet TEST). Also, wrap boot tests in mambo and qemu to be quiet by default. Both ./test/run.sh and the modified mambo/qemu test runner scripts output full stdout and stderr in the event of error. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Timebase quirk for slow simulators like AWAN and SIMICSBenjamin Herrenschmidt2016-07-062-0/+4
| | | | | | | | | | | This will internally pretend the timebase is running 1000 times slower, which reduces some otherwise really terrible delays in some simulators. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: move cfam_chipid cleanup into own patch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* */test/*: Added '<subdir>-check' make targetsOliver O'Halloran2016-03-301-5/+8
| | | | | | | Currently these exist for some parts of the source tree, but not all of it. They're nice if you are only modifing code in a one part of the tree as the full test suite can be a little slow. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge branch 'stable'Stewart Smith2016-01-211-0/+71
|\ | | | | | | Merge device tree sorting
| * DT sorting testOliver O'Halloran2016-01-211-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | Moved the dt_dump() into test/dt_common.c so that it can be shared between hdata/test/hdata_to_dt.c and core/test/run-device.c run-device.c contains two tests, one basic sorting test and a generate-and-sort test. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: remove trailing whitespace] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * Enable -Werror for -WformatStewart Smith2016-01-211-1/+1
| | | | | | | | | | | | | | | | | | commit 56bc1890b229072513788992d1d29b6f173c13de upstream We create our own inttypes.h to get the correct printf formatting for 64bit numbers. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Enable -Werror for -WformatStewart Smith2015-11-161-1/+1
| | | | | | | | | | | | | | We create our own inttypes.h to get the correct printf formatting for 64bit numbers. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | assert cpu < CPUS in core/test/run-trace.cStewart Smith2015-11-161-2/+7
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add unit test for timebase functionsStewart Smith2015-10-082-0/+57
|/ | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Ensure reserved memory ranges are exposed correctly to host (fix corrupted ↵Stewart Smith2015-09-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SLW image) Memory regions in skiboot have an interesting life cycle. First, we get a bunch from the initial device tree or hdat specifying some existing reserved ranges (as well as adding some of our own if they're missing) but we also get ranges for the entirety of RAM. The idea is that we can do node local allocations for per node resources (which we do) and then, just prior to booting linux, we copy the reserved memory regions to expose to linux along with a set of reserver regions to cover the node local allocations. The problem was that mem_range_is_reserved() was wanting subtle different semantics for memory region type than region_is_reserved() provided. That is, we were overriding the meaning of REGION_SKIBOOT_HEAP to mean both "this is reserved by skiboot" *and* "this is a memory region that covers all of memory and will be shrunk to cover just the memory we have allocated for it just before we boot the payload (linux)". So what would happen is we would ask "hey, is the memory holding the SLW image reserved?" and we'd get the answer of "yes" but referring to the memory region that covers the entirety of memory in a NUMA node, *not* meaning our intent of "this will be reserved when we start linux". To fix this, introduce a new memory region type REGION_MEMORY. This has the semantics of a memory region that covers a block of memory that we can allocate from (using local_alloc) and that the part that was allocated will be passed to linux as reserved, but that the entire range will not be reserved. So our new semantics are: - region_is_reservable() is true if the region *MAY* be reserved (i.e. is the regions that cover the whole of memory OR is explicitly reserved) - region_is_reserved() is true if the region *WILL* be reserved (i.e. is explicitly reserved) This way we check that the SLW image is explicitly reserved and if it isn't, we reserve it. Fixes: 58033e44 Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* slw/timer: SBE based timer supportBenjamin Herrenschmidt2015-09-111-0/+6
| | | | | | | | | | | | | Recent HostBoot & SBE firmware provide a HW timer facility that can be used to implement OPAL timers and thus limit the reliance on the Linux heartbeat. This implements support for it. The side effect is that i2c from Centaurs is now usable. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: fix run-timer unit test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* timer: Pass current timer to timer callbacksBenjamin Herrenschmidt2015-09-111-1/+2
| | | | | | | | | The caller usually has it and it avoids additional mftb() which can be expensive. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: fix run-timer unit test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Fix harmless free() after realloc() in test-malloc.cStewart Smith2015-09-091-2/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* trivial run-malloc test fixup that was fooling coverityStewart Smith2015-09-081-1/+1
| | | | | | | | although we assert that p2==p, coverity doesn't pick this up, so we get a false positive of a double free. This is trivial to fix just by modifying our test case. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/mem_region: Add mem_range_is_reserved()Jeremy Kerr2015-08-172-0/+217
| | | | | | | | This change adds a function to check whether a range of memory is covered by one or more reservations. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* fix run-pel.c build after error log entry changesStewart Smith2015-07-311-1/+1
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add mem_dump_free() call to mem_region unit testStewart Smith2015-07-021-0/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add test for nvram free space partition nameStewart Smith2015-06-241-6/+3
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Expand nvram-format unit test to cover all error pathsStewart Smith2015-06-241-2/+85
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Move NVRAM format/check code out into separate file to unit testStewart Smith2015-06-242-0/+32
| | | | | | | We (slightly) change the internal API so that we operate on parameters rather than globals, this means it's easier to unit test too. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add unit test for core/time-utilsStewart Smith2015-06-242-0/+61
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Fix assert test in run-mem_region_reservations.cStewart Smith2015-06-151-1/+1
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Fix assert tests in run-mem_region_next.cStewart Smith2015-06-151-6/+6
| | | | | | | Assignments rather than checks, and the wrong way around for how new_region works. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge branch 'stable'Stewart Smith2015-06-051-1/+2
|\
| * core/mem_region: Create reservations of type REGION_HW_RESERVEDJeremy Kerr2015-06-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All current users of mem_reserve are actually wanting HW_RESERVED memory; these reservations are for memory initialised pre-skiboot. This change marks these regions as REGION_HW_RESERVED instead of REGION_RESERVED. We also rename mem_reserve to mem_reserve_hw to reflect this change. This fixes an issue where the PRD daemon cannot find reserved ranges (eg, the homer image) that have been created by skiboot itself. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Merge PRD rework from stableStewart Smith2015-05-213-32/+197
|\|
| * core: Add mem_region_nextJeremy Kerr2015-05-212-1/+130
| | | | | | | | | | | | | | This change adds a function to iterate mem_regions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Add node-style memory reservation to device treeJeremy Kerr2015-05-211-30/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux supports a newer memory reservation layout in the device-tree, where each reservation is represented by a subnode under a top-level "reserved-memory" node. This change adds these nodes, using the mem_region names as the property names (minus any cell addresses). The reserved-memory node looks like this: / { name = "reserved-memory"; ranges; #address-cells = <0x2>; #size-cells = <0x2>; ibm,firmware-code@30000000 { reg = <0x0 0x30000000 0x0 0x200000>; }; ibm,firmware-data@30e00000 { reg = <0x0 0x30e00000 0x0 0xc00000>; }; ibm,firmware-stacks@31a00000 { reg = <0x0 0x31a00000 0x0 0x8000000>; }; ibm,firmware-allocs-memory@39a00000 { reg = <0x0 0x39a00000 0x0 0x1c0200>; }; ibm,firmware-heap@30200000 { reg = <0x0 0x30200000 0x0 0xc00000>; }; }; We also store a pointer to the reservation nodes in struct mem_region, so they can be used by other skiboot code. We keep the property-style reservation information (reserved-names and reserved-ranges) unchanged. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Prevent adding new regions after mem_region_add_dt_reservedJeremy Kerr2015-05-212-1/+186
| | | | | | | | | | | | | | | | | | | | | | | | If we reserve any memory after mem_region_add_dt_reserved, that reservation won't appear in the device tree. Ensure that we can't add new regions after this point. Also, add a testcase for the finalise, including some basic reserved-ranges property checks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core/test: Use skiboot's own malloc for mem_region testsJeremy Kerr2015-05-211-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Comments in the run-mem_region test imply that it uses skiboot's own malloc for the malloc implementation, but this isn't true; a malloc inside the mem_region code itself will use the glibc malloc. This change implements the intention of the test, and uses skiboot malloc for the file-under-test. real_malloc() is available for actual glibc mallocs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core/test: simulate proper locking in run-mem_region testJeremy Kerr2015-05-211-2/+13
| | | | | | | | | | | | | | | | Currently, this test doesn't do locking during region changes or allocations. This change adds the appropriate locking. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Add asserts for region free-list lockingJeremy Kerr2015-05-216-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | This change adds asserts to the mem_region calls that should have the per-region lock held. To keep the tests working, they need the lock_held_by_me() function. The run-mem_region.c test has a bogus implementation of this, as it doesn't do any locking at the moment. This will be addressed in a later change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Move free-list locking to a separate per-region lockJeremy Kerr2015-05-214-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we have a single lock for the entire mem_region system; this protects both the global region list, and the allocations from each region. This means we can't allocate memory while traversing the global region list, as any malloc/realloc/free will try to acquire the mem_region lock again. This change separates the locking into different functions. We keep the mem_region_lock to protect the regions list, and introduce a per-region lock to protect allocations from the regions' free_lists. Then we remove the open-coded invocations of mem_alloc, where we'd avoided malloc() due to the above locking issue. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Make makefile for core/test a bit prettierStewart Smith2015-05-131-1/+13
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core: Prevent adding new regions after mem_region_add_dt_reservedJeremy Kerr2015-05-132-1/+186
| | | | | | | | | | | | | | | | | | | | | | | | If we reserve any memory after mem_region_add_dt_reserved, that reservation won't appear in the device tree. Ensure that we can't add new regions after this point. Also, add a testcase for the finalise, including some basic reserved-ranges property checks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core/test: Use skiboot's own malloc for mem_region testsJeremy Kerr2015-05-131-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Comments in the run-mem_region test imply that it uses skiboot's own malloc for the malloc implementation, but this isn't true; a malloc inside the mem_region code itself will use the glibc malloc. This change implements the intention of the test, and uses skiboot malloc for the file-under-test. real_malloc() is available for actual glibc mallocs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core/test: simulate proper locking in run-mem_region testJeremy Kerr2015-05-131-2/+13
| | | | | | | | | | | | | | | | Currently, this test doesn't do locking during region changes or allocations. This change adds the appropriate locking. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core: Add asserts for region free-list lockingJeremy Kerr2015-05-136-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | This change adds asserts to the mem_region calls that should have the per-region lock held. To keep the tests working, they need the lock_held_by_me() function. The run-mem_region.c test has a bogus implementation of this, as it doesn't do any locking at the moment. This will be addressed in a later change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core: Move free-list locking to a separate per-region lockJeremy Kerr2015-05-134-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we have a single lock for the entire mem_region system; this protects both the global region list, and the allocations from each region. This means we can't allocate memory while traversing the global region list, as any malloc/realloc/free will try to acquire the mem_region lock again. This change separates the locking into different functions. We keep the mem_region_lock to protect the regions list, and introduce a per-region lock to protect allocations from the regions' free_lists. Then we remove the open-coded invocations of mem_alloc, where we'd avoided malloc() due to the above locking issue. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add test for pr_fmtStewart Smith2015-05-121-0/+72
| | | | | | | | | | | | (missed this from pr_fmt commit, whoops) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add pr_fmt to do printf/prlog prefixing automagicallyStewart Smith2015-05-125-3/+18
|/ | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: Test compatible, chip id and phandle related DT functionsDaniel Axtens2015-03-051-0/+56
| | | | | Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: Test more get/set functions in device.cDaniel Axtens2015-03-051-0/+70
| | | | | Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: Use "" as the name of the device tree root node.Daniel Axtens2015-03-051-11/+11
| | | | | | | | | | | The device tree tests use "root" as the name of the root node. That leads to weird discrepancies between the reported path and the dt_find_by_path path. The empty string is already used as the root name in dt_expand. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: Test that device paths/names function as expected.Daniel Axtens2015-03-051-4/+61
| | | | | | | Test dt_get_path/dt_find_by_name/dt_find_by_path all respond as expected. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge branch 'update-2.1.1.1'Stewart Smith2015-01-192-0/+114
|\
| * opal: Add unit test for buffer overrun in prlog/printfMahesh Salgaonkar2015-01-192-2/+125
| | | | | | | | | | | | | | | | | | Add unit test for buffer overrun in prlog/printf. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> [stewart@linux.vnet.ibm.com: rebased to stable branch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | clean CORE_TEST_NOSTUB binariesStewart Smith2014-12-191-0/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add console-log unit testStewart Smith2014-12-192-0/+87
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Exclude all test cases from coverage-reportStewart Smith2014-12-191-0/+2
| | | | | | | | | | | | | | | | This way we get a true representation from the lcov coverage-report about what firmware code we're testing (besides, test cases are always going to only have 50% of branches hit - we're asserting the tests pass!) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud