aboutsummaryrefslogtreecommitdiff
path: root/libc/test
AgeCommit message (Collapse)AuthorFilesLines
2017-08-24libc/test/run-snprintf: int -> unsigned intStewart Smith1-1/+2
UBSan: libc/test/run-snprintf.c:123:9: runtime error: left shift of 268435456 by 4 places cannot be represented in type 'int' Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-05-31libc: Add labs() to stdlibShilpasri G Bhat1-0/+7
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Acked-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-05-01gcov: fix typo preventing libc coverage reportStewart Smith1-1/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-17snprintf: increase testing, %u and 0 paddingStewart Smith1-0/+53
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-09-02consolidate gcov flags into HOSTGCOVFLAGS for host binariesStewart Smith1-2/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-03-30*/test/*: Added '<subdir>-check' make targetsOliver O'Halloran1-2/+5
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>
2015-07-02Increase unit test coverage of printf h and z length modifiersStewart Smith1-0/+31
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-07-02Increase unit test coverage of printf %p and %oStewart Smith1-0/+22
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc tolower() and toupper()Stewart Smith2-0/+22
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc isdigit, isprint, isspace, isxdigitStewart Smith2-0/+93
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc memmoveStewart Smith2-2/+27
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc strncasecmpStewart Smith2-0/+17
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc strcasecmpStewart Smith2-0/+27
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc strcmpStewart Smith2-0/+10
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc memcmpStewart Smith2-0/+10
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-24add tests for libc memchrStewart Smith2-0/+13
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-01Optimized memset() implementation for POWERStewart Smith2-0/+33
This uses the dcbz instruction to clear cacheline at a time rather than byte at a time. This means that even without high levels of optimization, we *dramatically* improve boot performance with SKIBOOT_GCOV=1 and probably ever so slightly speed things up for normal builds. We currently just hard-code 128 as cacheline size as all CPUs that skiboot currently boots on have 128 byte cachelines. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23atoi/atol should assume base 10, not autodetect base.Daniel Axtens1-4/+7
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>
2015-02-23Don't recognise a double hex prefix (0x0xNN) as valid.Daniel Axtens1-4/+3
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>
2015-02-23Test libc stdlib functions (atoi/strtol and friends)Daniel Axtens1-0/+60
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>
2015-02-09Fix commit 16c80346Jeremy Kerr1-2/+11
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>
2015-02-05Add OPAL_INVALID_CALL explicitly in opal.h and docsStewart Smith1-11/+2
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>
2015-02-05Makefile: clean the gcov files created during coverageNeelesh Gupta1-2/+11
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>
2015-01-27add libc/test/.gitignore for the new libc unit testsStewart Smith1-0/+10
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add skeleton for libc/ctype unit testsStewart Smith3-1/+62
Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add skeleton for libc/stdlib unit testStewart Smith3-1/+62
Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Skeleton unit tests for libc memops (libc/string/*)Stewart Smith3-1/+71
This means that it shows up in lcov as untested. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-01-20Add some skiboot snprintf test casesStewart Smith4-5/+242
Initial implementation and support for more libc test cases Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-19Exclude all test cases from coverage-reportStewart Smith1-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>
2014-12-19Pretty print make check and coverage outputStewart Smith1-4/+4
Can still get the details with V=1, just like normal make. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-15Fix makefile dependency generation, especially for HOSTCCStewart Smith1-7/+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>
2014-11-26Merge branch 'update-2.1.1.1'Stewart Smith1-0/+1
2014-11-26Include stdint.h for libc/test/run-time.c, fixing buildStewart Smith1-0/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-11-25use $(wildcard ) in test MakefilesDan Streetman1-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>
2014-10-22Preliminary code coverage reporting infrastructureStewart Smith1-1/+11
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>
2014-10-01libc/test: Fix timeJoel Stanley1-1/+0
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>
2014-08-15libc: Add mktime and gmtime_rAlistair Popple2-0/+104
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>