Skip to content

Commit a47941d

Browse files
committed
perf-test: add -W/--witness-check to validate SV-COMP witness checking
1 parent 5b0395f commit a47941d

File tree

3 files changed

+72
-6
lines changed

3 files changed

+72
-6
lines changed

scripts/perf-test/ebs.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Resources:
3636
https://github.com/sosy-lab/cpachecker.git
3737
git clone --depth 1 \
3838
https://github.com/diffblue/cprover-sv-comp.git
39+
git clone --depth 1 \
40+
https://github.com/tautschnig/fshell-w2t.git
3941
halt
4042
4143
BaseVolume:

scripts/perf-test/ec2.yaml

+62-4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Parameters:
3838
SSHKeyName:
3939
Type: String
4040

41+
WitnessCheck:
42+
Type: String
43+
4144
Conditions:
4245
UseSpot: !Not [!Equals [!Ref MaxPrice, ""]]
4346

@@ -153,6 +156,7 @@ Resources:
153156
apt-get install -y git time wget binutils awscli make jq
154157
apt-get install -y zip unzip
155158
apt-get install -y gcc libc6-dev-i386
159+
apt-get install -y ant python3-tempita python
156160

157161
# cgroup set up for benchexec
158162
chmod o+wt '/sys/fs/cgroup/cpuset/'
@@ -223,6 +227,27 @@ Resources:
223227
mkdir -p tmp
224228
export TMPDIR=/mnt/tmp
225229

230+
if [ x${WitnessCheck} = xTrue ]
231+
then
232+
cd cpachecker
233+
ant
234+
235+
cd ../run
236+
for def in \
237+
cpa-seq-validate-correctness-witnesses \
238+
cpa-seq-validate-violation-witnesses \
239+
fshell-witness2test-validate-violation-witnesses
240+
do
241+
wget -O $def.xml https://raw.githubusercontent.com/sosy-lab/sv-comp/master/benchmark-defs/$def.xml
242+
sed -i 's#[\./]*/results-verified/LOGDIR/sv-comp18.\${!inputfile_name}.files/witness.graphml#witnesses/sv-comp18.${!inputfile_name}-witness.graphml#' $def.xml
243+
done
244+
245+
ln -s ../cpachecker/scripts/cpa.sh cpa.sh
246+
ln -s ../cpachecker/config/ config
247+
248+
cp ../fshell-w2t/* .
249+
fi
250+
226251
# reduce the likelihood of multiple hosts processing the
227252
# same message (in addition to SQS's message hiding)
228253
sleep $(expr $RANDOM % 30)
@@ -334,11 +359,26 @@ Resources:
334359
tar czf witnesses.tar.gz cbmc.*.logfiles
335360
rm -rf cbmc.*.logfiles
336361
cd ..
362+
363+
if [ x${WitnessCheck} = xTrue ]
364+
then
365+
for wc in *-witnesses.xml
366+
do
367+
wcp=$(echo $wc | sed 's/-witnesses.xml$//')
368+
mkdir witnesses
369+
tar -C witnesses --strip-components=1 -xzf \
370+
logs-$t/witnesses.tar.gz
371+
../benchexec/bin/benchexec --no-container \
372+
$wc --task $t -T 90s -M 15GB \
373+
-o $wcp-logs-$t/ -N $max_par -c 1
374+
rm -rf witnesses
375+
done
376+
fi
337377
fi
338-
if [ -f logs-$t/*.xml.bz2 ]
339-
then
340-
start_date="$(echo ${PerfTestId} | cut -f1-3 -d-) $(echo ${PerfTestId} | cut -f4-6 -d- | sed 's/-/:/g')"
341-
cd logs-$t
378+
start_date="$(echo ${PerfTestId} | cut -f1-3 -d-) $(echo ${PerfTestId} | cut -f4-6 -d- | sed 's/-/:/g')"
379+
for l in *logs-$t/*.xml.bz2
380+
do
381+
cd $(dirname $l)
342382
bunzip2 *.xml.bz2
343383
perl -p -i -e \
344384
"s/^(<result.*version=\"[^\"]*)/\$1:${PerfTestId}/" *.xml
@@ -348,10 +388,28 @@ Resources:
348388
"s/^(<result.*date=)\"[^\"]*/\$1\"$start_date/" *.xml
349389
bzip2 *.xml
350390
cd ..
391+
done
392+
393+
if [ x${WitnessCheck} = xTrue ]
394+
then
395+
../benchexec/bin/table-generator \
396+
logs-$t/*xml.bz2 *-logs-$t/*.xml.bz2 -o logs-$t/
397+
else
398+
../benchexec/bin/table-generator \
399+
logs-$t/*xml.bz2 -o logs-$t/
351400
fi
352401
aws s3 cp logs-$t \
353402
s3://${S3Bucket}/${PerfTestId}/$cfg/logs-$t/ \
354403
--recursive
404+
for wc in *-witnesses.xml
405+
do
406+
[ -s $wc ] || break
407+
wcp=$(echo $wc | sed 's/-witnesses.xml$//')
408+
rm -rf $wcp-logs-$t/*.logfiles
409+
aws s3 cp $wcp-logs-$t \
410+
s3://${S3Bucket}/${PerfTestId}/$cfg/$wcp-logs-$t/ \
411+
--recursive
412+
done
355413
else
356414
rm -f gmon.sum gmon.out *.gmon.out.*
357415
../benchexec/bin/benchexec cbmc.xml --no-container \

scripts/perf-test/perf_test.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def parse_args():
7070
parser.add_argument('-B', '--code-build', type=str,
7171
default=same_dir('codebuild.yaml'),
7272
help='Non-default CodeBuild template to use')
73+
parser.add_argument('-W', '--witness-check', action='store_true',
74+
help='Run witness checks after benchmarking')
7375

7476
args = parser.parse_args()
7577

@@ -504,7 +506,7 @@ def seed_queue(session, region, queue, task_set):
504506
def run_perf_test(
505507
session, mode, region, az, ami, instance_type, sqs_arn, sqs_url,
506508
parallel, snapshot_id, instance_terminated_arn, bucket_name,
507-
perf_test_id, price, ssh_key_name):
509+
perf_test_id, price, ssh_key_name, witness_check):
508510
# create an EC2 instance and trigger benchmarking
509511
logger = logging.getLogger('perf_test')
510512

@@ -572,6 +574,10 @@ def run_perf_test(
572574
{
573575
'ParameterKey': 'SSHKeyName',
574576
'ParameterValue': ssh_key_name
577+
},
578+
{
579+
'ParameterKey': 'WitnessCheck',
580+
'ParameterValue': str(witness_check)
575581
}
576582
],
577583
Capabilities=['CAPABILITY_NAMED_IAM'])
@@ -668,7 +674,7 @@ def main():
668674
session, args.mode, region, az, ami, args.instance_type,
669675
sqs_arn, sqs_url, args.parallel, snapshot_id,
670676
instance_terminated_arn, bucket_name, perf_test_id, price,
671-
args.ssh_key_name)
677+
args.ssh_key_name, args.witness_check)
672678

673679
return 0
674680

0 commit comments

Comments
 (0)