blob: 4973ee2bd9ac34b84b0bd4a48c1c316ed44a068e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/bin/bash -
if [ "$1" = "-h" -o "$1" = "--help" ]; then
printf "Usage: $0 number_of_runs time_limit_in_seconds\n";
exit;
fi
PWD=`pwd`;
DIR=`basename $PWD`;
if [ "_$DIR" != "_userprog" ] ; then
printf "You must be in userprog directory\n";
exit;
fi
if expr $(uname -s) : 'Linux.*' > /dev/null; then
MAKE=make
else
MAKE=gmake
fi
$MAKE
$MAKE -C ../examples
TIMES=$(grep TIMES ../examples/pfs.h)
EXECS=$(grep -c '^.*exec.*pfs_reader.*$' ../examples/pfs.c)
declare -i COUNT=${1:-1}
TIMEOUT=${2:-180}
declare -i i=0;
while (( i < ${COUNT} )); do
\rm -f messages;
pintos -v -k --fs-disk=2 -T ${TIMEOUT} --qemu -p ../examples/pfs -a pfs -p ../examples/pfs_writer -a pfs_writer -p ../examples/pfs_reader -a pfs_reader -g messages -- -f -q run pfs
COOL=$(grep -c '^cool$' messages)
HOT=$(grep -v '^cool$' messages | grep -v -c '^\0*$')
grep -v '^cool$' messages
printf "\nSUMMARY ------------------------------------------------------\n"
printf "The 'messages' file have ${COOL} lines with the word 'cool'.\n"
printf "The 'messages' file have ${HOT} lines with other content.\n"
printf "pfs.c executes ${EXECS} 'pfs_reader' processes concurrently.\n"
printf "pfs.h contain: ${TIMES}\n"
printf "What should be in 'messages' when everything is correct?\n"
printf "%s\n" "--------------------------------------------------------------"
sleep 5
let ++i;
done
|