From 650402eabc63ff701b2a87a97f9299032ced7912 Mon Sep 17 00:00:00 2001 From: CSRG Date: Wed, 16 Jan 1991 21:08:25 -0800 Subject: [PATCH] BSD 4_3_Net_2 development Work on file usr/src/sys/tests/fstests/existfs Work on file usr/src/sys/tests/fstests/newtsts Work on file usr/src/sys/tests/fstests/read_8192.c Work on file usr/src/sys/tests/fstests/write_4096.c Work on file usr/src/sys/tests/fstests/readchk.c Work on file usr/src/sys/tests/fstests/rewrite_8192.c Work on file usr/src/sys/tests/fstests/write_8192.c Synthesized-from: CSRG/cd2/net.2 --- usr/src/sys/tests/fstests/existfs | 41 ++++++++++++++ usr/src/sys/tests/fstests/newtsts | 69 ++++++++++++++++++++++++ usr/src/sys/tests/fstests/read_8192.c | 21 ++++++++ usr/src/sys/tests/fstests/readchk.c | 43 +++++++++++++++ usr/src/sys/tests/fstests/rewrite_8192.c | 21 ++++++++ usr/src/sys/tests/fstests/write_4096.c | 21 ++++++++ usr/src/sys/tests/fstests/write_8192.c | 21 ++++++++ 7 files changed, 237 insertions(+) create mode 100644 usr/src/sys/tests/fstests/existfs create mode 100644 usr/src/sys/tests/fstests/newtsts create mode 100644 usr/src/sys/tests/fstests/read_8192.c create mode 100644 usr/src/sys/tests/fstests/readchk.c create mode 100644 usr/src/sys/tests/fstests/rewrite_8192.c create mode 100644 usr/src/sys/tests/fstests/write_4096.c create mode 100644 usr/src/sys/tests/fstests/write_8192.c diff --git a/usr/src/sys/tests/fstests/existfs b/usr/src/sys/tests/fstests/existfs new file mode 100644 index 0000000000..2820ee5726 --- /dev/null +++ b/usr/src/sys/tests/fstests/existfs @@ -0,0 +1,41 @@ +#!/bin/csh -f +set time=2 +if ($#argv < 1) then + echo "Usage: existfs name" + exit 1 +endif +echo "tests on $1" +/etc/dumpfs $1 | head -14 | tail -11 +mkdir $1/fststs +if (! -e bin) then + mkdir bin + cc -o bin/write_4096 write_4096.c + cc -o bin/write_8192 write_8192.c + cc -o bin/rewrite_8192 rewrite_8192.c + cc -o bin/read_8192 read_8192.c +endif +cp bin/write_4096 bin/write_8192 bin/rewrite_8192 bin/read_8192 $1/fststs +cd $1/fststs +echo "write_4096" +rm -f tst2 +./write_4096 tst2 +rm -f tst2 +./write_4096 tst2 +rm -f tst2 +./write_4096 tst2 +echo "write_8192" +rm -f tst2 +./write_8192 tst2 +rm -f tst2 +./write_8192 tst2 +rm -f tst2 +./write_8192 tst2 +echo "rewrite_8192" +./rewrite_8192 tst2 +./rewrite_8192 tst2 +./rewrite_8192 tst2 +echo "read_8192" +./read_8192 tst2 +./read_8192 tst2 +./read_8192 tst2 +echo "done" diff --git a/usr/src/sys/tests/fstests/newtsts b/usr/src/sys/tests/fstests/newtsts new file mode 100644 index 0000000000..42bebf20e5 --- /dev/null +++ b/usr/src/sys/tests/fstests/newtsts @@ -0,0 +1,69 @@ +#!/bin/csh -f +set echo +set time=2 +if ($#argv < 2) then + echo "Usage: newtsts special disk-type" + exit 1 +endif +echo "8K/1K file system on $1 type $2" +/etc/newfs $1 $2 +/etc/mount $1 /mnt +mkdir /mnt/fststs +if (! -e bin) then + mkdir bin + cc -o bin/write_4096 write_4096.c + cc -o bin/write_8192 write_8192.c + cc -o bin/rewrite_8192 rewrite_8192.c + cc -o bin/read_8192 read_8192.c +endif +echo "write_4096" +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +echo "write_8192" +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +echo "rewrite_8192" +bin/rewrite_8192 /mnt/fststs/tst2 +bin/rewrite_8192 /mnt/fststs/tst2 +bin/rewrite_8192 /mnt/fststs/tst2 +echo "read_8192" +bin/read_8192 /mnt/fststs/tst2 +bin/read_8192 /mnt/fststs/tst2 +bin/read_8192 /mnt/fststs/tst2 +umount $1 +sync +echo +echo "4K/1K file system on $1 type $2" +newfs $1 $2 +mount $1 /mnt +mkdir /mnt/fststs +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_4096 /mnt/fststs/tst2 +echo "write_8192" +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +rm -f /mnt/fststs/tst2 +bin/write_8192 /mnt/fststs/tst2 +echo "rewrite_8192" +bin/rewrite_8192 /mnt/fststs/tst2 +bin/rewrite_8192 /mnt/fststs/tst2 +bin/rewrite_8192 /mnt/fststs/tst2 +echo "read_8192" +bin/read_8192 /mnt/fststs/tst2 +bin/read_8192 /mnt/fststs/tst2 +bin/read_8192 /mnt/fststs/tst2 +echo "done" diff --git a/usr/src/sys/tests/fstests/read_8192.c b/usr/src/sys/tests/fstests/read_8192.c new file mode 100644 index 0000000000..da72028c7c --- /dev/null +++ b/usr/src/sys/tests/fstests/read_8192.c @@ -0,0 +1,21 @@ +#define BUFSIZ 8192 + +main(argc, argv) + int argc; + char *argv[]; +{ + char buf[BUFSIZ]; + int i, j; + + if (argc < 2) { + printf("Usage: read_8192 file\n"); + exit(1); + } + j = open(argv[1], 0); + if (j < 0) { + perror(argv[1]); + exit(2); + } + for (i = 0; i < 1024; i++) + read(j, buf, BUFSIZ); +} diff --git a/usr/src/sys/tests/fstests/readchk.c b/usr/src/sys/tests/fstests/readchk.c new file mode 100644 index 0000000000..1f3098666f --- /dev/null +++ b/usr/src/sys/tests/fstests/readchk.c @@ -0,0 +1,43 @@ +#define BUFSIZ 4096 + +main(argc, argv) + int argc; + char *argv[]; +{ + int buf[BUFSIZ / sizeof(int)]; + int i, j, k; + + if (argc != 2) { + printf("Usage: readchk file\n"); + exit(1); + } + j = creat(argv[1], 0666); + if (j < 0) { + perror(argv[1]); + exit(2); + } + for (i = 0; i < 2048; i++) { + for (k = 0; k < BUFSIZ / sizeof(int); k++) + buf[k] = i + k; + if (write(j, buf, BUFSIZ) != BUFSIZ) { + perror("write"); + exit(3); + } + } + close(j); + j = open(argv[1], 0); + if (j < 0) { + perror(argv[1]); + exit(4); + } + for (i = 0; i < 2048; i++) { + if (read(j, buf, BUFSIZ) != BUFSIZ) { + perror("read"); + exit(5); + } + for (k = 0; k < BUFSIZ / sizeof(int); k++) + if (buf[k] != i + k) + printf("bad data at %d\n", + tell(j) - BUFSIZ + 4 * k); + } +} diff --git a/usr/src/sys/tests/fstests/rewrite_8192.c b/usr/src/sys/tests/fstests/rewrite_8192.c new file mode 100644 index 0000000000..237dd67401 --- /dev/null +++ b/usr/src/sys/tests/fstests/rewrite_8192.c @@ -0,0 +1,21 @@ +#define BUFSIZ 8192 + +main(argc, argv) + int argc; + char *argv[]; +{ + char buf[BUFSIZ]; + int i, j; + + if (argc < 2) { + printf("Usage: rewrite_8192 file\n"); + exit(1); + } + j = open(argv[1], 2); + if (j < 0) { + perror(argv[1]); + exit(2); + } + for (i = 0; i < 1024; i++) + write(j, buf, BUFSIZ); +} diff --git a/usr/src/sys/tests/fstests/write_4096.c b/usr/src/sys/tests/fstests/write_4096.c new file mode 100644 index 0000000000..8aebf8b487 --- /dev/null +++ b/usr/src/sys/tests/fstests/write_4096.c @@ -0,0 +1,21 @@ +#define BUFSIZ 4096 + +main(argc, argv) + int argc; + char *argv[]; +{ + char buf[BUFSIZ]; + int i, j; + + if (argc < 2) { + printf("Usage: write_4096 file\n"); + exit(1); + } + j = creat(argv[1], 0666); + if (j < 0) { + perror(argv[1]); + exit(2); + } + for (i = 0; i < 2048; i++) + write(j, buf, BUFSIZ); +} diff --git a/usr/src/sys/tests/fstests/write_8192.c b/usr/src/sys/tests/fstests/write_8192.c new file mode 100644 index 0000000000..c4edd49631 --- /dev/null +++ b/usr/src/sys/tests/fstests/write_8192.c @@ -0,0 +1,21 @@ +#define BUFSIZ 8192 + +main(argc, argv) + int argc; + char *argv[]; +{ + char buf[BUFSIZ]; + int i, j; + + if (argc < 2) { + printf("Usage: write_8192 file\n"); + exit(1); + } + j = creat(argv[1], 0666); + if (j < 0) { + perror(argv[1]); + exit(2); + } + for (i = 0; i < 1024; i++) + write(j, buf, BUFSIZ); +} -- 2.20.1