Skip to content

Commit dc12603

Browse files
authored
Merge pull request #6117 from tautschnig/sv-comp-scripting
Update SV-COMP performance testing tool to 2020/2021
2 parents 3ac959e + 6831ffe commit dc12603

File tree

6 files changed

+533
-346
lines changed

6 files changed

+533
-346
lines changed

scripts/perf-test/build.yaml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
---
2+
AWSTemplateFormatVersion: 2010-09-09
3+
4+
Parameters:
5+
Ami:
6+
Type: String
7+
8+
S3Bucket:
9+
Type: String
10+
11+
Subnet:
12+
Type: String
13+
14+
PerfTestId:
15+
Type: String
16+
17+
Repository:
18+
Type: String
19+
20+
CommitId:
21+
Type: String
22+
23+
UsePerf:
24+
Type: String
25+
26+
Resources:
27+
EC2Role:
28+
Type: "AWS::IAM::Role"
29+
Properties:
30+
AssumeRolePolicyDocument:
31+
Version: 2012-10-17
32+
Statement:
33+
Effect: Allow
34+
Principal:
35+
Service: ec2.amazonaws.com
36+
Action: "sts:AssumeRole"
37+
RoleName: !Sub "BR-${PerfTestId}"
38+
Policies:
39+
- PolicyName: !Sub "BP-${PerfTestId}"
40+
PolicyDocument:
41+
Version: 2012-10-17
42+
Statement:
43+
- Action:
44+
- "s3:PutObject"
45+
- "s3:GetObject"
46+
Effect: Allow
47+
Resource: !Join ["/", [!Sub "arn:aws:s3:::${S3Bucket}", "*"]]
48+
- Action:
49+
- "s3:ListBucket"
50+
Effect: Allow
51+
Resource: !Sub "arn:aws:s3:::${S3Bucket}"
52+
53+
EC2InstanceProfile:
54+
Type: "AWS::IAM::InstanceProfile"
55+
Properties:
56+
Roles:
57+
- !Ref EC2Role
58+
59+
ReleaseInstance:
60+
Type: "AWS::EC2::Instance"
61+
Properties:
62+
InstanceType: c5.2xlarge
63+
ImageId: !Ref Ami
64+
IamInstanceProfile: !Ref EC2InstanceProfile
65+
BlockDeviceMappings:
66+
- DeviceName: /dev/xvda
67+
Ebs:
68+
VolumeType: gp2
69+
VolumeSize: '30'
70+
DeleteOnTermination: 'true'
71+
SubnetId: !Ref Subnet
72+
UserData:
73+
Fn::Base64: !Sub |
74+
#!/bin/bash
75+
set -x -e
76+
77+
sed -i 's#/archive.ubuntu.com#/${AWS::Region}.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
78+
export DEBIAN_FRONTEND=noninteractive
79+
apt-get update
80+
apt-get install -y awscli
81+
82+
# AWS Sig-v4 access
83+
aws configure set s3.signature_version s3v4
84+
85+
aws s3 cp s3://${S3Bucket}/ec2-terminate.sh /etc/init.d/ec2-terminate
86+
sed -i '25,31d' /etc/init.d/ec2-terminate
87+
sed -i 's/#S3BUCKET#/${S3Bucket}/g' /etc/init.d/ec2-terminate
88+
sed -i 's/#PERFTESTID#/${PerfTestId}/g' /etc/init.d/ec2-terminate
89+
chmod a+x /etc/init.d/ec2-terminate
90+
update-rc.d ec2-terminate defaults
91+
systemctl start ec2-terminate
92+
93+
trap poweroff EXIT
94+
95+
apt-get install -y build-essential flex bison git curl ccache zip
96+
97+
cd /root/
98+
aws s3 cp s3://${S3Bucket}/release-build-cache/ccache.zip ccache.zip || true
99+
unzip ccache.zip || true
100+
rm -f ccache.zip
101+
ccache -z --max-size=1G
102+
git clone --depth 3 --branch ${CommitId} ${Repository} cbmc.git
103+
cd cbmc.git
104+
echo ${Repository} > COMMIT_INFO
105+
git rev-parse --short HEAD >> COMMIT_INFO
106+
git log HEAD^..HEAD >> COMMIT_INFO
107+
make -C src minisat2-download glucose-download cadical-download
108+
export CCACHE_NOHASHDIR=1
109+
make -C src CXX="ccache g++" -j8
110+
ccache -s
111+
112+
aws s3 cp src/cbmc/cbmc s3://${S3Bucket}/${PerfTestId}/release/cbmc
113+
aws s3 cp src/goto-cc/goto-cc s3://${S3Bucket}/${PerfTestId}/release/goto-cc
114+
aws s3 cp COMMIT_INFO s3://${S3Bucket}/${PerfTestId}/release/COMMIT_INFO
115+
cd /root/
116+
zip -r ccache.zip .ccache
117+
aws s3 cp ccache.zip s3://${S3Bucket}/release-build-cache/ccache.zip
118+
119+
ProfilingInstance:
120+
Type: "AWS::EC2::Instance"
121+
Properties:
122+
InstanceType: c5.2xlarge
123+
ImageId: !Ref Ami
124+
IamInstanceProfile: !Ref EC2InstanceProfile
125+
BlockDeviceMappings:
126+
- DeviceName: /dev/xvda
127+
Ebs:
128+
VolumeType: gp2
129+
VolumeSize: '30'
130+
DeleteOnTermination: 'true'
131+
SubnetId: !Ref Subnet
132+
UserData:
133+
Fn::Base64: !Sub |
134+
#!/bin/bash
135+
set -x -e
136+
137+
sed -i 's#/archive.ubuntu.com#/${AWS::Region}.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
138+
export DEBIAN_FRONTEND=noninteractive
139+
apt-get update
140+
apt-get install -y awscli
141+
142+
# AWS Sig-v4 access
143+
aws configure set s3.signature_version s3v4
144+
145+
aws s3 cp s3://${S3Bucket}/ec2-terminate.sh /etc/init.d/ec2-terminate
146+
sed -i '25,31d' /etc/init.d/ec2-terminate
147+
sed -i 's/#S3BUCKET#/${S3Bucket}/g' /etc/init.d/ec2-terminate
148+
sed -i 's/#PERFTESTID#/${PerfTestId}/g' /etc/init.d/ec2-terminate
149+
chmod a+x /etc/init.d/ec2-terminate
150+
update-rc.d ec2-terminate defaults
151+
systemctl start ec2-terminate
152+
153+
trap poweroff EXIT
154+
155+
apt-get install -y build-essential flex bison git curl ccache zip
156+
157+
cd /root/
158+
aws s3 cp s3://${S3Bucket}/profiling-build-cache/ccache.zip ccache.zip || true
159+
unzip ccache.zip || true
160+
rm -f ccache.zip
161+
ccache -z --max-size=1G
162+
git clone --depth 3 --branch ${CommitId} ${Repository} cbmc.git
163+
cd cbmc.git
164+
echo ${Repository} > COMMIT_INFO
165+
git rev-parse --short HEAD >> COMMIT_INFO
166+
git log HEAD^..HEAD >> COMMIT_INFO
167+
make -C src minisat2-download glucose-download cadical-download
168+
export CCACHE_NOHASHDIR=1
169+
if [ x${UsePerf} = xTrue ]
170+
then
171+
make -C src CXX="ccache g++" -j8 CXXFLAGS="-O2 -g -Wno-deprecated -fno-omit-frame-pointer"
172+
else
173+
make -C src CXX="ccache g++" -j8 CXXFLAGS="-O2 -pg -g -finline-limit=4 -Wno-deprecated" LINKFLAGS="-pg"
174+
fi
175+
ccache -s
176+
177+
aws s3 cp src/cbmc/cbmc s3://${S3Bucket}/${PerfTestId}/profiling/cbmc
178+
aws s3 cp src/goto-cc/goto-cc s3://${S3Bucket}/${PerfTestId}/profiling/goto-cc
179+
aws s3 cp COMMIT_INFO s3://${S3Bucket}/${PerfTestId}/profiling/COMMIT_INFO
180+
cd /root/
181+
df -h
182+
zip -r ccache.zip .ccache
183+
aws s3 cp ccache.zip s3://${S3Bucket}/profiling-build-cache/ccache.zip
184+
185+
Outputs:
186+
ReleaseInstanceId:
187+
Value: !Ref ReleaseInstance
188+
ProfilingInstanceId:
189+
Value: !Ref ProfilingInstance

scripts/perf-test/codebuild.yaml

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)