summaryrefslogtreecommitdiffstats
path: root/lib/libc/tests
Commit message (Collapse)AuthorAgeFilesLines
* iconvctl(3): remove superfluous NULL pointer testsvangyzen2016-05-143-0/+79
| | | | | | | | | | | | | | | convname and dst are guaranteed to be non-NULL by iconv_open(3). src is an array. Remove these tests for NULL pointers. While I'm here, eliminate a strlcpy with a correct but suspicious-looking calculation for the third parameter (i.e. not a simple sizeof). Compare the strings in-place instead of copying. Found by: bdrewery Found by: Coverity CID: 1130050, 1130056 MFC after: 3 days Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D6338
* Read the contents of the snapshot files properlyngie2016-05-131-18/+15
| | | | | | | | | | - Use fgetln instead of fgets; localize complexity related to fgetln(3) inside the loop. - Skip over blank lines. - Skip over lines (properly) that start with a "#" MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* print_positional_test: Fix misuse of wchar APIscem2016-05-121-3/+4
| | | | | | | | These APIs take unit length, not byte length parameters. Reported by: Coverity CIDs: 1338543, 1338544, 1338545 Sponsored by: EMC / Isilon Storage Division
* nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliasescem2016-05-121-1/+1
| | | | | | | | | h_aliases is a NULL-terminated rather than fixed-length array. nitems() is not a valid way to determine its end; instead, check for NULL. Reported by: Coverity CID: 1346578 Sponsored by: EMC / Isilon Storage Division
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-0427-149/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* libc: spelling fixes.pfg2016-04-302-4/+4
| | | | Mostly on comments.
* Fix double fclose of `fp1` when freopen failsngie2016-04-201-1/+0
| | | | | | | | | | | | freopen handles closing file descriptors on error, with the exception of fdopen'ed descriptors, so closing an already fclose'd file descriptor is incorrect CID: 1338525 Differential Revision: https://reviews.freebsd.org/D6013 MFC after: 2 weeks Reported by: Coverity Sponsored by: EMC / Isilon Storage Division
* Make sure fmemopen succeeds in :test_append_binary_pos before calling ftellngie2016-04-191-0/+2
| | | | | | | | | | | on the FILE object This fixes potential null pointer dereferences on failure CID: 1254952 MFC after: 2 weeks Reported by: Coverity Sponsored by: EMC / Isilon Storage Division
* MFHgjb2016-04-041-1/+1
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * WITHOUT_TOOLCHAIN: Skip building of h_raw.bdrewery2016-03-311-1/+1
| | | | | | | | | | | | | | -fsanitize does not seem to work when a --sysroot is specified and there is no <sysroot>/usr/lib/clang/3.8.0/lib/freebsd/libclang_rt.ubsan_standalone-*.a. Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-03-1026-0/+512
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-0925-0/+511
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
| * Fix and connect setjmp test.bdrewery2016-03-091-0/+1
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-03-072-0/+125
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * libc: Add some tests for memcmp().jilles2016-03-062-0/+125
| |
* | MFHgjb2016-02-222-2/+2
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Remove dd xfer stats emitted during buildworldemaste2016-02-182-2/+2
| | | | | | | | They result in gratuitous differences when comparing build log output.
* | MFHgjb2016-02-181-0/+2
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Fix build race after r295643.bdrewery2016-02-171-0/+2
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | Final pass through to fix 'tests' packaging.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | More 'tests' packaging fixes.gjb2016-02-031-1/+3
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | Fix another 'tests' packaging error.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | More 'tests' package fixes.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-02-022-0/+98
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * This seems like a very trivial bug that should have been squashed a longsobomax2016-01-302-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | time ago, but for some reason it was not. Basically, without this change dlopen(3)'ing an empty .so file would just cause application to dump core with SIGSEGV. Make sure the file has enough data for at least the ELF header before mmap'ing it. Add a test case to check that dlopen an empty file return an error. There were a separate discussion as to whether it should be SIGBUS instead when you try to access region mapped from an empty file, but it's definitely SIGSEGV now, so if anyone want to check that please be my guest. Reviewed by: mjg, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5112
* | First pass to fix the 'tests' packages.gjb2016-02-0223-0/+92
|/ | | | Sponsored by: The FreeBSD Foundation
* 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
OpenPOWER on IntegriCloud