summaryrefslogtreecommitdiffstats
path: root/core/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | Add another pel test to test user sectionStewart Smith2014-12-191-0/+33
| | | | | | | | | | | | This increases our code coverage of pel.c from 81.3% to 98.7% Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Increase test coverage of pel testStewart Smith2014-12-191-1/+5
| | | | | | | | | | | | Cover pel buffer too small case in create_pel_log Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Pretty print make check and coverage outputStewart Smith2014-12-191-5/+5
| | | | | | | | | | | | Can still get the details with V=1, just like normal make. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix makefile dependency generation, especially for HOSTCCStewart Smith2014-12-151-9/+0
| | | | | | | | | | | | | | | | | | | | | | Instead of having individual rules to generate .d, add -MMD to HOSTCC parameters, and just include the generated .d files. This fixes a few weird dependency issues. Also, make the mambo hello_kernel test depend on skiboot.lid Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | silence integer/pointer from integer/pointer warnings in ↵Stewart Smith2014-12-051-3/+3
| | | | | | | | | | | | core/test/run-mem_region_init.c Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix unused result of realloc warning in core/test/run-malloc.cStewart Smith2014-12-051-1/+3
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix unbounded stack usage warning in core/test/run-mem_region_release_unused.cStewart Smith2014-12-051-1/+5
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Silence warning for core/tests/stubs.c prlog missing prototypeStewart Smith2014-12-051-1/+3
| | | | | | | | | | | | We get the real prototype in real code from skiboot.h Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix unbounded stack usage warning in ↵Stewart Smith2014-12-051-1/+5
| | | | | | | | | | | | core/test/run-mem_region_release_unused_noalloc.c Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | elog: Clean up error logging headersAlistair Popple2014-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit cf6f4e8912d29fb89ce85c84834607065ad595a5 introduced a platform independent frontend for error logging. However it failed to move the generic parts of the fsp-elog.h header into the platform independent one, instead relying on the fact that up until now fsp-elog.h was included whenever a function needed to log errors. This patch moves the platform independent defines into the frontend header file (errorlog.h) and removes the include of the platform specific header in generic code paths. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Remove #define sync in test/run-trace.c - don't confuse with sync(2)Stewart Smith2014-12-021-2/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core/test: fix compile error in run-traceCédric Le Goater2014-12-021-0/+5
| | | | | | | | | | Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | More trace endian fixes so make check works againBenjamin Herrenschmidt2014-11-281-29/+29
| | | | | | | | | | | | | | We need the core to do proper endian among others since that code is compiled in run-trace Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | use $(wildcard ) in test MakefilesDan Streetman2014-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core/test/ and libc/test/ Makefile.check files both contain: -include core/test/*.d (or libc/test/*d) which is incorrect, since that evaluates literally to a *.d file. This results in each build trying to find that file, and creating it when not found (in an incorrect way because of other problems in the Makefile). The correct way to specify it is: -include $(wildcard core/test/*.d) Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | core/test: Fix timer test caseVasant Hegde2014-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b54d1a8 broke timer test case. core/test/run-timer.c: In function ‘main’: core/test/run-timer.c:52:3: error: too few arguments to function ‘check_timers’ check_timers(); ^ In file included from core/test/run-timer.c:16:0: core/test/../timer.c:201:6: note: declared here void check_timers(bool from_interrupt) ^ make: *** [core/test/run-timer] Error 1 This patch fixes above compilation issue. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | timer: Add scheduled timer facilityBenjamin Herrenschmidt2014-11-072-1/+57
| | | | | | | | | | | | | | For now running off the event pollers, that will improve once we get delayed interrupts from the SLW Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | Fix stack usage might be unbounded warning in core/test/run-mem_region_initStewart Smith2014-10-271-1/+4
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Test cleanup code path in opal_msg_init()Stewart Smith2014-10-221-2/+11
| | | | | | | | | | | | (Although when exactly is this going to be hit?) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | fsp/elog: Create a logging frontendAlistair Popple2014-10-222-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support fsp-less machines we need to be able to log errors using a BMC or some other mechanism. Currently the error logging code is tightly coupled to the platform making it difficult to add different platforms. This patch factors out the generic parts of the error logging code in preparation for adding different logging backends. It also adds a generic mechanism for pre-allocating a specific number of objects. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | fsp/elog: Separate the PEL log formatting functionsAlistair Popple2014-10-222-2/+83
| | | | | | | | | | | | | | | | | | | | The PEL log format is not specific to the FSP. We plan to use the same format for OpenPOWER systems. This patch refactors the code into a platform agnostic file. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add some (not that good) testing of mem_dump_allocs()Stewart Smith2014-10-221-0/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Test zalloc() failure case.Stewart Smith2014-10-221-0/+4
| | | | | | | | | | | | This brings us to near total test coverage of core/malloc.c Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Add unit test for realloc failureStewart Smith2014-10-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Increases test coverage of realloc too! Was: Hit Total Coverage Lines: 1936 2574 75.2 % Functions: 177 225 78.7 % Branches: 1243 2360 52.7 % Now: Lines: 1945 2582 75.3 % Functions: 177 225 78.7 % Branches: 1247 2364 52.7 % Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Preliminary code coverage reporting infrastructureStewart Smith2014-10-222-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support in core/test/Makefile.check to build -gcov binaries (with -lgcov and -fprofile-blah-blah) as well as some targets for producing lcov HTML code coverage reports. As part of this, I had to fix up an oddity in run-mem_region_init where that due to running under Valgrind, we'd be malloc()ed a heap with a small address, well inside the mem_regions we added but when not running under valgrind (e.g. for code coverage reporting) we would get a much larger address, outside this range and hit an assert. So, after fiddling with the memory stuff for this test, I think I have it right - it passes both under valgrind and not and does produce code coverage data. Currently, we're at this level of code coverage by unit tests: Hit Total Coverage Lines: 1936 2574 75.2 % Functions: 177 225 78.7 % Branches: 1243 2360 52.7 % The totals should largely be ignored due to the only code being counted is that linked into the unit tests (total LOC is ~50kLOC according to sloccount... so unit tests currently cover < 5%) Try the "make coverage-report" target, you'll get coverage-report directory with a LCOV HTML report Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix make check after Ben broke it with external/* -> external/trace/ renameStewart Smith2014-10-211-1/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Rename mem_size() to mem_allocated_size()Stewart Smith2014-10-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This better states the intention of what it should return. I was bit unsure when fixing mem_size(), so hopefully this makes future me (or other people) less unsure as to the intended return value of this function. No functional changes, just rename. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Rusty Russell <rusty@au1.ibm.com>
* | in realloc(), memcpy() call would copy past end of allocationStewart Smith2014-10-171-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or: Fix mem_size() to remove struct alloc_hdr from returned value This bug was caught by switching test/run-malloc.c over to using malloc/free (system malloc/free) to allocate the heap that we use for testing our malloc and free. Basically, when we did that, run-malloc.c test would get this valgrind warning: ==3869== Invalid read of size 8 ==3869== at 0x4C2A706: memcpy (mc_replace_strmem.c:838) ==3869== by 0x40323F: __realloc (malloc.c:69) ==3869== by 0x405815: main (run-malloc.c:142) Which was because in realloc(), when we have to relocate the allocated bit of memory, we memcpy the contents of the old location into the new one. The current mem_size() implementation *included* struct alloc_hdr which mean that we were copying allocated size + sizeof(struct alloc_hdr) from the returned pointer. This meant we read sizeof(struct alloc_hdr) past the end of the allocation... which will pretty much always be harmless, just get random junk in the realloc()ed space. i.e. we would memcpy() 64+16 (80) bytes from the malloc(64) space to the realloc(128) space, which is, obviously, 16 bytes more than we should. IF we had some memory after a region that would make us explode if we read, then we'd explode around the realloc() call... which would not be so good. After a bit of a code audit I'm pretty sure this isn't going to actually hurt us anywhere... or, at least, I hope not... The fix is simple: fix mem_size() to subtract sizeof(struct alloc_hdr) from the returned value. This should be okay with the other test case that checks mem_size() result and there are no other mem_size() callers. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Rusty Russell <rusty@au1.ibm.com>
* | Fix stack usage in run-malloc-speed test by using mallocStewart Smith2014-10-151-1/+4
|/ | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* {core,hdata}/test: Add prlog to stubJoel Stanley2014-08-151-1/+12
| | | | | | | | We are missing a prlog for tests. This adds a dumb version that ignores the log level and uses printf to display all messages. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* Initial commit of Open Source releaseBenjamin Herrenschmidt2014-07-0211-0/+1835
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
OpenPOWER on IntegriCloud