From b1e96a2f4a779e30b1c36d09d04855f10453f2e3 Mon Sep 17 00:00:00 2001 From: kenctrl Date: Thu, 14 Nov 2024 00:42:06 -0500 Subject: [PATCH] bigfile test --- Makefile | 2 +- grade-lab-fs | 3 ++- user/bigfile.c | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b7fb22d..2700622 100644 --- a/Makefile +++ b/Makefile @@ -355,7 +355,7 @@ grade: @echo $(MAKE) clean @$(MAKE) clean || \ (echo "'make clean' failed. HINT: Do you have another running instance of xv6?" && exit 1) - ./grade-lab-$(LAB) $(GRADEFLAGS) + python grade-lab-$(LAB) $(GRADEFLAGS) ## ## FOR submissions diff --git a/grade-lab-fs b/grade-lab-fs index bdb065d..b110317 100755 --- a/grade-lab-fs +++ b/grade-lab-fs @@ -9,8 +9,9 @@ r = Runner(save("xv6.out")) def test_bigfile(): r.run_qemu(shell_script([ 'bigfile' - ]), timeout=180) + ]), timeout=240) r.match('^wrote 65803 blocks$') + r.match('^reading bigfile$') r.match('^bigfile done; ok$') @test(0, "running symlinktest") diff --git a/user/bigfile.c b/user/bigfile.c index 0755700..f4ebe4c 100644 --- a/user/bigfile.c +++ b/user/bigfile.c @@ -8,7 +8,7 @@ int main() { char buf[BSIZE]; - int fd, i, blocks; + int fd, i, blocks, readblocks; fd = open("big.file", O_CREATE | O_WRONLY); if(fd < 0){ @@ -35,10 +35,12 @@ main() close(fd); fd = open("big.file", O_RDONLY); + printf("reading bigfile\n"); if(fd < 0){ printf("bigfile: cannot re-open big.file for reading\n"); exit(-1); } + readblocks = 0; for(i = 0; i < blocks; i++){ int cc = read(fd, buf, sizeof(buf)); if(cc <= 0){ @@ -50,9 +52,12 @@ main() *(int*)buf, i); exit(-1); } + readblocks++; + if (readblocks % 100 == 0) + printf("."); } - printf("bigfile done; ok\n"); + printf("\nbigfile done; ok\n"); exit(0); }