summaryrefslogtreecommitdiffstats
path: root/libc/test
Commit message (Collapse)AuthorAgeFilesLines
* libc/test/run-snprintf: int -> unsigned intStewart Smith2017-08-241-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>
* libc: Add labs() to stdlibShilpasri G Bhat2017-05-311-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>
* gcov: fix typo preventing libc coverage reportStewart Smith2017-05-011-1/+1
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* snprintf: increase testing, %u and 0 paddingStewart Smith2016-10-171-0/+53
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* consolidate gcov flags into HOSTGCOVFLAGS for host binariesStewart Smith2016-09-021-2/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* */test/*: Added '<subdir>-check' make targetsOliver O'Halloran2016-03-301-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>
* Increase unit test coverage of printf h and z length modifiersStewart Smith2015-07-021-0/+31
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Increase unit test coverage of printf %p and %oStewart Smith2015-07-021-0/+22
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc tolower() and toupper()Stewart Smith2015-06-242-0/+22
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc isdigit, isprint, isspace, isxdigitStewart Smith2015-06-242-0/+93
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc memmoveStewart Smith2015-06-242-2/+27
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc strncasecmpStewart Smith2015-06-242-0/+17
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc strcasecmpStewart Smith2015-06-242-0/+27
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc strcmpStewart Smith2015-06-242-0/+10
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc memcmpStewart Smith2015-06-242-0/+10
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add tests for libc memchrStewart Smith2015-06-242-0/+13
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Optimized memset() implementation for POWERStewart Smith2015-06-012-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>
* atoi/atol should assume base 10, not autodetect base.Daniel Axtens2015-02-231-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>
* Don't recognise a double hex prefix (0x0xNN) as valid.Daniel Axtens2015-02-231-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>
* Test libc stdlib functions (atoi/strtol and friends)Daniel Axtens2015-02-231-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>
* Fix commit 16c80346Jeremy Kerr2015-02-091-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>
* Add OPAL_INVALID_CALL explicitly in opal.h and docsStewart Smith2015-02-051-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>
* Makefile: clean the gcov files created during coverageNeelesh Gupta2015-02-051-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>
* add libc/test/.gitignore for the new libc unit testsStewart Smith2015-01-271-0/+10
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add skeleton for libc/ctype unit testsStewart Smith2015-01-203-1/+62
| | | | | | Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add skeleton for libc/stdlib unit testStewart Smith2015-01-203-1/+62
| | | | | | Now it shows up as untested in lcov! Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Skeleton unit tests for libc memops (libc/string/*)Stewart Smith2015-01-203-1/+71
| | | | | | This means that it shows up in lcov as untested. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add some skiboot snprintf test casesStewart Smith2015-01-204-5/+242
| | | | | | Initial implementation and support for more libc test cases 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>
* Pretty print make check and coverage outputStewart Smith2014-12-191-4/+4
| | | | | | 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-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>
* Merge branch 'update-2.1.1.1'Stewart Smith2014-11-261-0/+1
|\
| * Include stdint.h for libc/test/run-time.c, fixing buildStewart Smith2014-11-261-0/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | 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>
* | Preliminary code coverage reporting infrastructureStewart Smith2014-10-221-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>
* | libc/test: Fix timeJoel Stanley2014-10-011-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>
* libc: Add mktime and gmtime_rAlistair Popple2014-08-152-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>
OpenPOWER on IntegriCloud