Permalink
Browse files

Fix grade script to enable the NIC and to stop after each test is done

instead of timing out.  Remove a few old tests that only test provided
code.

Fix buggy dup implementation.
  • Loading branch information...
1 parent 6aadf09 commit 59ac8b704f3be1ba269d22aab8cfe7aabbc883e8 @aclements aclements committed Nov 24, 2009
Showing with 37 additions and 45 deletions.
  1. +1 −1 conf/lab.mk
  2. +3 −2 grade-functions.sh
  3. +22 −40 grade-lab7.sh
  4. +2 −2 lib/fd.c
  5. +3 −0 user/testfdsharing.c
  6. +3 −0 user/testpteshare.c
  7. +3 −0 user/testshell.c
View
@@ -1,2 +1,2 @@
LAB=7
-PACKAGEDATE=Sun Nov 22 17:38:17 EST 2009
+PACKAGEDATE=Tue Nov 24 17:32:15 EST 2009
View
@@ -16,6 +16,7 @@ pts=5
timeout=30
preservefs=n
qemu=`$make -s --no-print-directory which-qemu`
+brkfn=readline
echo_n () {
# suns can't echo -n, and Mac OS X can't echo "x\c"
@@ -26,7 +27,7 @@ echo_n () {
run () {
# Find the address of the kernel readline function,
# which the kernel monitor uses to read commands interactively.
- brkaddr=`grep 'readline$' obj/kern/kernel.sym | sed -e's/ .*$//g'`
+ brkaddr=`grep " $brkfn\$" obj/kern/kernel.sym | sed -e's/ .*$//g'`
#echo "brkaddr $brkaddr"
# Generate a unique GDB port
@@ -48,7 +49,7 @@ run () {
) > jos.in
sleep 1
- gdb -batch -nx -x jos.in > /dev/null
+ gdb -batch -nx -x jos.in > /dev/null 2>&1
t1=`date +%s.%N 2>/dev/null`
time=`echo "scale=1; ($t1-$t0)/1" | sed 's/.N/.0/g' | bc 2>/dev/null`
time="(${time}s)"
View
@@ -1,27 +1,16 @@
#!/bin/sh
-qemuopts="-hda obj/kern/kernel.img -hdb obj/fs/fs.img"
+qemuopts="-hda obj/kern/kernel.img -hdb obj/fs/fs.img -net user -net nic,model=i82559er"
. ./grade-functions.sh
+brkfn=cons_getc
$make
run
score=0
-# 20 points - run-icode
-pts=20
-runtest1 -tag 'updated file system switch [icode]' icode \
- 'icode: read /motd' \
- 'This is /motd, the message of the day.' \
- 'icode: spawn /init' \
- 'init: running' \
- 'init: data seems okay' \
- 'icode: exiting' \
- 'init: bss seems okay' \
- "init: args: 'init' 'initarg1' 'initarg2'" \
- 'init: running sh' \
-
+# 10 points - run-testpteshare
pts=10
runtest1 -tag 'PTE_SHARE [testpteshare]' testpteshare \
'fork handles PTE_SHARE right' \
@@ -34,25 +23,24 @@ runtest1 -tag 'fd sharing [testfdsharing]' testfdsharing \
'read in child succeeded' \
'write to file data page succeeded'
-# 10 points - run-testpipe
-pts=10
-runtest1 -tag 'pipe [testpipe]' testpipe \
- 'pipe read closed properly' \
- 'pipe write closed properly' \
-
-# 10 points - run-testpiperace
-pts=10
-runtest1 -tag 'pipe race [testpiperace]' testpiperace \
- ! 'child detected race' \
- ! 'RACE: pipe appears closed' \
- "race didn't happen" \
+# 20 points - run-icode
+pts=20
+runtest1 -tag 'updated file system switch [icode]' icode \
+ 'icode: read /motd' \
+ 'This is /motd, the message of the day.' \
+ 'icode: spawn /init' \
+ 'init: running' \
+ 'init: data seems okay' \
+ 'icode: exiting' \
+ 'init: bss seems okay' \
+ "init: args: 'init' 'initarg1' 'initarg2'" \
+ 'init: running sh' \
-# 10 points - run-testpiperace2
-pts=10
-runtest1 -tag 'pipe race 2 [testpiperace2]' testpiperace2 \
- ! 'RACE: pipe appears closed' \
- ! 'child detected race' \
- "race didn't happen" \
+# 20 points - run-testshell
+pts=20
+timeout=60
+runtest1 -tag 'shell [testshell]' testshell \
+ 'shell ran correctly' \
# 10 points - run-primespipe
pts=10
@@ -65,14 +53,8 @@ runtest1 -tag 'primespipe' primespipe \
! 30 31 ! 32 ! 33 ! 34 ! 35 ! 36 37 ! 38 ! 39 \
541 1009 1097
-# 20 points - run-testshell
-pts=20
-timeout=60
-runtest1 -tag 'shell [testshell]' testshell \
- 'shell ran correctly' \
-
-echo "Score: $score/100"
+echo "Score: $score/70"
-if [ $score -lt 100 ]; then
+if [ $score -lt 70 ]; then
exit 1
fi
View
@@ -183,8 +183,6 @@ dup(int oldfdnum, int newfdnum)
ova = fd2data(oldfd);
nva = fd2data(newfd);
- if ((r = sys_page_map(0, oldfd, 0, newfd, vpt[VPN(oldfd)] & PTE_USER)) < 0)
- goto err;
if (vpd[PDX(ova)]) {
for (i = 0; i < PTSIZE; i += PGSIZE) {
pte = vpt[VPN(ova + i)];
@@ -195,6 +193,8 @@ dup(int oldfdnum, int newfdnum)
}
}
}
+ if ((r = sys_page_map(0, oldfd, 0, newfd, vpt[VPN(oldfd)] & PTE_USER)) < 0)
+ goto err;
return newfdnum;
@@ -1,3 +1,4 @@
+#include <inc/x86.h>
#include <inc/lib.h>
char buf[512], buf2[512];
@@ -61,4 +62,6 @@ umain(void)
cprintf("write to file data page succeeded\n");
else
cprintf("write to file data page failed; got %s\n", buf);
+
+ breakpoint();
}
View
@@ -1,3 +1,4 @@
+#include <inc/x86.h>
#include <inc/lib.h>
#define VA ((char *) 0xA0000000)
@@ -32,6 +33,8 @@ umain(int argc, char **argv)
panic("spawn: %e", r);
wait(r);
cprintf("spawn handles PTE_SHARE %s\n", strcmp(VA, msg2) == 0 ? "right" : "wrong");
+
+ breakpoint();
}
void
View
@@ -1,3 +1,4 @@
+#include <inc/x86.h>
#include <inc/lib.h>
void wrong(int, int, int);
@@ -58,6 +59,8 @@ umain(void)
nloff = off+1;
}
cprintf("shell ran correctly\n");
+
+ breakpoint();
}
void

0 comments on commit 59ac8b7

Please sign in to comment.