bigfile test

This commit is contained in:
kenctrl 2024-11-14 00:42:06 -05:00
parent c51da24c38
commit b1e96a2f4a
3 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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")

View File

@ -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);
}