summaryrefslogtreecommitdiffstats
path: root/lib/libc/tests
Commit message (Collapse)AuthorAgeFilesLines
* Increase the timeout for resolv_test from the default (300 seconds) tongie2015-12-232-4/+13
| | | | | | | | | | | | | | 450 seconds This is required on slower network connections, and on older releases (stable/10 seems to be slower as far as name resolution goes.. not sure why yet). Remove an outdated comment in the Makefile from when I was working on this code over a year ago on github MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Let tsearch()/tdelete() use an AVL tree.ed2015-12-222-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing implementations of POSIX tsearch() and tdelete() don't attempt to perform any balancing at all. Testing reveals that inserting 100k nodes into a tree sequentially takes approximately one minute on my system. Though most other BSDs also don't use any balanced tree internally, C libraries like glibc and musl do provide better implementations. glibc uses a red-black tree and musl uses an AVL tree. Red-black trees have the advantage over AVL trees that they only require O(1) rotations after insertion and deletion, but have the disadvantage that the tree has a maximum depth of 2*log2(n) instead of 1.44*log2(n). My take is that it's better to focus on having a lower maximum depth, for the reason that in the case of tsearch() the invocation of the comparator likely dominates the running time. This change replaces the tsearch() and tdelete() functions by versions that create an AVL tree. Compared to musl's implementation, this version is different in two different ways: - We don't keep track of heights; just balances. This is sufficient. This has the advantage that it reduces the number of nodes that are being accessed. Storing heights requires us to also access all of the siblings along the path. - Don't use any recursion at all. We know that the tree cannot 2^64 elements in size, so the height of the tree can never be larger than 96. Use a 128-bit bitmask to keep track of the path that is computed. This allows us to iterate over the same path twice, meaning we can apply rotations from top to bottom. Inserting 100k nodes into a tree now only takes 0.015 seconds. Insertion seems to be twice as fast as glibc, whereas deletion has about the same performance. Unlike glibc, it uses a fixed amount of memory. I also experimented with both recursive and iterative bottom-up implementations of the same algorithm. This iterative top-down version performs similar to the recursive bottom-up version in terms of speed and code size. For some reason, the iterative bottom-up algorithm was actually 30% faster for deletion, but has a quadratic memory complexity to keep track of all the parent pointers. Reviewed by: jilles Obtained from: https://github.com/NuxiNL/cloudlibc Differential Revision: https://reviews.freebsd.org/D4412
* Iterate down lib/libc/tests/nss...ngie2015-12-161-0/+1
| | | | | | MFC after: 1 week X-MFC with: r292323 Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/nss into the FreeBSD test suite asngie2015-12-1610-0/+5399
| | | | | | | | | | | | | | | | | lib/libc/tests/nss - Convert the testcases to ATF - Do some style(9) cleanups: -- Sort headers -- Apply indentation fixes -- Remove superfluous parentheses - Explicitly print out debug printfs for use with `kyua {debug,report}`; for items that were overly noisy, they've been put behind #ifdef DEBUG conditionals - Fix some format strings MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Add Makefile accidentally missed in r292317ngie2015-12-161-0/+15
| | | | | | MFC after: 1 week X-MFC with: r292317 Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/resolv into the FreeBSD test suite asngie2015-12-163-0/+368
| | | | | | | | | lib/libc/tests/resolv Convert the testcases to ATF MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Delete bogus freeing of uninitialized datangie2015-12-081-1/+0
| | | | | | MFC after: 3 days Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division
* Add missing va_ends for corresponding va_starts to clean up variable argumentsngie2015-12-082-0/+4
| | | | | | | | initialized in _test_fmt(..) MFC after: 3 days Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division
* Fix regression in r291738: This really wants -lssp.bdrewery2015-12-051-1/+1
| | | | | | | The normal LIBADD is ssp_nonshared. This also had a DPADD on LIBSSP which does not actually exist, it is blank. Sponsored by: EMC / Isilon Storage Division
* Initialize errno to 0 in the nul testcase before testing itngie2015-12-051-0/+1
| | | | | | | For some odd reason stable/10 requires this, otherwise it always fails the errno == 0 check on line 196. Sponsored by: EMC / Isilon Storage Division
* Fix LDADD/DPADD that should be LIBADD.bdrewery2015-12-0413-52/+27
| | | | Sponsored by: EMC / Isilon Storage Division
* Follow-up r291330: h_testbits.h is only needed by xdr_test.bdrewery2015-11-251-2/+2
| | | | | | X-MFC-With: r291330 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Replace DPSRCS that work fine in SRCS.bdrewery2015-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so that 'make depend' is not a required build step in these files. DPSRCS is overall unneeded. DPSRCS already contains SRCS, so anything which can safely be in SRCS should be. DPSRCS is mostly just a way to generate files that should not be linked into the final PROG/LIB. For headers and grammars it is safe for them to be in SRCS since they will be excluded during linking and installation. The only remaining uses of DPSRCS are for generating .c or .o files that must be built before 'make depend' can run 'mkdep' on the SRCS c files list. A semi-proper example is in tests/sys/kern/acct/Makefile where a checked-in .c file has an #include on a generated .c file. The generated .c file should not be linked into the final PROG though since it is #include'd. The more proper way here is just to build/link it in though without DPSRCS. Another example is in sys/modules/linux/Makefile where a shell script runs to parse a DPSRCS .o file that should not be linked into the module. Beyond those, the need for DPSRCS is largely unneeded, redundant, and forces 'make depend' to be ran. Generally, these Makefiles should avoid the need for DPSRCS and define proper dependencies for their files as well. An example of an improper usage and why this matters is in usr.bin/netstat. nl_defs.h was only in DPSRCS and so was not generated during 'make all', but only during 'make depend'. The files including it lacked proper depenencies on it, which forced running 'make depend' to workaround that bug. The 'make depend' target should mostly be used for incremental build help, not to produce a working build. This specific example was broken in the meta build until r287905 since it does not run 'make depend'. The gnu/lib/libreadline/readline case is fine since bsd.lib.mk has 'OBJS: SRCS:M*.h' when there is no .depend file. Sponsored by: EMC / Isilon Storage Division MFC after: 1 week
* Use __MAKE_SHELL instead of HOST_SHELL when generating aton_ether_subr.cngie2015-11-231-1/+1
| | | | | | | | | | (HOST_SHELL is used in NetBSD) This fixes permission denied issues when gen_ether_subr is not executable MFC after: 3 days Reported by: José Pérez <fbl@aoek.com> Suggested by: bdrewery, sjg
* Do not print out errno if the call succeeded unexpectedly; this was a mistakengie2015-11-181-2/+2
| | | | | | | | | made in r290868 MFC after: 4 days X-MFC with: r290563, r290868 Reported by: jilles Sponsored by: EMC / Isilon Storage Division
* Add some initial tests for SLIST and STAILQ macrosngie2015-11-162-0/+239
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Disable -Wformat with scanfloat_test when compiling with gcc to avoid angie2015-11-151-0/+8
| | | | | | | | | "use of assignment suppression and length modifier together in scanf format" warning on line 90 (it's intentional) MFC after: 1 week X-MFC with: r290537, r290856, r290860 Sponsored by: EMC / Isilon Storage Division
* Fix -Wformat issuesngie2015-11-151-3/+3
| | | | | | | X-MFC with: r290563 MFC after: 1 week Reported by: gcc Sponsored by: EMC / Isilon Storage Division
* Remove unused variables to fix building worldbapt2015-11-154-13/+2
|
* Change WARNS to 2 across the board with all the libc testcasesngie2015-11-152-2/+2
| | | | | | | This effectively "reverts" r290846 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Fix -Wmissing-braces warnings by adding braces around all thengie2015-11-151-138/+138
| | | | | | | | testcase inputs MFC after: 1 week X-MFC with: r290572 Sponsored by: EMC / Isilon Storage Division
* Fix -Wunused warningsngie2015-11-152-4/+3
| | | | | | MFC after: 1 week X-MFC with: r290572 Sponsored by: EMC / Isilon Storage Division
* Bump WARNS to 2ngie2015-11-151-0/+2
| | | | | | MFC after: 1 week X-MFC with: r290532 Sponsored by: EMC / Isilon Storage Division
* Remove unused variables; sort by alignment where neededngie2015-11-154-5/+1
| | | | | | MFC after: 1 week X-MFC with: r290532 Sponsored by: EMC / Isilon Storage Division
* Polish up iswctype_testngie2015-11-151-28/+50
| | | | | | | | | | - Split up the testcases into C locale and ja_JP.eucJP testcases. - Avoid a segfault in the event that setlocale fails, similar to r290843 - Replace `sizeof(x) / sizeof(*x)` pattern with `nitems(x)` MFC after: 1 week X-MFC with: r290532 Sponsored by: EMC / Isilon Storage Division
* Polish up the tests a bit more after projects/collation was merged to headngie2015-11-152-37/+77
| | | | | | | | | | | | | | | Provide more meaningful diagnostic messages if LC_CTYPE can't be set properly instead of segfaulting, because setlocale returns NULL and strcmp(NULL, b) will always segfault Split up the testcases so one failing (in this case en_US.ISO8859-15) won't cause the rest of the testcases to be skipped Remove some unused variables MFC after: 1 week X-MFC with: r290532 Sponsored by: EMC / Isilon Storage Division
* Fix the Indian numbering system (hi_IN.ISCII-DEV) testsngie2015-11-151-4/+4
| | | | | | Submitted by: ache X-MFC with: r290494 (if that ever happens) Sponsored by: EMC / Isilon Storage Division
* Add missing licensing boilerplate to test-fnmatch.cngie2015-11-101-0/+25
| | | | | | | | Carry over licensing author info from fnmatch_test.c (jilles@) MFC after: 1 week X-MFC with: r290572 Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/gen into the FreeBSD test suitengie2015-11-0910-1/+1666
| | | | | | | | | | | | | | | | | | | as lib/libc/tests/gen The code in test-fnmatch that was used for generating: - bin/sh/tests/builtins/case2.0 - bin/sh/tests/builtins/case3.0 has been left undisturbed. The target `make sh-tests` has been moved over from tools/regression/lib/libc/gen/Makefile to lib/libc/tests/gen/Makefile and made into a PHONY target case2.0 and case3.0 test input generation isn't being done automatically. This needs additional discussion. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Fix some TAP -> ATF conversion errorsngie2015-11-091-6/+3
| | | | | | | | - Remove a leftover printf from when this was a TAP based testcase - Catch mmap failures properly MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/net into the FreeBSD test suitengie2015-11-085-8/+426
| | | | | | | | | | as lib/libc/tests/net Also, fix eui64_aton_test:test_str(..). The test was comparing the result of eui64_aton to a pointer of the expected result. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Delete leftover printfs from when these were TAP testsngie2015-11-084-8/+0
| | | | | | MFC after: 1 week X-MFC with: r290532 Sponsored by: EMC / Isilon Storage Division
* Convert print_positional_test over to ATFngie2015-11-081-16/+40
| | | | | | | | Somehow missed in r290537 X-MFC with: r290537 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* printfloat_test and scanfloat_test need symbols from msun; these are ↵ngie2015-11-081-0/+6
| | | | | | | | | | | | automatically provided on amd64, but not i386. Add libm to DPADD/LDADD to unbreak the i386 tinderbox Pointyhat to: ngie MFC after: 1 week X-MFC with: r290538 Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/string into the FreeBSD test suitengie2015-11-085-1/+554
| | | | | | | as lib/libc/tests/string MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suitengie2015-11-085-2/+492
| | | | | | | | | | as lib/libc/tests/stdlib - Make the code a bit more style(9) compliant - Convert a sizeof(x)/sizeof(x[0]) to nitems MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/stdio into the FreeBSD test suitengie2015-11-0814-23/+2613
| | | | | | | | | | | as lib/libc/tests/stdio - Fix some whitespace - Convert the testcases to ATF - Convert "/dev/null" to _PATH_DEVNULL MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/locale into the FreeBSD test suitengie2015-11-0818-1/+2355
| | | | | | | as lib/libc/tests/locale MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Add _test suffix to multiple tests in lib/libc to conform to the design notedngie2015-11-023-38/+38
| | | | | | | in the FreeBSD Test Suite wiki MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
* Remove unused variable (SRCDIR)ngie2015-11-021-2/+0
| | | | | MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
* Not all targets support by clang have a tested or enabled ubsan yet.sbruno2015-10-301-0/+4
| | | | | | | Only enable h_raw on x86 targets for today so that a buildworld runs to completion for clang enabled targets that are not x86. This should be removed when validation of the sanitizer has occured for all targets supported by FreeBSD and clang.
* Disable h_raw/h_read with gccngie2015-10-301-2/+7
| | | | | | | I forgot that these testcases fail with gcc 4.2.1; add a note to that effect MFC after: never Sponsored by: EMC / Isilon Storage Division
* - Re-enable h_raw with clang 3.7.0+ngie2015-10-301-1/+2
| | | | | | | | - Fix the compiler check to allow the test to be compiled for gcc PR: 196430 MFC after: never Sponsored by: EMC / Isilon Storage Division
* Integrate contrib/netbsd-tests/lib/libc/rpc into the FreeBSD test suitengie2015-10-301-0/+1
| | | | | | | | | | as lib/libc/rpc This testcase requires rpcbind be up in running; otherwise the testcases will time out and be skipped MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andngie2015-10-1226-60/+9
| | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
* In this context fclose() can never fail, so assert it in the testdelphij2015-09-291-0/+1
| | | | case.
* Add missing CLEANFILES.bdrewery2015-09-241-0/+2
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Enable mincore_test on arm64, we now have a working pmap_mincore.andrew2015-09-081-3/+0
| | | | | | PR: 202307 Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation
* Fix t_spawnattr test for attributes handling by posix_spawn(3).kib2015-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | Connect it to the build. The code assumed that SCHED_* constants form a contiguous set of numbers, remove the assumption by using schedulers[] array in get_different_scheduler(). This is no-op on FreeBSD, but improves code portability. The selection of different priority used the min/max priority range of the current scheduler class, instead of the priority to be changed to. The bug caused the test failure. Remove duplication of POSIX_SPAWN_SETSIGDEF flag and now unused duplications of MIN/MAX definitions. Reviewed by: jilles, pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3533
* On arm64 disable three tests that hang or panicemaste2015-08-171-0/+3
| | | | | | | | | | Each issue has a PR open to track. This workaround allows us to run the tests to investigate the failures and avoid any new regressions. PR: 202304, 202305, 202307 Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3378
OpenPOWER on IntegriCloud