Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/fs/vfs Add a small testcase that shrink a file using 2...
details: https://anonhg.NetBSD.org/src/rev/f2983ee1e96b
branches: trunk
changeset: 762760:f2983ee1e96b
user: njoly <njoly%NetBSD.org@localhost>
date: Sun Feb 27 15:16:31 2011 +0000
description:
Add a small testcase that shrink a file using 2 consecutive ftruncate
calls.
diffstat:
tests/fs/vfs/t_io.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (45 lines):
diff -r 2a977d11b624 -r f2983ee1e96b tests/fs/vfs/t_io.c
--- a/tests/fs/vfs/t_io.c Sun Feb 27 14:01:42 2011 +0000
+++ b/tests/fs/vfs/t_io.c Sun Feb 27 15:16:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_io.c,v 1.7 2011/02/02 14:42:15 pooka Exp $ */
+/* $NetBSD: t_io.c,v 1.8 2011/02/27 15:16:31 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -158,6 +158,19 @@
overwritebody(tc, 1<<16, true);
}
+static void
+shrinkfile(const atf_tc_t *tc, const char *mp)
+{
+ int fd;
+
+ FSTEST_ENTER();
+ RL(fd = rump_sys_open("file", O_RDWR|O_CREAT|O_TRUNC, 0666));
+ RL(rump_sys_ftruncate(fd, 2));
+ RL(rump_sys_ftruncate(fd, 1));
+ rump_sys_close(fd);
+ FSTEST_EXIT();
+}
+
ATF_TC_FSAPPLY(holywrite, "create a sparse file and fill hole");
ATF_TC_FSAPPLY(extendfile, "check that extending a file works");
ATF_TC_FSAPPLY(extendfile_append, "check that extending a file works "
@@ -165,6 +178,7 @@
ATF_TC_FSAPPLY(overwrite512, "write a 512 byte file twice");
ATF_TC_FSAPPLY(overwrite64k, "write a 64k byte file twice");
ATF_TC_FSAPPLY(overwrite_trunc, "write 64k + truncate + rewrite");
+ATF_TC_FSAPPLY(shrinkfile, "shrink file");
ATF_TP_ADD_TCS(tp)
{
@@ -175,6 +189,7 @@
ATF_TP_FSAPPLY(overwrite512);
ATF_TP_FSAPPLY(overwrite64k);
ATF_TP_FSAPPLY(overwrite_trunc);
+ ATF_TP_FSAPPLY(shrinkfile);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index