Created
May 11, 2017 20:23
-
-
Save rnbguy/87e16789cd7b30532577aef4dc8d9add to your computer and use it in GitHub Desktop.
run cbmc on benchmarks are generate outputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
eval set -- $(getopt -o f:u:t:m:b:d: -l flags:,unwind:,timelimit:,memorylimit:benchmarkpath:dumpdir: -- "$@") | |
unwind=5 | |
flags="" | |
timelimit=900 | |
memorylimit=15000000 | |
dump_dir="dump_directory" | |
while true; do | |
case $1 in | |
-f|--flags) | |
flags=$2 | |
shift 2 | |
;; | |
-u|--unwind) | |
unwind=$2 | |
shift 2 | |
;; | |
-t|--timelimit) | |
timelimit=$2 | |
shift 2 | |
;; | |
-m|--memorylimit) | |
memorylimit=$2 | |
shift 2 | |
;; | |
-b|--benchmarkpath) | |
benchmark_dirpath=$2 | |
shift 2 | |
;; | |
-d|--dumpdir) | |
dump_dir=$2 | |
shift 2 | |
;; | |
--) | |
shift | |
break | |
;; | |
*) | |
echo "no valid argument" | |
exit 1 | |
;; | |
esac | |
done | |
CBMCROOT="/home/students/ranadeep/thesis/cbmc" | |
CBMCROOT=${CBMCROOT%/} | |
GOTOCC="${CBMCROOT}/src/goto-cc/goto-cc" | |
GOTOINSTR="${CBMCROOT}/src/goto-instrument/goto-instrument" | |
CBMCEXEC="${CBMCROOT}/src/cbmc/cbmc" | |
benchmark_dirpath=${benchmark_dirpath%/} | |
echo "dumping outputs in -- ${dump_dir}" | |
function run_case() { | |
cfile_path=$1 | |
dump_dir_path=$2 | |
timelimit=$3 | |
memorylimit=$4 | |
( | |
ulimit -v ${memorylimit} | |
/usr/bin/time \ | |
-f "--unwind ${unwind} ${flags}, elapsed %e(s), max memory %M(kB), timelimit ${timelimit}(s), memorylimit ${memorylimit}(kB)\n" \ | |
-o ${dump_dir_path}/resources.txt -a \ | |
timeout -k 1000 ${timelimit} \ | |
${CBMCEXEC} --unwind ${unwind} ${flags} ${cfile_path} 1> ${dump_dir_path}/stdout.txt 2> ${dump_dir_path}/stderr.txt | |
) | |
} | |
for e_path in `ls ${benchmark_dirpath}/*.c`; do | |
name=$(basename ${e_path}) | |
name=${name%.*} | |
mkdir -p ${dump_dir}/${name} | |
run_case ${e_path} ${dump_dir}/${name} ${timelimit} ${memorylimit} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment