add_custom_target(libc_unistd_unittests)
add_subdirectory(testdata)
add_libc_unittest(
access_test
SUITE
libc_unistd_unittests
SRCS
access_test.cpp
DEPENDS
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.access
libc.src.unistd.close
libc.src.unistd.unlink
)
add_libc_unittest(
chdir_test
SUITE
libc_unistd_unittests
SRCS
chdir_test.cpp
DEPENDS
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.chdir
libc.src.unistd.close
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
dup_test
SUITE
libc_unistd_unittests
SRCS
dup_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.dup
libc.src.unistd.read
libc.src.unistd.unlink
libc.src.unistd.write
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
dup2_test
SUITE
libc_unistd_unittests
SRCS
dup2_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.dup2
libc.src.unistd.read
libc.src.unistd.unlink
libc.src.unistd.write
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
dup3_test
SUITE
libc_unistd_unittests
SRCS
dup3_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.dup3
libc.src.unistd.read
libc.src.unistd.unlink
libc.src.unistd.write
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
fchdir_test
SUITE
libc_unistd_unittests
SRCS
fchdir_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.fchdir
libc.src.unistd.close
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
ftruncate_test
SUITE
libc_unistd_unittests
SRCS
ftruncate_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.read
libc.src.unistd.ftruncate
libc.src.unistd.unlink
libc.src.unistd.write
libc.src.__support.CPP.string_view
)
add_libc_unittest(
pread_pwrite_test
SUITE
libc_unistd_unittests
SRCS
pread_pwrite_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.fsync
libc.src.unistd.pread
libc.src.unistd.pwrite
libc.src.unistd.unlink
libc.src.unistd.write
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
read_write_test
SUITE
libc_unistd_unittests
SRCS
read_write_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.fsync
libc.src.unistd.read
libc.src.unistd.write
libc.src.stdio.remove
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
link_test
SUITE
libc_unistd_unittests
SRCS
link_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.link
libc.src.unistd.unlink
)
add_libc_unittest(
linkat_test
SUITE
libc_unistd_unittests
SRCS
linkat_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.linkat
libc.src.unistd.unlink
)
add_libc_unittest(
lseek_test
SUITE
libc_unistd_unittests
SRCS
lseek_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.lseek
libc.src.unistd.read
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
pipe_test
SUITE
libc_unistd_unittests
SRCS
pipe_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.unistd.close
libc.src.unistd.pipe
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
rmdir_test
SUITE
libc_unistd_unittests
SRCS
rmdir_test.cpp
DEPENDS
libc.include.errno
libc.include.fcntl
libc.src.errno.errno
libc.src.sys.stat.mkdir
libc.src.unistd.rmdir
)
add_libc_unittest(
swab_test
SUITE
libc_unistd_unittests
SRCS
swab_test.cpp
DEPENDS
libc.src.unistd.swab
)
add_libc_unittest(
readlink_test
SUITE
libc_unistd_unittests
SRCS
readlink_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.unistd.readlink
libc.src.string.string_utils
libc.src.unistd.symlink
libc.src.unistd.unlink
libc.src.__support.CPP.string_view
)
add_libc_unittest(
readlinkat_test
SUITE
libc_unistd_unittests
SRCS
readlinkat_test.cpp
DEPENDS
libc.include.errno
libc.include.fcntl
libc.include.unistd
libc.src.errno.errno
libc.src.unistd.readlinkat
libc.src.string.string_utils
libc.src.unistd.symlink
libc.src.unistd.unlink
libc.src.__support.CPP.string_view
)
add_libc_unittest(
symlink_test
SUITE
libc_unistd_unittests
SRCS
symlink_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.symlink
libc.src.unistd.unlink
)
add_libc_unittest(
symlinkat_test
SUITE
libc_unistd_unittests
SRCS
symlinkat_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.symlinkat
libc.src.unistd.unlink
)
add_libc_unittest(
truncate_test
SUITE
libc_unistd_unittests
SRCS
truncate_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.read
libc.src.unistd.truncate
libc.src.unistd.unlink
libc.src.unistd.write
libc.src.__support.CPP.string_view
)
add_libc_unittest(
unlink_test
SUITE
libc_unistd_unittests
SRCS
unlink_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.unistd.close
libc.src.unistd.unlink
)
add_libc_unittest(
unlinkat_test
SUITE
libc_unistd_unittests
SRCS
unlinkat_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.src.errno.errno
libc.src.fcntl.open
libc.src.fcntl.openat
libc.src.unistd.close
libc.src.unistd.unlinkat
)
add_libc_unittest(
getpid_test
SUITE
libc_unistd_unittests
SRCS
getpid_test.cpp
DEPENDS
libc.src.unistd.getpid
)
add_libc_unittest(
getppid_test
SUITE
libc_unistd_unittests
SRCS
getppid_test.cpp
DEPENDS
libc.src.unistd.getppid
)
add_libc_unittest(
getuid_test
SUITE
libc_unistd_unittests
SRCS
getuid_test.cpp
DEPENDS
libc.src.unistd.getuid
)
add_libc_unittest(
isatty_test
SUITE
libc_unistd_unittests
SRCS
isatty_test.cpp
DEPENDS
libc.src.unistd.isatty
libc.src.fcntl.open
libc.src.unistd.close
libc.src.errno.errno
)
add_libc_unittest(
geteuid_test
SUITE
libc_unistd_unittests
SRCS
geteuid_test.cpp
DEPENDS
libc.src.unistd.geteuid
)
add_libc_unittest(
syscall_test
SUITE
libc_unistd_unittests
SRCS
syscall_test.cpp
DEPENDS
libc.include.errno
libc.include.unistd
libc.include.fcntl
libc.include.sys_syscall
libc.src.unistd.__llvm_libc_syscall
libc.test.UnitTest.ErrnoSetterMatcher
)
add_libc_unittest(
sysconf_test
SUITE
libc_unistd_unittests
SRCS
sysconf_test.cpp
DEPENDS
libc.include.unistd
libc.src.unistd.sysconf
)
add_libc_unittest(
fpathconf_test
SUITE
libc_unistd_unittests
SRCS
fpathconf_test.cpp
DEPENDS
libc.hdr.limits_macros
libc.hdr.unistd_macros
libc.hdr.sys_stat_macros
libc.src.unistd.fpathconf
libc.src.fcntl.open
libc.src.unistd.close
)
add_libc_unittest(
pathconf_test
SUITE
libc_unistd_unittests
SRCS
pathconf_test.cpp
DEPENDS
libc.hdr.limits_macros
libc.hdr.unistd_macros
libc.hdr.sys_stat_macros
libc.src.unistd.pathconf
libc.src.fcntl.open
libc.src.unistd.close
)
add_libc_test(
getopt_test
HERMETIC_TEST_ONLY # Uses libc's own stderr
SUITE
libc_unistd_unittests
SRCS
getopt_test.cpp
DEPENDS
libc.src.unistd.getopt
libc.src.__support.CPP.array
libc.src.stdio.fopencookie
libc.src.stdio.fflush
)
if(LLVM_LIBC_FULL_BUILD)
add_libc_test(
_exit_test
UNIT_TEST_ONLY
SUITE
libc_unistd_unittests
SRCS
_exit_test.cpp
DEPENDS
libc.include.unistd
libc.src.unistd._exit
)
endif()