Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Dec 2014 20:13:32 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r276478 - in stable/10: contrib/netbsd-tests contrib/netbsd-tests/include contrib/netbsd-tests/lib/libc/db contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/gen/posix_spaw...
Message-ID:  <201412312013.sBVKDWpR044612@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Dec 31 20:13:31 2014
New Revision: 276478
URL: https://svnweb.freebsd.org/changeset/base/276478

Log:
  MFC r272343,r272458,r272890,r272891,r272901,r272902,r272903,r272905,r272908,r272909,r272910,r272914,r272915,r272979,r272980,r273010,r273011,r273012,r273015,r273017,r273019,r273020,r273021,r273022,r273023,r273024,r273025,r273389,r273390,r273391,r273393,r273395,r273396,r273397,r273410,r273516,r273517,r273520,r273521,r273522,r273523,r273524,r273525,r273526,r273527,r273528,r273529,r273530,r273533,r273534,r273535,r273536,r273537,r273538,r273539,r273540,r273572,r273574,r273578,r273579,r273591,r273592,r273928,r273933,r273935,r273936,r273937,r273938,r273942,r273943,r273945,r273946,r273947,r273948,r273949,r273950,r273951,r273952,r274061,r274062,r274066,r274067,r274072,r274074,r274079,r274090,r274142,r274143,r274571,r274572,r274573,r274574,r274575,r274576,r274577,r274579,r274597,r274598,r274599,r274600,r274601,r274626,r275033,r276046,r276430:
  
  r272343:
  r272458:
  
    Import the NetBSD test suite from ^/vendor/NetBSD/tests/09.30.2014_20.45 ,
    minus the vendor Makefiles
  
    Provide directions for how to bootstrap the vendor sources in
    FREEBSD-upgrade
  
    MFC after 2 weeks
    Discussed with: rpaulo
    Sponsored by: EMC / Isilon Storage Division
  
  r272890:
  
    Only build/run hsearch_basic and hsearch_r_basic on NetBSD
  
    hdestroy1 is not present on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r272891:
  
    Expect SIGSEGV in lib/libc/stdlib/t_getenv:setenv_basic
  
    See bin/189805 for more details
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272901:
  
    Disable tests that don't pass on FreeBSD due to missing support in
    humanize_number(3). Bringing in additional revisions from NetBSD's
    humanize_number(3) will fix the tests
  
    Account for the fact that util.h on NetBSD is libutil.h on FreeBSD
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272902:
  
    Add missing #include <sys/time.h> for gettimeofday
  
    Sponsored by: EMC / Isilon Storage Division
  
  r272903:
  
    FreeBSD returns ENOTTY instead of EBADF in ttyname_r; mark it as an expected
    failure
  
    PR: 191936
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272905:
  
    FreeBSD doesn't support strings greater than MAXHOSTNAMELEN-1 in
    {get,set}{domain,host}name. Adjust the tests to not exceed that
    value when testing out the code
  
    Add a positive and negative test for MAXHOSTNAMELEN-1 and
    MAXHOSTNAMELEN, respectively
  
    PR: 181127
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272908:
  
    Disable the invalid pointer test on FreeBSD
  
    FreeBSD segfaults on invalid pointers passed to getcwd because it throbs the
    address passed in in libc, whereas NetBSD just passes the information off to
    the syscall, which allows the kernel to return EFAULT on bad pointers.
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272909:
  
    Handle getting/setting niceness/priority correctly on FreeBSD vs NetBSD
  
    This might be fallout from PR: 189821
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272910:
  
    SIGPWR does not exist on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r272914:
  
    Skip over t_spawn_open_nonexistent_diag because it requires NetBSD specific
    additions to posix_spawn
  
    Sponsored by: EMC / Isilon Storage Division
  
  r272915:
  
    Port the testcase to FreeBSD
  
    - Make #include path to h_macros.h a non-relative path
    - __gl_stat_t is synonymous with struct stat on FreeBSD
    - FreeBSD doesn't have _DIRENT_RECLEN
    - Skip over glob_star on FreeBSD (testcase doesn't pass)
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r272979:
  
    Only #include <sys/tls.h> on NetBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r272980:
  
    #include libutil.h for fparseln on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273010:
  
    Implement 64MB memory limit for test to ensure that it fails reliably in
    600 seconds; it would previously fail inconsistently when run in some virtual
    machine configurations
  
    This patch might need to be reverted or revisited later (see the attached PR
    for more details)
  
    PR: 169302
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273011:
  
    Fix compilation errors with missing wide-type headers and fix compilation
    warnings with -Wformat
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273012:
  
    - Add libutil #include for fparseln
    - Change ATF_REQUIRE_EQ_MSG to ATF_CHECK_EQ_MSG to gather all failing results
      possible (currently 12 with leftassoc)
    - Mark leftassoc "atf_tc_expect_fail" on FreeBSD (PR coming soon after further
      analysis is done on the code)
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273015:
  
    Expect nice_err to fail on FreeBSD with unprivileged users
  
    PR: 189821
    Sponsored by: EMC / Isilon Storage Division
  
  r273017:
  
    Add #include <stdio.h> for printf
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273019:
  
    Do initial port of contrib/netbsd-tests/lib/libc/locale
  
    t_io:
    - Expect failures potentially related to implementation-specific knowledge of
    the zh_TW.Big5 locale [*]
  
    t_mbrtowc:
    - Handle unknown locales more gracefully (do not test if the locale doesn't
    exist)
    - Expect failure with mbrtowc_internal dealing with Japanese locales
    (potentially related to implementation detail knowledge of the ja_* locales) [*].
  
    t_mbstowcs, t_mbtowc, t_wctomb:
    - Handle unknown locales more gracefully (do not test if the locale doesn't
    exist)
  
    t_wcstod:
    - Treat FreeBSD like NetBSD and Linux in the XXX: FIXME section
  
    [*] More investigation is required to determine the root cause of the failures
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273020:
  
    memmem with NUL length "needle" (aka small) strings on FreeBSD/OSX returns
    NULL instead of the "haystack" value (aka big)
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273021:
  
    Use 1 as a random seed, as recommended in srandom(3). Adjust the random values
    accordingly
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273022:
  
    Add #include <stdio.h> to get sys_nerr definition
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273023:
  
    __isnanl is automatically picked according to data type in <math.h>. There
    isn't a need for the explicit __isnanl test
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273024:
  
    Only test the return value in mktime_negyear
  
    Testing for the errno is an optional requirement according to POSIX, and
    FreeBSD doesn't document that errno would be set on failure with mktime
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273025:
  
    Change ATF_REQUIRE_MSG calls to ATF_CHECK_MSG to get as many errors as possible
  
    t_strptime:common..
    - Expect the testcase body as a whole to fail. Multiple PRs will be filed to
    track the issues (there are 18 check failures)
  
    t_strptime:day..
    - %EA and %OA seem to be case insensitive on FreeBSD
  
  r273389:
  
    Port lib/libc/gen/t_siginfo to FreeBSD
  
    - mcontext_t on FreeBSD doesn't have a __gregs field (it's split out on FreeBSD
    into separate fields). In order to avoid muddying the test code with MD code,
    the debugging trace info has not been implemented
    - FreeBSD does not implement the si_stime and si_utime fields in siginfo_t, so
    omit the debugging code that dumps the values
    - sys/inttypes.h doesn't exist on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273390:
  
    libutil.h is required for fparseln on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273391:
  
    Add missing #include for sys/stat.h for fchmod
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273393:
  
    Port t_write to FreeBSD
  
    - Mark the signo variable for the signal handle __unused
    - Use limits.h instead of sys/syslimits.h (the latter does not
    exist on FreeBSD)
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273395:
  
    Mark osi __unused so this compiles cleanly on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273396:
  
    unlink("/") fails with EISDIR instead of EBUSY on FreeBSD; test for that
    instead
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273397:
  
    Port t_chroot to FreeBSD
  
    - Add missing #include sys/stat.h for mkdir(2)
    - Omit the fchroot(2) tests because the support is not present on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273410:
  
    Add sys/socket.h #include for bind(2), et al
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273516:
  
    Add netinet/in.h for struct sockaddr_in
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273517:
  
    Expect getgroups_err to fail on FreeBSD
  
    PR: 189941
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273520:
  
    Port t_pipe2.c to FreeBSD
  
    - Omit the pipe2_nosigpipe testcase on FreeBSD (FreeBSD doesn't have
      O_NOSIGPIPE).
    - Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)".
    - Save and restore the resource limit on the number of files (RLIMIT_NOFILE).
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273521:
  
    Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)"
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273522:
  
    - Mark unused parameters __unused in handler
    - Call sigqueue with getpid() instead of 0 -- the latter idiom appears to only
    be valid on NetBSD
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273523:
  
    Add limits.h #include for LINE_MAX
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273524:
  
    Add sys/socket.h #include for struct sockaddr_in
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273525:
  
    Port t_mmap.c to FreeBSD
  
    - Add needed headers for the testcases
    - Omit mmap_block on non-NetBSD OSes
    - Use "security.bsd.map_at_zero" instead of "vm.user_va0_disable"
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273526:
  
    Omit the pollts testcases on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273527:
  
    Omit all of the testcases as revoke(2) is only implemented on devfs(5)
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273528:
  
    Mark signo __unused in handler(..)
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273529:
  
    - Omit the poll testcases on FreeBSD (they require pollts)
    - Add necessary headers for the testcases
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273530:
  
    Add limits.h #include for INT_MAX
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273533:
  
    Use <atf_srcdir>/truncate_test.root_owned instead of /usr/bin/fpr as fpr does
    not exist on FreeBSD
  
    truncate_test.root_owned will be generated at build time and owned by root
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273534:
  
    - Mark sig/signo __unused
    - Do not provide a relative path via #include "h_macros.h"
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273535:
  
    - Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al)
    - Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t
    on FreeBSD)
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273536:
  
    Add limits.h #include for SSIZE_MAX
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273537:
  
    Add limits.h #include for SSIZE_MAX
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273538:
  
    Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr)
  
  r273539:
  
    Mark signum __unused
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273540:
  
    Omit the mprotect_exec testcase on FreeBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273572:
  
    - Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always
      executed on a non-devfs filesystem
    - Expect mknod(path, S_IFREG, 0) to fail on FreeBSD
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273574:
  
    - Test for EINVAL requirement when passing an invalid flag in to msync(2)
    - Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region
      on FreeBSD
  
    Submitted by: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273578:
  
    - Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD
    - Use #include "h_macros.h" instead of relative path analog
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273579:
  
    - Mark signo __unused in the signal handler function
    - Effectively #if 0 out some code that does not fail on FreeBSD
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273591:
  
    Correct my previous commit:
  
    - getrusage_utime_back succeeds reliably on FreeBSD
    - getrusage_utime_zero passes/fails in a seemingly non-deterministic manner.
      Skip it for now (and fix it later)
  
    In the initial port of this testcase to FreeBSD, the results failed reliably
    in the same manner as it does on NetBSD
  
    Sponsored by: EMC / Isilon Storage Division
  
  r273592:
  
    - Add sys/types.h for the APIs in sys/sysctl.h
    - Poke at VM_MIN_ADDRESS in machine/vmparam.h because FreeBSD doesn't have a
      vm.minaddress sysctl analog
    - Expect ENOMEM instead of EAGAIN in mlock_limits
    - Provide mlock an mmap'ed page twice to simulate MAP_WIRED on NetBSD
  
    In collaboration with: pho
    Sponsored by: EMC / Isilon Storage Division
  
  r273928:
  
    Put mtree test files into a subdirectory.
  
    Kyua 0.11 points TMPDIR to the test's work directory, and atf_check creates
    auxiliary files in TMPDIR.  This confuses a couple of mtree tests that were
    using the work directory's root to validate the contents of the directory.
  
    Fix the two affected tests by creating an auxiliary directory to use for
    the mtree tests.  (Kyua should probably do this on its own; filed bug #133
    upstream to take a look at this.)
  
  r273933:
  
    Don't prune duplicate services in the expected output from /etc/services on
    FreeBSD
  
    Submitted by: pho
  
  r273935:
  
    Port tests to FreeBSD/Linux
  
    Some of the testcases don't work outside of NetBSD, and the behavior of
    ether_aton_r differs between FreeBSD, Linux, and NetBSD, and the calls to the
    API need to be massaged for FreeBSD and Linux.
  
    Submitted by: pho
  
  r273936:
  
    Port lib/libc/net/h_dns_server to FreeBSD
  
    Submitted by: pho
  
  r273937:
  
    Port lib/libc/sys/t_dup to FreeBSD/Linux
  
    - The requirements differ between FreeBSD/Linux when dealing with oldd/newd
      being equal (both fail with EINVAL, not EBADF)
    - Add an EBADF testcase
    - Fix compilation issues on clang
  
    In collaboration with: pho
  
  r273938:
  
    getitimer on FreeBSD returns the last set time instead of the remaining time;
    test for that instead
  
    Submitted by: pho
  
  r273942:
  
    Skip :sethostname_basic because it messes up the test host's hostname
  
    Convert code from #if defined(__FreeBSD__) to #ifdef __FreeBSD__
  
  r273943:
  
    Port t_kevent to FreeBSD
  
    Submitted by: pho
  
  r273945:
  
    Port t_mincore to FreeBSD
  
    Mark :mincore_resid as atf_tc_expect_fail on FreeBSD because of new bug
    discovered in running the tests (it succeeded from earlier on in the year to
    September/October on FreeBSD, at least)
  
    Submitted by: pho
  
  r273946:
  
    Port h_atexit to FreeBSD
  
    __cxa_atexit varies between FreeBSD and NetBSD, and thus we must use pointers
    instead of static fields in the BSS. More extensive discussion is included in
    the source code
  
    In collaboration with: kib
    Submitted by: pho
  
  r273947:
  
    Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes
  
  r273948:
  
    Disable testcases 12 and 15-22 on FreeBSD
  
    Submitted by: pho
  
  r273949:
  
    Add new atf_tc_expect_fail to fflush_err; this is a new (within the past couple months) bug
  
  r273950:
  
    Skip :fopen_regular on !NetBSD because it's a NetBSD specific test
  
    Submitted by: pho
  
  r273951:
  
    Expect :sscanf_whitespace to fail on !NetBSD OSes
  
    Submitted by: pho
  
  r273952:
  
    Port h_hash and t_sha2 to FreeBSD
  
    t_sha2 contains dirty copy-paste hacks that need to be fixed with the openssh
    OpenBSD compat layer
  
    Submitted by: pho
  
  r274061:
  
    Port t_db.sh to FreeBSD
  
    - The blocksize on FreeBSD is 32kB, not 64kB
    - Add some detection for MK_DICT == no; /nonexistent is echoed along with
      atf_skip to ensure that the test will fail if dict(..) is called in the
      non-final stage of the pipeline
  
    Submitted by: pho
  
  r274062:
  
    inet_network on FreeBSD returns NULL when provided "0x" to inet_network
  
    Submitted by: pho
  
  r274066:
  
    Port lib/libc/ssp to FreeBSD
  
    In most cases, the buffers and data were resized, but when dealing with the
    helpers, some of the code was adjusted to fail more reliably
  
    Submitted by: pho
  
  r274067:
  
    rpc_control on FreeBSD is a public-ish API (not prefixed with __), not private
    like NetBSD
  
    Submitted by: pho
  
  r274072:
  
    Finish off lib/libc/stdlib/t_strtod.c port by checking for "y" twice on
    FreeBSD, and always assume long long double exists on FreeBSD
  
    Submitted by: pho
  
  r274074:
  
    Add Makefile snippet to ease porting NetBSD testcases to FreeBSD from
    contrib/netbsd-tests
  
    This Makefile snippet handles polluting testcases with -lnetbsd, specific
    headers for ATF version differences, and does necessary rewriting for the
    testcases to match the format discussed on the TestSuite wiki page
    (t_<foo> -> <foo>_test)
  
    One must define SRCTOP (inspired by projects/bmake), OBJTOP, and TESTSRC
    (e.g. contrib/netbsd-tests/lib/libc/gen) to use the Makefile snippet
  
    Test programs are specific either via NETBSD_ATF_TESTS_C or NETBSD_ATF_TESTS_SH
  
    C++ analogs aren't currently implemented.
  
    The imported testcases will be cleaned up to use this Makefile snippet pseudo
    "API".
  
  r274079:
  
    Import proper fix for misc/49356 (/usr/include/atf-c/config.h) after atf-c/config.h
    was removed from the build
  
    Pointyhat to: me (again, for not running make delete-old after running test builds)
  
  r274090:
  
    Fix the Jenkins test run by skipping the negative testcases earlier
  
    The problem is that lib.libc.locale.t_io:bad_big5_wprintf was printing out
    illegal Unicode characters, which causes XML parsers to bail immediately, e.g.
  
    % kyua report-junit > ~/report.junit
    % python2 -c 'import xml.dom.minidom as md; md.parse("/home/ngie/report.junit")'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
        return expatbuilder.parse(file)
      File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
        result = builder.parseFile(fp)
      File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
        parser.Parse(buffer, 0)
    xml.parsers.expat.ExpatError: not well-formed (invalid token): line 27137, column 13
  
  r274142:
  
    Remove expected failure from lib.libc.sys.t_mincore:mincore_resid
  
    The failure was added based on observation seen on 11.0-CURRENT @ r273153, not
    based on internal testing at EMC/Isilon
  
    PR: 194829
    Tested with the following configuration:
    - amd64/i386
    - 11.0-CURRENT @ r273153
    - 100 times in a tight loop as root with the following commands...
    -- kyua test lib/libc
    -- kyua test lib/libc/sys
    -- kyua test lib/libc/sys/mincore_test
  
  r274143:
  
    Expect lib.libc.sys.getcontext_test.setcontext_link to fail on amd64; add
    additional debugging to make the underlying problem more visible
  
    Calling setcontext(2) on amd64 as shown in the test program is failing on
    amd64, not i386, with a return code of -1 and an errno of EINVAL
  
    Further investigation is being done in the PR to determine the root cause for
    the failure
  
    PR: 194828
    Tested with the following configuration:
    - amd64/i386
    - 11.0-CURRENT @ r273153
    - 100 times in a tight loop as root with the following commands...
    -- kyua test lib/libc
    -- kyua test lib/libc/sys
    -- kyua test lib/libc/sys/getcontext_test
  
  r274571:
  
    Use _exit instead of exit so the file descriptors aren't flushed twice in the
    child processes
  
    Submitted by: pho
  
  r274572:
  
    Only expect timeouts on powerpc with NetBSD
  
    Submitted by: pho
  
  r274573:
  
    Expect :pthread_detach to fail with EINVAL instead of ESRCH on FreeBSD
  
    PR: 191906
    In collaboration with: pho
  
  r274574:
  
    Add pthread_np.h #include and initialize the pthread attribute on FreeBSD
  
    Submitted by: pho
  
  r274575:
  
    #ifdef out a printf on !NetBSD that causes the testcase to fail when comparing
    the output from the helper program
  
    Submitted by: pho
  
  r274576:
  
    Port helper program to FreeBSD, similar to ../../lib/libc/stdlib/h_atexit.c
  
    Submitted by: pho
    In collaboration with: kib
  
  r274577:
  
    Add missing sys/time.h #include for timespecsub macro in lib/libnetbsd/sys/time.h
  
  r274579:
  
    Call sem_unlink on semaphores before attempting to create them
  
    Due to the lack of uniqueness in the semaphore name, and the fact that the
    tests don't have cleanup routines, an interrupted test can leave a semaphore
    "laying around", causing all subsequent attempts to run the test to fail
  
    I will file a NetBSD PR for this issue soon
  
  r274597:
  
    Skip the long-double epsilon checks on FreeBSD/i386
  
    Sponsored by: EMC / Isilon Storage Division
  
  r274598:
  
    Reset errno to 0 before running scalbn to be sure that the tested errno is
    valid
  
    Sponsored by: EMC / Isilon Storage Division
  
  r274599:
  
    Alias isinff to isinf on FreeBSD
  
    isinf on FreeBSD automatically picks the appropriate type per math.h
  
    Sponsored by: EMC / Isilon Storage Division
  
  r274600:
  
    - Expect exp2_powers to fail on FreeBSD/i386
    - Expect exp2_values to fail on FreeBSD due to the small epsilon
  
    Sponsored by: EMC / Isilon Storage Division
  
  r274601:
  
    - Skip over the testcases that call cbrtl on platforms where LDBL_PREC == 53
    (arm, mips, powerpc). This fixes the build on these platforms, based on some
    ad hoc tinderbox runs I did a while ago
    - Skip cast the arguments to powl as long double so powl properly interprets
    those arugments at compile-time when picking the type
  
    Sponsored by: EMC / Isilon Storage Division
  
  r274626:
  
    Mechanically replace #if defined(__FreeBSD__) and #if defined(__NetBSD__) with
    their #ifdef equivalents for everything changed in contrib/netbsd-tests. There
    are some items from the vendor tree that use #if defined(__FreeBSD__) or
    #if defined(__NetBSD__) which are being left alone
  
    Requested by: bde, rpaulo
    Sponsored by: EMC / Isilon Storage Division
  
  r275033:
  
    Only pass 6 arguments to the 'run' function on amd64.  amd64's
    makecontext on FreeBSD only supports a maximum of 6 arguments.  This
    fixes the setcontext_link test on amd64.
  
    PR:		194828
  
  r276046:
  
    Add __FreeBSD_version guards around hsearch_r to ease MFCing the code to
    stable/10
  
    It was added when __FreeBSD_version was ~1100027
  
  r276430:
  
    Expect access_test:access_inval to fail before __FreeBSD_version == 1100033
  
    This will allow me to MFC the test, as jilles@ requested that I don't MFC the
    access(2) KBI change to 10-STABLE in r271655

Added:
  stable/10/contrib/netbsd-tests/
     - copied from r272458, head/contrib/netbsd-tests/
  stable/10/share/mk/netbsd-tests.test.mk
     - copied, changed from r274074, head/share/mk/netbsd-tests.test.mk
Modified:
  stable/10/contrib/netbsd-tests/include/t_paths.c
  stable/10/contrib/netbsd-tests/lib/libc/db/t_db.sh
  stable/10/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_glob.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_isnan.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_nice.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_raise.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_time.c
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
  stable/10/contrib/netbsd-tests/lib/libc/hash/h_hash.c
  stable/10/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
  stable/10/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_io.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c
  stable/10/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c
  stable/10/contrib/netbsd-tests/lib/libc/net/h_dns_server.c
  stable/10/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c
  stable/10/contrib/netbsd-tests/lib/libc/net/t_servent.sh
  stable/10/contrib/netbsd-tests/lib/libc/regex/debug.c
  stable/10/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
  stable/10/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
  stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
  stable/10/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
  stable/10/contrib/netbsd-tests/lib/libc/ssp/h_read.c
  stable/10/contrib/netbsd-tests/lib/libc/ssp/h_readlink.c
  stable/10/contrib/netbsd-tests/lib/libc/ssp/h_snprintf.c
  stable/10/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh
  stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c
  stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c
  stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c
  stable/10/contrib/netbsd-tests/lib/libc/stdio/t_printf.c
  stable/10/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
  stable/10/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
  stable/10/contrib/netbsd-tests/lib/libc/string/t_memcpy.c
  stable/10/contrib/netbsd-tests/lib/libc/string/t_memmem.c
  stable/10/contrib/netbsd-tests/lib/libc/string/t_strerror.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_access.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_chroot.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_connect.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_dup.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_link.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_listen.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mknod.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_msync.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_poll.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_select.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_stat.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_write.c
  stable/10/contrib/netbsd-tests/lib/libc/time/t_strptime.c
  stable/10/contrib/netbsd-tests/lib/libc/tls/dso/h_tls_dlopen.c
  stable/10/contrib/netbsd-tests/lib/libc/tls/t_tls_dlopen.c
  stable/10/contrib/netbsd-tests/lib/libc/tls/t_tls_dynamic.c
  stable/10/contrib/netbsd-tests/lib/libc/tls/t_tls_static.c
  stable/10/contrib/netbsd-tests/lib/libc/tls/t_tls_static_helper.c
  stable/10/contrib/netbsd-tests/lib/libc/tls_dso/h_tls_dynamic.c
  stable/10/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c
  stable/10/contrib/netbsd-tests/lib/libm/t_cbrt.c
  stable/10/contrib/netbsd-tests/lib/libm/t_exp.c
  stable/10/contrib/netbsd-tests/lib/libm/t_ldexp.c
  stable/10/contrib/netbsd-tests/lib/libm/t_log.c
  stable/10/contrib/netbsd-tests/lib/libm/t_pow.c
  stable/10/contrib/netbsd-tests/lib/libm/t_precision.c
  stable/10/contrib/netbsd-tests/lib/libm/t_scalbn.c
  stable/10/contrib/netbsd-tests/lib/libpthread/h_atexit.c
  stable/10/contrib/netbsd-tests/lib/libpthread/h_cancel.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_condwait.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_detach.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_fork.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_join.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_mutex.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_once.c
  stable/10/contrib/netbsd-tests/lib/libpthread/t_sem.c
  stable/10/contrib/netbsd-tests/lib/librt/t_sem.c
  stable/10/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
  stable/10/share/mk/bsd.progs.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/netbsd-tests/include/t_paths.c
==============================================================================
--- head/contrib/netbsd-tests/include/t_paths.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/include/t_paths.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_paths.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $ */
+/*	$NetBSD: t_paths.c,v 1.14 2014/11/04 00:20:19 justin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_paths.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $");
+__RCSID("$NetBSD: t_paths.c,v 1.14 2014/11/04 00:20:19 justin Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -42,7 +42,6 @@ __RCSID("$NetBSD: t_paths.c,v 1.13 2014/
 #include <unistd.h>
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
 #define PATH_DEV	__BIT(0)	/* A device node	*/
 #define PATH_DIR	__BIT(1)	/* A directory		*/

Modified: stable/10/contrib/netbsd-tests/lib/libc/db/t_db.sh
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/db/t_db.sh	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/db/t_db.sh	Wed Dec 31 20:13:31 2014	(r276478)
@@ -41,6 +41,18 @@ dict()
 	fi
 }
 
+# Begin FreeBSD
+dict()
+{
+	if [ -f /usr/share/dict/words ]; then
+		echo /usr/share/dict/words
+	else
+		echo /nonexistent
+		atf_skip "Test requires dict/words"
+	fi
+}
+# End FreeBSD
+
 SEVEN_SEVEN="abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg"
 
 atf_test_case small_btree
@@ -887,7 +899,15 @@ r
 k1234
 EOF
 
+	# Begin FreeBSD
+	if true; then
+		atf_check "$(prog)" -i bsize=32768 hash in
+	else
+	# End FreeBSD
 	atf_check "$(prog)" -i bsize=65536 hash in
+	# Begin FreeBSD
+	fi
+	# End FreeBSD
 }
 
 atf_init_test_cases()

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -31,6 +31,9 @@
  */
 
 
+#ifdef __FreeBSD__
+#include <sys/stat.h>
+#endif
 #include <atf-c.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -248,6 +251,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent, tc
 	posix_spawn_file_actions_destroy(&fa);
 }
 
+#ifdef __NetBSD__
 ATF_TC(t_spawn_open_nonexistent_diag);
 
 ATF_TC_HEAD(t_spawn_open_nonexistent_diag, tc)
@@ -283,6 +287,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent_dia
 	posix_spawn_file_actions_destroy(&fa);
 	posix_spawnattr_destroy(&attr);
 }
+#endif
 
 ATF_TC(t_spawn_fileactions);
 
@@ -376,7 +381,9 @@ ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, t_spawn_fileactions);
 	ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent);
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent_diag);
+#endif
 	ATF_TP_ADD_TC(tp, t_spawn_reopen);
 	ATF_TP_ADD_TC(tp, t_spawn_openmode);
 	ATF_TP_ADD_TC(tp, t_spawn_empty_fileactions);

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_floatunditf.c,v 1.5 2014/02/02 08:16:22 martin Exp $ */
+/* $NetBSD: t_floatunditf.c,v 1.6 2014/11/04 00:20:19 justin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -27,7 +27,6 @@
  */
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 #include <inttypes.h>
 #include <math.h>
 

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fpsetmask.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $ */
+/*	$NetBSD: t_fpsetmask.c,v 1.14 2014/11/04 00:20:19 justin Exp $ */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -29,7 +29,6 @@
 #include <sys/param.h>
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
 #include <stdio.h>
 #include <signal.h>

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -56,10 +56,12 @@ ATF_TC_BODY(getcwd_err, tc)
 	ATF_REQUIRE(getcwd(buf, 0) == NULL);
 	ATF_REQUIRE(errno == EINVAL);
 
+#ifdef __NetBSD__
 	errno = 0;
 
 	ATF_REQUIRE(getcwd((void *)-1, sizeof(buf)) == NULL);
 	ATF_REQUIRE(errno == EFAULT);
+#endif
 }
 
 ATF_TC(getcwd_fts);

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_glob.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_glob.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_glob.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -46,7 +46,13 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01
 #include <string.h>
 #include <errno.h>
 
+#ifdef __FreeBSD__
+#include "h_macros.h"
+#define	__gl_stat_t struct stat
+#define	_S_IFDIR S_IFDIR
+#else
 #include "../../../h_macros.h"
+#endif
 
 
 #ifdef DEBUG
@@ -132,7 +138,11 @@ gl_readdir(void *v)
 		dir.d_ino = dd->pos;
 		dir.d_type = f->dir ? DT_DIR : DT_REG;
 		DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type));
+#ifdef __FreeBSD__
+		dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */
+#else
 		dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen);
+#endif
 		return &dir;
 	}
 	return NULL;
@@ -213,6 +223,7 @@ run(const char *p, int flags, const char
 }
 
 
+#ifndef __FreeBSD__
 ATF_TC(glob_star);
 ATF_TC_HEAD(glob_star, tc)
 {
@@ -224,6 +235,7 @@ ATF_TC_BODY(glob_star, tc)
 {
 	run("a/**", GLOB_STAR, glob_star, __arraycount(glob_star));
 }
+#endif
 
 ATF_TC(glob_star_not);
 ATF_TC_HEAD(glob_star_not, tc)
@@ -260,7 +272,9 @@ ATF_TC_BODY(glob_nocheck, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
+#ifndef __FreeBSD__
 	ATF_TP_ADD_TC(tp, glob_star);
+#endif
 	ATF_TP_ADD_TC(tp, glob_star_not);
 /*
  * Remove this test for now - the GLOB_NOCHECK return value has been

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -34,7 +34,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __FreeBSD__
+#include <libutil.h>
+#else
 #include <util.h>
+#endif
 
 const struct hnopts {
 	size_t ho_len;
@@ -78,6 +82,7 @@ const struct hnopts {
 	/*
 	 * Truncated output.  Rev. 1.7 produces "1.0 K".
 	 */
+#ifndef __FreeBSD__
 	{ 6, 1000, "A", HN_AUTOSCALE, HN_DECIMAL, -1, "" },
 
 	/*
@@ -90,6 +95,7 @@ const struct hnopts {
 	/* Similar case it prints 1000 where it shouldn't */
 	{ 5, 1023488, "",
 	  HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" },
+#endif
 	{ 5, 1023999, "",
 	  HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" },
 };

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_isnan.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_isnan.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_isnan.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_isnan.c,v 1.4 2014/02/09 21:26:07 jmmv Exp $ */
+/* $NetBSD: t_isnan.c,v 1.5 2014/11/04 00:20:19 justin Exp $ */
 
 /*
  * This file is in the Public Domain.
@@ -10,7 +10,6 @@
 #include <sys/param.h>
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
 #include <math.h>
 #include <string.h>

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_nice.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_nice.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_nice.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -72,6 +72,11 @@ ATF_TC_BODY(nice_err, tc)
 {
 	int i;
 
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged "
+	   "users and sets errno == EPERM; see PR # 189821 for more details");
+#endif
+
 	/*
 	 * The call should fail with EPERM if the
 	 * supplied parameter is negative and the
@@ -93,7 +98,11 @@ ATF_TC_HEAD(nice_priority, tc)
 
 ATF_TC_BODY(nice_priority, tc)
 {
+#ifdef __FreeBSD__
+	int i, pri, pri2, nic;
+#else
 	int i, pri, nic;
+#endif
 	pid_t pid;
 	int sta;
 
@@ -106,8 +115,10 @@ ATF_TC_BODY(nice_priority, tc)
 		pri = getpriority(PRIO_PROCESS, 0);
 		ATF_REQUIRE(errno == 0);
 
+#ifdef __NetBSD__
 		if (nic != pri)
 			atf_tc_fail("nice(3) and getpriority(2) conflict");
+#endif
 
 		/*
 		 * Also verify that the nice(3) values
@@ -119,10 +130,18 @@ ATF_TC_BODY(nice_priority, tc)
 		if (pid == 0) {
 
 			errno = 0;
+#ifdef __FreeBSD__
 			pri = getpriority(PRIO_PROCESS, 0);
+#else
+			pri2 = getpriority(PRIO_PROCESS, 0);
+#endif
 			ATF_REQUIRE(errno == 0);
 
+#ifdef __FreeBSD__
+			if (pri != pri2)
+#else
 			if (nic != pri)
+#endif
 				_exit(EXIT_FAILURE);
 
 			_exit(EXIT_SUCCESS);
@@ -161,7 +180,11 @@ ATF_TC_HEAD(nice_thread, tc)
 ATF_TC_BODY(nice_thread, tc)
 {
 	pthread_t tid[5];
+#ifdef __FreeBSD__
+	int pri, rv, val;
+#else
 	int rv, val;
+#endif
 	size_t i;
 
 	/*
@@ -173,7 +196,12 @@ ATF_TC_BODY(nice_thread, tc)
 		val = nice(i);
 		ATF_REQUIRE(val != -1);
 
+#ifdef __FreeBSD__
+		pri = getpriority(PRIO_PROCESS, 0);
+		rv = pthread_create(&tid[i], NULL, threadfunc, &pri);
+#else
 		rv = pthread_create(&tid[i], NULL, threadfunc, &val);
+#endif
 		ATF_REQUIRE(rv == 0);
 
 		rv = pthread_join(tid[i], NULL);

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_raise.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_raise.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_raise.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -43,7 +43,11 @@ static int	count;
 static void	handler_err(int);
 static void	handler_ret(int);
 static void	handler_stress(int);
+#ifdef __FreeBSD__
+static int	sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2 };
+#else
 static int	sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2, SIGPWR };
+#endif
 
 static void
 handler_stress(int signo)

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -63,8 +63,20 @@ ATF_TC_BODY(setdomainname_basic, tc)
 
 		(void)memset(name, 0, sizeof(name));
 
+#ifdef __FreeBSD__
+		/* 
+		 * Sanity checks to ensure that the wrong invariant isn't being
+		 * tested for per PR # 181127
+		 */
+		ATF_REQUIRE_EQ(sizeof(domains[i]), MAXHOSTNAMELEN);
+		ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN);
+
+		ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i]) -  1) == 0);
+		ATF_REQUIRE(getdomainname(name, sizeof(name) - 1) == 0);
+#else
 		ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i])) == 0);
 		ATF_REQUIRE(getdomainname(name, sizeof(name)) == 0);
+#endif
 		ATF_REQUIRE(strcmp(domains[i], name) == 0);
 	}
 
@@ -89,6 +101,10 @@ ATF_TC_BODY(setdomainname_limit, tc)
 
 	(void)memset(name, 0, sizeof(name));
 
+#ifdef __FreeBSD__
+	ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0);
+	ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN) == -1);
+#endif
 	ATF_REQUIRE(setdomainname(name, sizeof(name)) == -1);
 }
 

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -59,12 +59,26 @@ ATF_TC_BODY(sethostname_basic, tc)
 	char name[MAXHOSTNAMELEN];
 	size_t i;
 
+	atf_tc_skip("screws up the test host's hostname on FreeBSD");
+
 	for (i = 0; i < __arraycount(hosts); i++) {
 
 		(void)memset(name, 0, sizeof(name));
 
+#ifdef __FreeBSD__
+		/* 
+		 * Sanity checks to ensure that the wrong invariant isn't being
+		 * tested for per PR # 181127
+		 */
+		ATF_REQUIRE_EQ(sizeof(hosts[i]), MAXHOSTNAMELEN);
+		ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN);
+
+		ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i]) - 1) == 0);
+		ATF_REQUIRE(gethostname(name, sizeof(name) - 1) == 0);
+#else
 		ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i])) == 0);
 		ATF_REQUIRE(gethostname(name, sizeof(name)) == 0);
+#endif
 		ATF_REQUIRE(strcmp(hosts[i], name) == 0);
 	}
 
@@ -94,6 +108,10 @@ ATF_TC_BODY(sethostname_limit, tc)
 
 ATF_TC_CLEANUP(sethostname_limit, tc)
 {
+#ifdef __FreeBSD__
+	ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN - 1 ) == 0);
+	ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN) == -1);
+#endif
 	(void)sethostname(host, sizeof(host));
 }
 

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.23 2014/02/09 21:26:07 jmmv Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.24 2014/11/04 00:20:19 justin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -27,9 +27,10 @@
  */
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
+#ifdef __NetBSD__
 #include <sys/inttypes.h>
+#endif
 #include <sys/resource.h>
 #include <sys/sysctl.h>
 #include <sys/time.h>
@@ -86,9 +87,11 @@ sig_debug(int signo, siginfo_t *info, uc
 		printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
 		    (unsigned long)ctx->uc_stack.ss_size,
 		    ctx->uc_stack.ss_flags);
+#ifdef __NetBSD__
 		for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++)
 			printf("uc_mcontext.greg[%d] 0x%lx\n", i,
 			    (long)ctx->uc_mcontext.__gregs[i]);
+#endif
 	}
 }
 
@@ -141,8 +144,10 @@ sigchild_action(int signo, siginfo_t *in
 		printf("si_uid=%d\n", info->si_uid);
 		printf("si_pid=%d\n", info->si_pid);
 		printf("si_status=%d\n", info->si_status);
+#ifdef __NetBSD__
 		printf("si_utime=%lu\n", (unsigned long int)info->si_utime);
 		printf("si_stime=%lu\n", (unsigned long int)info->si_stime);
+#endif
 	}
 	ATF_REQUIRE_EQ(info->si_code, code);
 	ATF_REQUIRE_EQ(info->si_signo, SIGCHLD);

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_sleep.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -49,6 +49,11 @@
 #define KEVNT_TIMEOUT	10300		/* measured in milli-seconds */
 #define FUZZ		(40 * MILLION)	/* scheduling fuzz accepted - 40 ms */
 
+#ifdef __FreeBSD__
+#include <sys/time.h>
+#include <inttypes.h>
+#endif
+
 /*
  * Timer notes
  *
@@ -78,7 +83,9 @@ static volatile int sig;
 int sleeptest(int (*)(struct timespec *, struct timespec *), bool, bool);
 int do_nanosleep(struct timespec *, struct timespec *);
 int do_select(struct timespec *, struct timespec *);
+#ifdef __NetBSD__
 int do_poll(struct timespec *, struct timespec *);
+#endif
 int do_sleep(struct timespec *, struct timespec *);
 int do_kevent(struct timespec *, struct timespec *);
 void sigalrm(int);
@@ -116,6 +123,7 @@ do_select(struct timespec *delay, struct
 	return ret;
 }
 
+#ifdef __NetBSD__
 int
 do_poll(struct timespec *delay, struct timespec *remain)
 {
@@ -129,6 +137,7 @@ do_poll(struct timespec *delay, struct t
 		ret = 0;
 	return ret;
 }
+#endif
 
 int
 do_sleep(struct timespec *delay, struct timespec *remain)
@@ -210,6 +219,7 @@ ATF_TC_BODY(select, tc)
 	sleeptest(do_select, true, true);
 }
 
+#ifdef __NetBSD__
 ATF_TC(poll);
 ATF_TC_HEAD(poll, tc) 
 {
@@ -223,6 +233,7 @@ ATF_TC_BODY(poll, tc)
 
 	sleeptest(do_poll, true, true);
 }
+#endif
 
 ATF_TC(sleep);
 ATF_TC_HEAD(sleep, tc) 
@@ -329,7 +340,9 @@ ATF_TP_ADD_TCS(tp) 
 {
 	ATF_TP_ADD_TC(tp, nanosleep);
 	ATF_TP_ADD_TC(tp, select);
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, poll); 
+#endif
 	ATF_TP_ADD_TC(tp, sleep);
 	ATF_TP_ADD_TC(tp, kevent);
  

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_time.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_time.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_time.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -31,6 +31,9 @@
 #include <sys/cdefs.h>
 __RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $");
 
+#ifdef __FreeBSD__
+#include <sys/time.h>
+#endif
 #include <atf-c.h>
 #include <errno.h>
 #include <inttypes.h>

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -107,6 +107,9 @@ ATF_TC_BODY(ttyname_r_err, tc)
 		ATF_REQUIRE(rv == ERANGE);
 	}
 
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936");
+#endif
 	rv = ttyname_r(-1, buf, ttymax);
 	ATF_REQUIRE(rv == EBADF);
 

Modified: stable/10/contrib/netbsd-tests/lib/libc/hash/h_hash.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/hash/h_hash.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/hash/h_hash.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -35,8 +35,13 @@
 #include <unistd.h>
 #include <string.h>
 #include <md5.h>
+#ifdef __NetBSD__
 #include <sha1.h>
+#endif
 
+#ifdef __FreeBSD__
+#include <sha.h>
+#endif
 
 int mflag, rflag, sflag, tflag;
 
@@ -102,17 +107,32 @@ regress(void)
 			MD5Final(out, &ctx);
 			outlen = 16;
 		} else {
+#ifdef __FreeBSD__
+			SHA_CTX ctx;
+
+			SHA1_Init(&ctx);
+			SHA1_Update(&ctx, buf, len);
+#else
 			SHA1_CTX ctx;
 
 			SHA1Init(&ctx);
 			SHA1Update(&ctx, buf, len);
+#endif
 			while (!last &&
 			    fgets((char *)buf, sizeof(buf), stdin) != NULL) {
 				len = strlen((char *)buf);
 				CHOMP(buf, len, last);				
+#ifdef __FreeBSD__
+				SHA1_Update(&ctx, buf, len);
+#else
 				SHA1Update(&ctx, buf, len);
+#endif
 			}
+#ifdef __FreeBSD__
+			SHA1_Final(out, &ctx);
+#else
 			SHA1Final(out, &ctx);
+#endif
 			outlen = 20;
 		}
 		hexdump(out, outlen);

Modified: stable/10/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/hash/t_sha2.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -36,9 +36,23 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09
 
 #include <atf-c.h>
 #include <sys/types.h>
+#ifdef __NetBSD__
 #include <sha2.h>
+#endif
 #include <string.h>
 
+#ifdef __FreeBSD__
+#include <openssl/sha.h>
+typedef SHA512_CTX SHA384_CTX;
+/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */
+#define SHA256_DIGEST_LENGTH		32
+#define SHA256_DIGEST_STRING_LENGTH	(SHA256_DIGEST_LENGTH * 2 + 1)
+#define SHA384_DIGEST_LENGTH		48
+#define SHA384_DIGEST_STRING_LENGTH	(SHA384_DIGEST_LENGTH * 2 + 1)
+#define SHA512_DIGEST_LENGTH		64
+#define SHA512_DIGEST_STRING_LENGTH	(SHA512_DIGEST_LENGTH * 2 + 1)
+#endif
+
 ATF_TC(t_sha256);
 ATF_TC(t_sha384);
 ATF_TC(t_sha512);

Modified: stable/10/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -144,7 +144,11 @@ ATF_TC_BODY(inet_network_err, tc)
 	H_REQUIRE(".", 0xffffffff);
 	H_REQUIRE("1.", 0xffffffff);
 	H_REQUIRE(".1", 0xffffffff);
+#if defined(__FreeBSD__) || defined(__APPLE__)
+	H_REQUIRE("0x", 0x0);
+#else
 	H_REQUIRE("0x", 0xffffffff);
+#endif
 	H_REQUIRE("", 0xffffffff);
 	H_REQUIRE(" ", 0xffffffff);
 	H_REQUIRE("bar", 0xffffffff);

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_io.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_io.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_io.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -53,9 +53,15 @@ ATF_TC_HEAD(bad_big5_wprintf, tc)
 
 ATF_TC_BODY(bad_big5_wprintf, tc)
 {
+#ifdef __FreeBSD__
+	atf_tc_skip("does not fail as expected (may be implementation "
+	    "specific issue with the test)");
+#endif
+
 	/* XXX implementation detail knowledge (wchar_t encoding) */
 	wchar_t ibuf[] = { 0xcf10, 0 };
 	setlocale(LC_CTYPE, "zh_TW.Big5");
+
 	ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0);
 	ATF_REQUIRE(ferror(stdout));
 }
@@ -68,10 +74,16 @@ ATF_TC_HEAD(bad_big5_swprintf, tc)
 
 ATF_TC_BODY(bad_big5_swprintf, tc)
 {
+#ifdef __FreeBSD__
+	atf_tc_skip("does not fail as expected (may be implementation "
+	    "specific issue with the test)");
+#endif
+
 	/* XXX implementation detail knowledge (wchar_t encoding) */
 	wchar_t ibuf[] = { 0xcf10, 0 };
 	wchar_t obuf[20];
 	setlocale(LC_CTYPE, "zh_TW.Big5");
+
 	ATF_REQUIRE_ERRNO(EILSEQ,
 			  swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0);
 }
@@ -161,6 +173,9 @@ ATF_TC_BODY(bad_big5_getwc, tc)
 
 	ATF_REQUIRE(fp != NULL);
 	setlocale(LC_CTYPE, "zh_TW.Big5");
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("does not return WEOF as expected");
+#endif
 	ATF_REQUIRE_EQ(getwc(fp), WEOF);
 	fclose(fp);
 }

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -132,7 +132,14 @@ h_ctype2(const struct test *t, bool use_
 	size_t n;
 
 	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
+#ifdef __NetBSD__
 	ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
+#else
+	if (setlocale(LC_CTYPE, t->locale) == NULL) {
+		fprintf(stderr, "Locale %s not found.\n", t->locale);
+		return;
+	}
+#endif
 
 	(void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL);
 	(void)printf("Checking string: \"%s\"\n", buf);
@@ -238,6 +245,9 @@ ATF_TC_BODY(mbrtowc_internal, tc)
 {
 	struct test *t;
 
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("ja_* locale fails");
+#endif
 	for (t = &tests[0]; t->data != NULL; ++t)
 		h_ctype2(t, false);
 }

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -150,7 +150,14 @@ ATF_TC_BODY(mbstowcs_basic, tc)
 		int i;
 
 		ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
+#ifdef __NetBSD__
 		ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
+#else
+		if (setlocale(LC_CTYPE, t->locale) == NULL) {
+			fprintf(stderr, "Locale %s not found.\n", t->locale);
+			continue;
+		}
+#endif
 
 		(void)strvis(visbuf, t->data, VIS_WHITE | VIS_OCTAL);
 		(void)printf("Checking string: \"%s\"\n", visbuf);

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -76,7 +76,14 @@ h_mbtowc(const char *locale, const char 
 	char *str;
 
 	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
+#ifdef __NetBSD__
 	ATF_REQUIRE(setlocale(LC_CTYPE, locale) != NULL);
+#else
+	if (setlocale(LC_CTYPE, locale) == NULL) {
+		fprintf(stderr, "Locale %s not found.\n", locale);
+		return;
+	}
+#endif
 
 	ATF_REQUIRE((str = setlocale(LC_ALL, NULL)) != NULL);
 	(void)printf("Using locale: %s\n", str);
@@ -130,9 +137,16 @@ ATF_TC_BODY(mbtowc, tc)
 	h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B");
 	h_mbtowc("ja_JP.SJIS", "\202", "\202\240");
 	h_mbtowc("ja_JP.eucJP", "\244", "\244\242");
+#ifndef __FreeBSD__
+	/* Moved last as it fails */
 	h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
+#endif
 	h_mbtowc("zh_TW.Big5", "\241", "\241@");
 	h_mbtowc("zh_TW.eucTW", "\241", "\241\241");
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("zh_CN.GB18030");
+	h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -66,6 +66,10 @@ __RCSID("$NetBSD: t_wcstod.c,v 1.3 2011/
 
 #include <atf-c.h>
 
+#ifdef __FreeBSD__
+#include <stdio.h>
+#endif
+
 #define	ALT_HUGE_VAL		-1
 #define	ALT_MINUS_HUGE_VAL	-2
 #define	ALT_NAN			-3
@@ -234,7 +238,7 @@ static struct test {
 { L"          -0X.",	12,	0,			0 },
 #endif
 /* XXX: FIXME */
-#if defined(__NetBSD__) || defined(__linux__)
+#if defined(__NetBSD__) || defined(__linux__) || defined(__FreeBSD__)
 { L"0X.0",		4,	0,			0 },
 { L"+0X.0",		5,	0,			0 },
 { L"-0X.0",		5,	0,			0 },

Modified: stable/10/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -109,7 +109,14 @@ h_wctomb(const struct test *t, char tc)
 	size_t sz, ret, i;
 
 	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
+#ifdef __NetBSD__
 	ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
+#else
+	if (setlocale(LC_CTYPE, t->locale) == NULL) {
+		fprintf(stderr, "Locale %s not found.\n", t->locale);
+		return;
+	}
+#endif
 
 	(void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL);
 	(void)printf("Checking sequence: \"%s\"\n", buf);

Modified: stable/10/contrib/netbsd-tests/lib/libc/net/h_dns_server.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/net/h_dns_server.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -49,7 +49,13 @@ __RCSID("$NetBSD: h_dns_server.c,v 1.4 2
 #include <sys/socket.h>
 
 #include <netinet/in.h>
+#ifdef __NetBSD__
 #include <netinet6/in6.h>
+#endif
+
+#ifdef __FreeBSD__
+#include <paths.h>
+#endif
 
 union sockaddr_either {
 	struct sockaddr s;
@@ -164,6 +170,106 @@ name2str(const void *v, char *buf, size_
 }
 #endif
 
+#ifdef __FreeBSD__
+/* XXX the daemon2_* functions should be in a library */
+
+int __daemon2_detach_pipe[2];
+
+static int
+daemon2_fork(void)
+{
+	int r;
+	int fd;
+	int i;
+
+	/*
+	 * Set up the pipe, making sure the write end does not
+	 * get allocated one of the file descriptors that will
+	 * be closed in daemon2_detach().
+	 */
+	for (i = 0; i < 3; i++) {
+	    r = pipe(__daemon2_detach_pipe);
+	    if (r < 0)
+		    return -1;
+	    if (__daemon2_detach_pipe[1] <= STDERR_FILENO &&
+		(fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+		    (void)dup2(fd, __daemon2_detach_pipe[0]);
+		    (void)dup2(fd, __daemon2_detach_pipe[1]);
+		    if (fd > STDERR_FILENO)
+			    (void)close(fd);
+		    continue;
+	    }
+	    break;
+	}
+
+	r = fork();
+	if (r < 0) {
+		return -1;
+	} else if (r == 0) {
+		/* child */
+		close(__daemon2_detach_pipe[0]);
+		return 0;
+       }
+       /* Parent */
+
+       (void) close(__daemon2_detach_pipe[1]);
+
+       for (;;) {
+	       char dummy;
+	       r = read(__daemon2_detach_pipe[0], &dummy, 1);
+	       if (r < 0) {
+		       if (errno == EINTR)
+			       continue;
+		       _exit(1);
+	       } else if (r == 0) {
+		       _exit(1);
+	       } else { /* r > 0 */
+		       _exit(0);
+	       }
+       }
+}
+
+static int
+daemon2_detach(int nochdir, int noclose)
+{
+	int r;
+	int fd;
+
+	if (setsid() == -1)
+		return -1;
+
+	if (!nochdir)
+		(void)chdir("/");
+
+	if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+		(void)dup2(fd, STDIN_FILENO);
+		(void)dup2(fd, STDOUT_FILENO);
+		(void)dup2(fd, STDERR_FILENO);
+		if (fd > STDERR_FILENO)
+			(void)close(fd);
+	}
+
+	while (1) {
+		r = write(__daemon2_detach_pipe[1], "", 1);
+		if (r < 0) {
+			if (errno == EINTR)
+				continue;
+			/* May get "broken pipe" here if parent is killed */
+			return -1;
+		} else if (r == 0) {
+			/* Should not happen */
+			return -1;
+		} else {
+			break;
+		}
+	}
+
+	(void) close(__daemon2_detach_pipe[1]);
+
+	return 0;
+}
+#endif
+
 int main(int argc, char **argv) {
 	int s, r, protocol;
 	union sockaddr_either saddr;
@@ -176,6 +282,9 @@ int main(int argc, char **argv) {
 	char buf1[1024], buf2[1024];
 #endif
 
+#ifdef __FreeBSD__
+	daemon2_fork();
+#endif
 	if (argc < 2 || ((protocol = argv[1][0]) != '4' && protocol != '6'))
 		errx(1, "usage: dns_server 4 | 6");
 	s = socket(protocol == '4' ? PF_INET : PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
@@ -212,11 +321,19 @@ int main(int argc, char **argv) {
 	f = fopen(pidfile_name, "w");
 	fprintf(f, "%d", getpid());
 	fclose(f);
+#ifdef __FreeBSD__
+#ifdef DEBUG
+	daemon2_detach(0, 1);
+#else
+	daemon2_detach(0, 0);
+#endif
+#else
 #ifdef DEBUG
 	daemon(0, 1);
 #else
 	daemon(0, 0);
 #endif
+#endif
 
 	for (;;) {
 		unsigned char buf[512];

Modified: stable/10/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c	Thu Oct  2 23:26:49 2014	(r272458)
+++ stable/10/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c	Wed Dec 31 20:13:31 2014	(r276478)
@@ -46,9 +46,18 @@ __RCSID("$NetBSD: t_ether_aton.c,v 1.1 2
 #include <string.h>
 #include <errno.h>
 
+#ifndef __NetBSD__
+#ifdef __linux__
+#include <netinet/ether.h>
+#endif
+#include <net/ethernet.h>
+#endif
+
+#ifdef __NetBSD__
 #define ETHER_ADDR_LEN 6
 
 int ether_aton_r(u_char *dest, size_t len, const char *str);
+#endif
 
 static const struct {
 	u_char res[ETHER_ADDR_LEN];
@@ -56,9 +65,11 @@ static const struct {
 	int error;
 } tests[] = {
 	{ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, "01:23:45:67:89:ab", 0 },
+#ifdef __NetBSD__
 	{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "0:1:22-3:14:05", 0 },
 	{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "000122031405", 0 },
 	{ { 0x0a, 0x0B, 0xcc, 0xdD, 0xEE, 0x0f }, "0a0BccdDEE0f", 0 },
+#endif
 #define ZERO { 0, 0, 0, 0, 0, 0 }
 	{ ZERO,	"0:1:2-3:04:05:06", ENAMETOOLONG },
 	{ ZERO,	"0:1:2-3:04:", ENOBUFS },
@@ -75,22 +86,44 @@ ATF_TC_HEAD(tc_ether_aton, tc)
  
 ATF_TC_BODY(tc_ether_aton, tc)
 {
+#ifdef __NetBSD__
 	u_char dest[ETHER_ADDR_LEN];
+#else
+	struct ether_addr dest;
+#endif
 	size_t t;
+#ifdef __NetBSD__
 	int e, r;
+#else
+	int e;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412312013.sBVKDWpR044612>