summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/fs
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-02-10 07:13:16 +0000
committerngie <ngie@FreeBSD.org>2017-02-10 07:13:16 +0000
commitb39322d52d2dd66d37af0ffcbfb48d13896804ea (patch)
tree50240f0582121388b79a17f7a28cf9e4294ab21e /contrib/netbsd-tests/fs
parentb3a273f11b9829eca57412e90421eee4b4d2a018 (diff)
downloadFreeBSD-src-b39322d52d2dd66d37af0ffcbfb48d13896804ea.zip
FreeBSD-src-b39322d52d2dd66d37af0ffcbfb48d13896804ea.tar.gz
MFC r311925,r311968,r311969,r312008:
r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312008: Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386
Diffstat (limited to 'contrib/netbsd-tests/fs')
-rwxr-xr-xcontrib/netbsd-tests/fs/ffs/ffs_common.sh4
-rw-r--r--contrib/netbsd-tests/fs/fifofs/t_fifo.c3
-rwxr-xr-xcontrib/netbsd-tests/fs/psshfs/t_psshfs.sh23
-rw-r--r--contrib/netbsd-tests/fs/puffs/t_basic.c6
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_vnops.c100
5 files changed, 86 insertions, 50 deletions
diff --git a/contrib/netbsd-tests/fs/ffs/ffs_common.sh b/contrib/netbsd-tests/fs/ffs/ffs_common.sh
index eaf7142..ee94a15 100755
--- a/contrib/netbsd-tests/fs/ffs/ffs_common.sh
+++ b/contrib/netbsd-tests/fs/ffs/ffs_common.sh
@@ -1,4 +1,4 @@
-# $NetBSD: ffs_common.sh,v 1.2 2013/07/29 13:15:24 skrll Exp $
+# $NetBSD: ffs_common.sh,v 1.3 2016/10/08 13:23:53 gson Exp $
create_ffs()
{
@@ -45,7 +45,7 @@ test_case()
eval "${name}_head() { \
atf_set "descr" "${descr}"
- atf_set "timeout" "60"
+ atf_set "timeout" "120"
}"
eval "${name}_body() { \
RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \
diff --git a/contrib/netbsd-tests/fs/fifofs/t_fifo.c b/contrib/netbsd-tests/fs/fifofs/t_fifo.c
index c4a2060..4b37bb8 100644
--- a/contrib/netbsd-tests/fs/fifofs/t_fifo.c
+++ b/contrib/netbsd-tests/fs/fifofs/t_fifo.c
@@ -1,9 +1,10 @@
/* Test case written by Bharat Joshi */
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fifo.c,v 1.1 2011/12/21 00:17:07 christos Exp $");
+__RCSID("$NetBSD: t_fifo.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh b/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh
index 241d46d..4d8fede 100755
--- a/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh
+++ b/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_psshfs.sh,v 1.7 2013/03/16 07:54:04 jmmv Exp $
+# $NetBSD: t_psshfs.sh,v 1.8 2016/09/05 08:53:57 christos Exp $
#
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -262,6 +262,26 @@ setattr_cache_cleanup() {
stop_ssh
}
+atf_test_case read_empty_file cleanup
+read_empty_file_head() {
+ atf_set "descr" "Checks whether an empty file can be read"
+ # This test is supposed to make sure psshfs does not hang
+ # when reading from an empty file, hence the timeout.
+ atf_set "timeout" 8
+}
+read_empty_file_body() {
+ require_puffs
+ start_ssh
+ atf_check mkdir root mnt
+ atf_check -x ': > root/empty'
+ mount_psshfs root mnt
+ atf_check cat mnt/empty
+}
+read_empty_file_cleanup() {
+ umount mnt
+ stop_ssh
+}
+
# -------------------------------------------------------------------------
# Initialization.
# -------------------------------------------------------------------------
@@ -271,4 +291,5 @@ atf_init_test_cases() {
atf_add_test_case pwd
atf_add_test_case ls
#atf_add_test_case setattr_cache
+ atf_add_test_case read_empty_file
}
diff --git a/contrib/netbsd-tests/fs/puffs/t_basic.c b/contrib/netbsd-tests/fs/puffs/t_basic.c
index ce5e4ea..735108d 100644
--- a/contrib/netbsd-tests/fs/puffs/t_basic.c
+++ b/contrib/netbsd-tests/fs/puffs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.12 2013/10/19 17:45:00 christos Exp $ */
+/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -286,7 +286,7 @@ ATF_TC_BODY(inactive_reclaim, tc)
rump_sys_close(fd);
syncbar(FSTEST_MNTNAME);
- ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], 1);
+ ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > 0);
ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1);
FSTEST_EXIT();
@@ -383,7 +383,7 @@ ATF_TC_BODY(unlink_accessible, tc)
syncbar(FSTEST_MNTNAME);
ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1);
- ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], ianow+1);
+ ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > ianow);
ATF_REQUIRE_STREQ(buf, MAGICSTR);
diff --git a/contrib/netbsd-tests/fs/vfs/t_vnops.c b/contrib/netbsd-tests/fs/vfs/t_vnops.c
index 08203dd..978fadb 100644
--- a/contrib/netbsd-tests/fs/vfs/t_vnops.c
+++ b/contrib/netbsd-tests/fs/vfs/t_vnops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vnops.c,v 1.55 2016/01/28 10:10:09 martin Exp $ */
+/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
+#include <sys/time.h>
#include <assert.h>
#include <atf-c.h>
@@ -55,10 +56,10 @@
atf_tc_skip("symlinks not supported by file system")
static char *
-md(char *buf, const char *base, const char *tail)
+md(char *buf, size_t buflen, const char *base, const char *tail)
{
- sprintf(buf, "%s/%s", base, tail);
+ snprintf(buf, buflen, "%s/%s", base, tail);
return buf;
}
@@ -69,11 +70,11 @@ lookup_simple(const atf_tc_t *tc, const char *mountpath)
struct stat sb1, sb2;
strcpy(final, mountpath);
- sprintf(pb, "%s/../%s", mountpath, basename(final));
+ snprintf(pb, sizeof(pb), "%s/../%s", mountpath, basename(final));
if (rump_sys_stat(pb, &sb1) == -1)
atf_tc_fail_errno("stat 1");
- sprintf(pb, "%s/./../%s", mountpath, basename(final));
+ snprintf(pb, sizeof(pb), "%s/./../%s", mountpath, basename(final));
if (rump_sys_stat(pb, &sb2) == -1)
atf_tc_fail_errno("stat 2");
@@ -85,22 +86,38 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath)
{
char pb[MAXPATHLEN];
struct stat sb1, sb2;
+ struct timespec atplus1, onesec;
USES_DIRS;
- if (FSTYPE_UDF(tc))
- atf_tc_expect_fail("PR kern/49033");
-
- sprintf(pb, "%s/dir", mountpath);
+ snprintf(pb, sizeof(pb), "%s/dir", mountpath);
if (rump_sys_mkdir(pb, 0777) == -1)
atf_tc_fail_errno("mkdir");
if (rump_sys_stat(pb, &sb1) == -1)
atf_tc_fail_errno("stat 1");
- sprintf(pb, "%s/./dir/../././dir/.", mountpath);
+ snprintf(pb, sizeof(pb), "%s/./dir/../././dir/.", mountpath);
if (rump_sys_stat(pb, &sb2) == -1)
atf_tc_fail_errno("stat 2");
+ /*
+ * The lookup is permitted to modify the access time of
+ * any directories searched - such a directory is the
+ * subject of this test. Any difference should cause
+ * the 2nd lookup atime tp be >= the first, if it is ==, all is
+ * OK (atime is not required to be modified by the search, or
+ * both references may happen within the came clock tick), if the
+ * 2nd lookup atime is > the first, but not "too much" greater,
+ * just set it back, so the memcmp just below succeeds
+ * (assuming all else is OK).
+ */
+ onesec.tv_sec = 1;
+ onesec.tv_nsec = 0;
+ timespecadd(&sb1.st_atimespec, &onesec, &atplus1);
+ if (timespeccmp(&sb2.st_atimespec, &sb1.st_atimespec, >) &&
+ timespeccmp(&sb2.st_atimespec, &atplus1, <))
+ sb2.st_atimespec = sb1.st_atimespec;
+
if (memcmp(&sb1, &sb2, sizeof(sb1)) != 0) {
printf("what\tsb1\t\tsb2\n");
@@ -133,9 +150,6 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath)
atf_tc_fail("stat results differ, see ouput for more details");
}
- if (FSTYPE_UDF(tc))
- atf_tc_fail("random failure of PR kern/49033 "
- "did not happen this time");
}
static void
@@ -147,7 +161,7 @@ dir_simple(const atf_tc_t *tc, const char *mountpath)
USES_DIRS;
/* check we can create directories */
- sprintf(pb, "%s/dir", mountpath);
+ snprintf(pb, sizeof(pb), "%s/dir", mountpath);
if (rump_sys_mkdir(pb, 0777) == -1)
atf_tc_fail_errno("mkdir");
if (rump_sys_stat(pb, &sb) == -1)
@@ -169,11 +183,11 @@ dir_notempty(const atf_tc_t *tc, const char *mountpath)
USES_DIRS;
/* check we can create directories */
- sprintf(pb, "%s/dir", mountpath);
+ snprintf(pb, sizeof(pb), "%s/dir", mountpath);
if (rump_sys_mkdir(pb, 0777) == -1)
atf_tc_fail_errno("mkdir");
- sprintf(pb2, "%s/dir/file", mountpath);
+ snprintf(pb2, sizeof(pb2), "%s/dir/file", mountpath);
fd = rump_sys_open(pb2, O_RDWR | O_CREAT, 0777);
if (fd == -1)
atf_tc_fail_errno("create file");
@@ -205,9 +219,9 @@ dir_rmdirdotdot(const atf_tc_t *tc, const char *mp)
RL(rump_sys_mkdir("subtest", 0777));
RL(rump_sys_chdir("subtest"));
- md(pb, mp, "test/subtest");
+ md(pb, sizeof(pb), mp, "test/subtest");
RL(rump_sys_rmdir(pb));
- md(pb, mp, "test");
+ md(pb, sizeof(pb), mp, "test");
RL(rump_sys_rmdir(pb));
if (FSTYPE_NFS(tc))
@@ -225,7 +239,7 @@ checkfile(const char *path, struct stat *refp)
struct stat sb;
static int n = 1;
- md(buf, path, "file");
+ md(buf, sizeof(buf), path, "file");
if (rump_sys_stat(buf, &sb) == -1)
atf_tc_fail_errno("cannot stat file %d (%s)", n, buf);
if (memcmp(&sb, refp, sizeof(sb)) != 0)
@@ -244,18 +258,18 @@ rename_dir(const atf_tc_t *tc, const char *mp)
USES_DIRS;
- md(pb1, mp, "dir1");
+ md(pb1, sizeof(pb1), mp, "dir1");
if (rump_sys_mkdir(pb1, 0777) == -1)
atf_tc_fail_errno("mkdir 1");
- md(pb2, mp, "dir2");
+ md(pb2, sizeof(pb2), mp, "dir2");
if (rump_sys_mkdir(pb2, 0777) == -1)
atf_tc_fail_errno("mkdir 2");
- md(pb2, mp, "dir2/subdir");
+ md(pb2, sizeof(pb2), mp, "dir2/subdir");
if (rump_sys_mkdir(pb2, 0777) == -1)
atf_tc_fail_errno("mkdir 3");
- md(pb3, mp, "dir1/file");
+ md(pb3, sizeof(pb3), mp, "dir1/file");
if (rump_sys_mknod(pb3, S_IFREG | 0777, -1) == -1)
atf_tc_fail_errno("create file");
if (rump_sys_stat(pb3, &ref) == -1)
@@ -266,13 +280,13 @@ rename_dir(const atf_tc_t *tc, const char *mp)
*/
/* rename within directory */
- md(pb3, mp, "dir3");
+ md(pb3, sizeof(pb3), mp, "dir3");
if (rump_sys_rename(pb1, pb3) == -1)
atf_tc_fail_errno("rename 1");
checkfile(pb3, &ref);
/* rename directory onto itself (two ways, should fail) */
- md(pb1, mp, "dir3/.");
+ md(pb1, sizeof(pb1), mp, "dir3/.");
if (rump_sys_rename(pb1, pb3) != -1 || errno != EINVAL)
atf_tc_fail_errno("rename 2");
if (rump_sys_rename(pb3, pb1) != -1 || errno != EISDIR)
@@ -281,13 +295,13 @@ rename_dir(const atf_tc_t *tc, const char *mp)
checkfile(pb3, &ref);
/* rename father of directory into directory */
- md(pb1, mp, "dir2/dir");
- md(pb2, mp, "dir2");
+ md(pb1, sizeof(pb1), mp, "dir2/dir");
+ md(pb2, sizeof(pb2), mp, "dir2");
if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL)
atf_tc_fail_errno("rename 4");
/* same for grandfather */
- md(pb1, mp, "dir2/subdir/dir2");
+ md(pb1, sizeof(pb1), mp, "dir2/subdir/dir2");
if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL)
atf_tc_fail("rename 5");
@@ -298,29 +312,29 @@ rename_dir(const atf_tc_t *tc, const char *mp)
atf_tc_fail("rename 6");
/* cross-directory rename */
- md(pb1, mp, "dir3");
- md(pb2, mp, "dir2/somedir");
+ md(pb1, sizeof(pb1), mp, "dir3");
+ md(pb2, sizeof(pb2), mp, "dir2/somedir");
if (rump_sys_rename(pb1, pb2) == -1)
atf_tc_fail_errno("rename 7");
checkfile(pb2, &ref);
/* move to parent directory */
- md(pb1, mp, "dir2/somedir/../../dir3");
+ md(pb1, sizeof(pb1), mp, "dir2/somedir/../../dir3");
if (rump_sys_rename(pb2, pb1) == -1)
atf_tc_fail_errno("rename 8");
- md(pb1, mp, "dir2/../dir3");
+ md(pb1, sizeof(pb1), mp, "dir2/../dir3");
checkfile(pb1, &ref);
/* atomic cross-directory rename */
- md(pb3, mp, "dir2/subdir");
+ md(pb3, sizeof(pb3), mp, "dir2/subdir");
if (rump_sys_rename(pb1, pb3) == -1)
atf_tc_fail_errno("rename 9");
checkfile(pb3, &ref);
/* rename directory over an empty directory */
- md(pb1, mp, "parent");
- md(pb2, mp, "parent/dir1");
- md(pb3, mp, "parent/dir2");
+ md(pb1, sizeof(pb1), mp, "parent");
+ md(pb2, sizeof(pb2), mp, "parent/dir1");
+ md(pb3, sizeof(pb3), mp, "parent/dir2");
RL(rump_sys_mkdir(pb1, 0777));
RL(rump_sys_mkdir(pb2, 0777));
RL(rump_sys_mkdir(pb3, 0777));
@@ -467,15 +481,15 @@ create_many(const atf_tc_t *tc, const char *mp)
for (i = 0; i < nfiles; i++) {
int fd;
- sprintf(buf, TESTFN "%d", i);
+ snprintf(buf, sizeof(buf), TESTFN "%d", i);
RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666));
RL(rump_sys_close(fd));
}
/* wipe them out */
for (i = 0; i < nfiles; i++) {
- sprintf(buf, TESTFN "%d", i);
- RL(rump_sys_unlink(buf));
+ snprintf(buf, sizeof(buf), TESTFN "%d", i);
+ RLF(rump_sys_unlink(buf), "%s", buf);
}
#undef TESTFN
@@ -499,12 +513,12 @@ create_nonalphanum(const atf_tc_t *tc, const char *mp)
for (i = 0; i < 256; i++) {
int fd;
- sprintf(buf, "%c", i);
+ snprintf(buf, sizeof(buf), "%c", i);
fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666);
if (fd == -1)
continue;
- RL(rump_sys_close(fd));
- RL(rump_sys_unlink(buf));
+ RLF(rump_sys_close(fd), "%d", fd);
+ RLF(rump_sys_unlink(buf), "%s", buf);
}
printf("\n");
@@ -632,7 +646,7 @@ symlink_len(const atf_tc_t *tc, const char *mp, size_t len)
USES_SYMLINKS;
- RL(rump_sys_chdir(mp));
+ RLF(rump_sys_chdir(mp), "%s", mp);
buf = malloc(len + 1);
ATF_REQUIRE(buf);
OpenPOWER on IntegriCloud