Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The behaviour of atoi/atol on glibc (and according to the spec) is
to assume base 10, not to autodetect the base.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
When autodetecting the base, the code would strip hex prefixes twice.
Now the string is not modified in the detection stage.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This increases coverage of atoi, atol, strtol and strtoul to 100%.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Gives better diagnostics in error logs/dumps
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Commit 16c80346 change included some reverts of previous commits, which
we need. This change reverts those reverts, leaving the original intent
of that change.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Was mentioned in linux as possibly being used by some external test
modules. It's harmless to make this official behaviour.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Fix the Makefile to clean up the coverage data files generated
through gcov.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Now it shows up as untested in lcov!
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Now it shows up as untested in lcov!
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This means that it shows up in lcov as untested.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Initial implementation and support for more libc test cases
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
|
|
While running HMI tests I saw a massive corruption in OPAL for one of the
HMI test that injects TB error. On investigation I found that
vsnprintf()->print_itoa() was the culprit. print_itoa function uses tmp
array of size 16 to convert unsigned long value to ASCII. But an unsigned
value of 0xffffffffffffffff needs atleast 25 characters to print its ASCII
representation. This caused an array to overflow resulting into corruption,
unpredictable behavior and finally system termination.
We could fix this by increasing the size of tmp[] array but that still won't
fix this bug completely. While auditing vsnprintf() function I found that
it makes use of print_*() functions to write data to buffer. But none of
the print_* function have any check on buffer size before writing data to it.
Without size check print_*() can easily overrun buffer passed by
vprlog()->vsnprintf()->print_format()->print_*() causing massive corruption
leading to unpredictable behavior.
This patch fixes this bug by modifying print_*() function to check for
buffer size to avoid buffer overrun.
- Modified print_format(), print_fill() and print_itoa() to take bufsize
as argument and added a size check while writing to buffer.
- Remove temporary array from print_itoa(), instead write data directly to
buffer.
- Added two new function print_str_fill() and print_str() to be used as
helper routine for '%s' fmt case in print_format() function. These new
routines now has a check on buffer size while copying NULL terminated
string to buffer.
- Added "!bufsize" check in vsnprintf() to avoid buffer overrun while
setting NULL character before returning.
I ran HMI tests with this patch successfully. I also tested this patch by
reducing size of the buffer (in core/console-log.c:vprlog()) from 320 to 50
and booted the lid successfully with no corruption at all.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
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>
|
|
Can still get the details with V=1, just like normal make.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
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>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Remove recursive call in print_itoa to reduce the stack usage.
Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
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>
|
|
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>
|
|
There is no use for time, remove it.
Fixes the following error (and the warning once stdint.h was included):
libc/test/run-time.c:40:2: error: unknown type name ‘uint32_t’
uint32_t time;
libc/test/run-time.c:41:11: warning: unused variable ‘time’
[-Wunused-variable]
uint32_t time;
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
Both the FSP RTC and the upcoming IPMI RTC implementation need to
manipulate time in various ways. Rather than re-implementing slightly
different versions of the calculations twice lets implement some
standard library functions (with tests) and use those.
This patch adds mktime and gmtime_r to the libc.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
For better debugability, the patch adds git version and backtrace
details to user data section (along with file info which was already
present).
After adding required details TermImmedData looks like:
TermImmedData |
| 00000000 63386631 6639322D 64697274 793A0000 c8f1f92-dirty:.. |
| 00000010 00000000 00000000 00000000 00000000 ................ |
| 00000020 00000000 00000000 43505520 30303030 ........CPU 0000 |
| 00000030 30303264 20426163 6B747261 63653A0A 002d Backtrace:. |
| 00000040 20533A20 30303030 30303030 33316162 S: 0000000031ab |
| 00000050 36626130 20523A20 30303030 30303030 6ba0 R: 00000000 |
| 00000060 33303031 33306238 0A20533A 20303030 300130b8. S: 000 |
| 00000070 30303030 30333161 62366334 3020523A 0000031ab6c40 R: |
| 00000080 20303030 30303030 30333030 34623738 000000003004b78 |
| 00000090 380A2053 3A203030 30303030 30303331 8. S: 0000000031 |
| 000000A0 61623663 63302052 3A203030 30303030 ab6cc0 R: 000000 |
| 000000B0 30303330 30313736 31300A20 533A2030 0030017610. S: 0 |
| 000000C0 30303030 30303033 31616236 64343020 000000031ab6d40 |
| 000000D0 523A2030 30303030 30303033 30303035 R: 0000000030005 |
| 000000E0 3133340A 20533A20 30303030 30303030 134. S: 00000000 |
| 000000F0 33316162 36663030 20523A20 30303030 31ab6f00 R: 0000 |
| 00000100 30303030 33303030 32353534 0A000000 000030002554.... |
| 00000110 00000000 00000000 00000000 00000000 ................ |
| 00000120 00000000 00000000 00000000 00000000 ................ |
| 00000130 00000000 00000000 00000000 00000000 ................ |
| 00000140 00000000 00000000 00000000 00000000 ................ |
| 00000150 00000000 00000000 00000000 00000000 ................ |
| 00000160 00000000 00000000 00000000 00000000 ................ |
| 00000170 00000000 00000000 00000000 00000000 ................ |
| 00000180 00000000 00000000 00000000 00000000 ................ |
| 00000190 00000000 00000000 00000000 00000000 ................ |
| 000001A0 00000000 00000000 00000000 00000000 ................ |
| 000001B0 00000000 00000000 00000000 00000000 ................ |
| 000001C0 00000000 00000000 00000000 636F7265 ............core |
| 000001D0 2F6F7061 6C2E633A 3233383A 30000000 /opal.c:238:0... |
|------------------------------------------------------------------------------|
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
Moving assert_fail() out of libc and into core/utils.c so that we can
sanely call prlog(PR_EMERG).
We shorten it from three fputs calls down to one prlog() call.
This may increase the number of cycles and stack usage for when we
hit an assert, which may not be desirable.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
Replace the libc printf implementation with a wrapper that does
fancy log things such as display timestamp and the log level.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
At present CPU control area ntuple in SPIRA structure is NULL.
ATTN component in Service Processor side checks for this field and if its empty,
it logs hardcoded SRC (0xBB821410) and generates SYSDUMP. So we have 1 SRC for
all failure (assert call) from OPAL side. This makes difficult to debug the issue.
Service processor provides attention area interface (FIPS PHyp Attentions spec),
so that we can pass SRC and user data (error message) to service processor.
This will helps us identify different failures in OPAL.
This patch enables attention area and provides interface (update_sp_attn_area())
to add src and user data (error message) through assert macro.
Attention SRC format:
1st byte - Opal src type
2-4 bytes - Holds the address of the assert function call
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|