В моем коде есть функция test_it< /code>, который принимает $info: информацию для вывода, $type: тип теста, $files: список имен файлов, $options: аргументы, передаваемые на каждой итерации в "./prog", $optdesc: строка, описывающая параметры, и $precond: массив строк, описывающий предварительное условие для каждого файла в $files.
Код: Выделить всё
#!/bin/sh
test_it() {
info=$1
type=$2
files=$3
options=$4
optdesc=$5
precond=$6
for idx in ${!files[@]}
do
filename="log/$type/$filed-$optdesc.log"
if [[ ! -f $filename ]]; then
touch $filename
fi
if [[ "${options[@]}" = "" ]]
then
./prog $file -precondition "${precond[idx]}" > $filename
else
./prog $file "${options[@]}" -precondition "${precond[idx]}" > $filename
fi
done
}
Код: Выделить всё
## termination (CFG) with default setting:
## -domain boxes
## -joinbwd 2
type="termination"
info="info1"
files=("tests/termination/boolean.c"
"tests/termination/cacm2009a.c"
"tests/termination/cav2006.c"
"tests/termination/example1.c"
"tests/termination/example2a.c"
"tests/termination/tacas2013a.c" )
precond=("${files[@]/*/"true"}")
options=("-ctl-cfg" "AF{exit: true}")
optdesc="termCFG"
test_it "$info" $type $files $options $optdesc $precond
Код: Выделить всё
## conditional termination
type="termination"
info="info2"
files=( "tests/termination/example7.c"
"tests/termination/sas2014a.c"
"tests/termination/sas2014c.c"
"tests/termination/tap2008a.c"
"tests/termination/tap2008b.c"
"tests/termination/tap2008c.c"
"tests/termination/tap2008d.c"
"tests/termination/tap2008e.c"
"tests/termination/widening3.c")
precond=( "x > 6"
"r 30"
"x = 0 || x > 35 || x < -5"
"x < 30"
"x 6"
Код: Выделить всё
test_it "$info" $type $files "$options" $optdesc "$precond"
Я недостаточно знаю семантику bash, чтобы объяснить причину.
Подробнее здесь: https://stackoverflow.com/questions/783 ... executable