Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/sys Remove regress lseek tests, obsoleted by ATF
details: https://anonhg.NetBSD.org/src/rev/13c1517f5656
branches: trunk
changeset: 353605:13c1517f5656
user: kamil <kamil%NetBSD.org@localhost>
date: Sun May 14 04:26:40 2017 +0000
description:
Remove regress lseek tests, obsoleted by ATF
Many tests verify lseek through rumpkernels:
- tests/dev/cgd/t_cgd_3des
- tests/dev/cgd/t_cgd_aes
- tests/dev/cgd/t_cgd_blowfish
- tests/rump/rumpvfs/t_basic
- tests/rump/rumpvfs/t_etfs
There are traditional lseek(2) tests too:
- tests/kernel/kqueue/read/t_file
- tests/kernel/kqueue/read/t_file2
- tests/kernel/t_lockf
- tests/lib/libc/stdio/t_fflush
- tests/lib/libc/stdio/t_fopen
- tests/lib/libc/sys/t_msync
- etc
diffstat:
regress/sys/Makefile | 4 +-
regress/sys/fs/lseek/Makefile | 19 ------
regress/sys/fs/lseek/lseek.c | 118 ------------------------------------------
3 files changed, 2 insertions(+), 139 deletions(-)
diffs (159 lines):
diff -r f56f288c225f -r 13c1517f5656 regress/sys/Makefile
--- a/regress/sys/Makefile Sun May 14 04:21:52 2017 +0000
+++ b/regress/sys/Makefile Sun May 14 04:26:40 2017 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.15 2017/05/14 04:17:25 kamil Exp $
+# $NetBSD: Makefile,v 1.16 2017/05/14 04:26:40 kamil Exp $
.include <bsd.own.mk>
-SUBDIR= kern fs
+SUBDIR= kern
.if exists(arch/${MACHINE}/Makefile)
SUBDIR+= arch/${MACHINE}
.endif
diff -r f56f288c225f -r 13c1517f5656 regress/sys/fs/lseek/Makefile
--- a/regress/sys/fs/lseek/Makefile Sun May 14 04:21:52 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-# $NetBSD: Makefile,v 1.3 2006/09/21 17:33:08 reinoud Exp $
-
-NOMAN= # defined
-
-PROG= lseek
-
-clean:
- rm -f test-file
-
-regress: ${PROG}
- @set -e; \
- dd if=/dev/zero of=test-file bs=2k count=1000 > /dev/null 2>&1; \
- if ./${PROG} test-file > /dev/null; then \
- echo PASSED; exit 0; \
- else \
- echo FAILED; exit 1; \
- fi
-
-.include <bsd.prog.mk>
diff -r f56f288c225f -r 13c1517f5656 regress/sys/fs/lseek/lseek.c
--- a/regress/sys/fs/lseek/lseek.c Sun May 14 04:21:52 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <err.h>
-#include <sys/stat.h>
-#include <sys/unistd.h>
-#include <sys/inttypes.h>
-
-int main(int argc, char **argv)
-{
- int fd;
- off_t cur;
- struct stat st;
- int error;
-
- if (argc != 2)
- errx(EXIT_FAILURE, "seektest filename");
- fd = open(argv[1], 0, O_RDONLY);
- if (fd <= 0)
- err(EXIT_FAILURE, "can't open `%s'", argv[1]);
-
- printf("Statting file\n");
- error = fstat(fd, &st);
- if (error)
- err(EXIT_FAILURE, "can't stat file");
- printf("fstat() returns %"PRIi64" as size\n", st.st_size);
-
- error = stat(argv[1], &st);
- if (error)
- err(EXIT_FAILURE, "can't stat file");
- printf("stat() returns %"PRIi64" as size\n", st.st_size);
-
- error = lstat(argv[1], &st);
- if (error)
- err(EXIT_FAILURE, "can't lstat file");
- printf("lstat() returns %"PRIi64" as size\n", st.st_size);
-
- printf("\nTesting normal seeking\n");
- printf("get initial position\n");
- cur = lseek(fd, 0, SEEK_CUR);
- if (cur != 0)
- err(EXIT_FAILURE, "seek initial position wrong");
- printf("seek start %"PRIi64"\n", cur);
-
- printf("seeking end (filesize = %"PRIi64")\n", st.st_size);
- cur = lseek(fd, 0, SEEK_END);
- if (cur != st.st_size)
- err(EXIT_FAILURE, "seek to the end went wrong");
- printf("seek now %"PRIi64"\n", cur);
-
- printf("seeking backwards filesize - 150 steps\n");
- cur = lseek(fd, -(st.st_size - 150), SEEK_CUR);
- if (cur != 150)
- err(EXIT_FAILURE, "relative seek from end to 150 failed");
- printf("seek now %"PRIi64"\n", cur);
-
- printf("seek set 1000\n");
- cur = lseek(fd, 1000, SEEK_SET);
- if (cur != 1000)
- err(EXIT_FAILURE, "seek 1000 went wrong");
- printf("seek now %"PRIi64"\n", cur);
-
-#if defined SEEK_DATA
- printf("\nOne piece non sparse file checking:\n");
- printf("seeking for sparse file data offset\n");
- cur = lseek(fd, 0, SEEK_DATA);
- if (cur != 0)
- err(EXIT_FAILURE, "Not getting start of data segment at 0");
-
- printf("if seek_data returns a 2nd part on a non-sparse file\n");
- cur = lseek(fd, st.st_size, SEEK_DATA);
- if (cur != -1)
- errx(EXIT_FAILURE, "Seek data gave 2nd part at end of file");
- if (errno != ENXIO)
- errx(EXIT_FAILURE, "Seek data on the end of file didn't"
- " raise ENXIO (%d)", errno);
- printf( "if seek_data in the file's last block of a non-sparse file "
- "returns the current position\n");
- cur = lseek(fd, st.st_size-50, SEEK_DATA);
- if (cur != st.st_size - 50) {
- errx(EXIT_FAILURE, "Seek data didn't give passed seek position "
- "back %" PRIi64 " should be %" PRIi64, cur, st.st_size-50);
- return EXIT_FAILURE;
- }
-
- printf("if seek_data in the middle of the of a non-sparse file "
- "returns the current position\n");
- cur = lseek(fd, st.st_size - 100 * 1024, SEEK_DATA);
- if (cur != st.st_size - 100 * 1024)
- errx(EXIT_FAILURE, "Seek data didn't give passed seek "
- "position back %" PRIi64 " should be %" PRIi64, cur,
- st.st_size - 100 * 1024);
-
- printf("seeking for hole\n");
- cur = lseek(fd, 0, SEEK_HOLE);
- if (cur != st.st_size)
- errx(EXIT_FAILURE, "Seek hole didn't return end of file");
-
- printf("seeking if the end of the file is a hole\n");
- cur = lseek(fd, st.st_size, SEEK_HOLE);
- if (cur != st.st_size)
- errx(EXIT_FAILURE, "At the end of the file, no virtual hole "
- "is returned");
-
- printf("seeking if a 2nd hole is returned outside the file range\n");
- cur = lseek(fd, st.st_size + 1, SEEK_HOLE);
- if (cur != -1)
- errx(EXIT_FAILURE, "Past the end of file, seek hole returned "
- "another hole instead of raising an error");
- if (errno != ENXIO)
- errx(EXIT_FAILURE, "Seek hole past the end of file didn't "
- "raise ENXIO (%d)", errno);
-#endif
-
- return EXIT_SUCCESS;
-}
-
Home |
Main Index |
Thread Index |
Old Index