diff options
Diffstat (limited to 'src/utils/pintos-pfs-test')
| -rwxr-xr-x | src/utils/pintos-pfs-test | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/utils/pintos-pfs-test b/src/utils/pintos-pfs-test new file mode 100755 index 0000000..4973ee2 --- /dev/null +++ b/src/utils/pintos-pfs-test @@ -0,0 +1,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 |
