-
Notifications
You must be signed in to change notification settings - Fork 140
276 lines (229 loc) · 8.4 KB
/
simulator.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
name: "Simulator"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
platform: [Win32, x64]
exclude:
- os: ubuntu-latest
platform: Win32
- os: macos-12
platform: Win32
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install tools on MacOS
if: matrix.os == 'macos-12'
run: brew install boost ninja
- name: Install tools on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install ninja-build libboost-dev g++-11
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV
- name: Install Python dependencies
run: pip3 install -r requirements.txt
- name: Install tools on Windows
if: matrix.os == 'windows-latest'
run: |
mkdir boost
curl --progress-bar --location --output boost\download.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download
7z -oboost x boost\download.tar.bz2 -y -bd
7z -oboost x boost\download.tar -y -bd
cd boost
move boost_*\* .
del download.*
- name: Create CMake dir
run: mkdir build
- name: Build with Visual Studio
working-directory: build
if: matrix.os == 'windows-latest'
run: |
cmake ../simulator -DENABLE_IPO=1 -DBOOST_ROOT="${{github.workspace}}\boost" -DPYTHON3_COMMAND=python -A ${{ matrix.platform }}
cmake --build . --config Release --target mipt-mips cachesim unit-tests
move Release\*.exe .
- name: Build on POSIX
if: matrix.os != 'windows-latest'
working-directory: build
run: |
cmake ../simulator -G Ninja -DENABLE_IPO=1
ninja mipt-mips mipt-v cachesim unit-tests
- name: Unit tests
working-directory: build
run: ./unit-tests
- name: Integration
working-directory: build
run: |
./mipt-mips -b ../tests/mips/mips-fib.bin -n 5000000 --mars
./cachesim -t ../tests/mem_trace.json -s 32768 -w 32
profile:
name: Profile
runs-on: ubuntu-latest
needs: [test]
env:
CC: gcc-11
CXX: g++-11
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install Ninja and Boost
run: sudo apt-get install ninja-build libboost-dev g++-11
- name: Create CMake dir
run: mkdir build
- name: Build simulator
working-directory: build
run: |
cmake ../simulator -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_IPO=1 -DENABLE_PROFILE=1
ninja mipt-mips
- name: Run
working-directory: build
run: ./mipt-mips -b ../tests/mips/mips-fib.bin -n 5000000 --mars
- name: Dump profile
working-directory: build
run: gprof ./mipt-mips gmon.out -p | head -
analyze:
name: Analyze
runs-on: ubuntu-latest
needs: [test]
strategy:
matrix:
config:
- name: gcc
cc: gcc-11
cxx: g++-11
gcov: gcov-11
- name: llvm
cc: clang-14
cxx: clang++-14
gcov: "llvm-cov-14 gcov"
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'cpp'
- name: Install LLVM 14
if: matrix.config.name == 'llvm'
run: |
sudo wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'
sudo apt update -y
sudo apt-get install clang++-14 clang-tidy-14 llvm-14
- name: Install packages
run: sudo apt-get install ninja-build libboost-dev g++-11
- name: Create CMake dir
run: mkdir build
- name: Build simulator
working-directory: build
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
cmake ../simulator -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=1 -DENABLE_ASAN=1 -DENABLE_UBSAN=1
ninja unit-tests
- name: Run
working-directory: build
run: ./unit-tests
- name: Codecov
run: bash <(curl -s https://codecov.io/bash) -x "${{ matrix.config.gcov }}" -X gcovout
- name: Clang-Tidy
if: matrix.config.name == 'llvm'
working-directory: build
continue-on-error: true
run: run-clang-tidy-14.py -header-filter='.*' 2> /dev/null
- name: Perform CodeQL Analysis
if: matrix.config.name == 'gcc'
uses: github/codeql-action/analyze@v1
gdb:
name: GDB Integration
runs-on: ubuntu-latest
needs: [test]
env:
CC: gcc-11
CXX: g++-11
GDB_VER: gdb-10.2
GDB_DIR: ${{ github.workspace }}/$GDB_VER
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install packages
run: sudo apt-get install ninja-build libboost-dev g++-11
- name: Create CMake dir
run: mkdir build gdb_build
- name: Download GDB
run: |
wget http://ftp.gnu.org/gnu/gdb/$GDB_VER.tar.gz
tar -xzf $GDB_VER.tar.gz
- name: Prepare GDB
env:
GDB_BUILD: ${{ github.workspace }}/gdb_build
run: |
cd $GDB_BUILD && ${{ github.workspace }}/$GDB_VER/configure --target=mipsel-unknown-linux --with-system-zlib --with-python=no
cd $GDB_BUILD && make configure-gdb CFLAGS='-w -O0' CXXFLAGS='-w -O0' MAKEINFO=true > /dev/null
cd $GDB_BUILD && mkdir opcodes && cd opcodes && ${{ github.workspace }}/$GDB_VER/opcodes/configure --target=mipsel-unknown-linux && make libopcodes.a
cd $GDB_BUILD && mkdir libdecnumber && cd libdecnumber && ${{ github.workspace }}/$GDB_VER/libdecnumber/configure && make libdecnumber.a
cd $GDB_BUILD && mkdir readline && cd readline && ${{ github.workspace }}/$GDB_VER/readline/configure && cd readline && make libreadline.a
cd $GDB_BUILD && mkdir libctf && cd libctf && ${{ github.workspace }}/$GDB_VER/libctf/configure --with-system-zlib && make ctf-error.h && make libctf.la
# w/a for GDB 10.1, remove once updated ^~~~~~~~~~~~~~~^
- name: Build simulator
working-directory: build
run: |
cmake ../simulator -G Ninja -DGDB_SOURCE_PATH=../$GDB_VER -DGDB_BUILD_PATH=../gdb_build
ninja gdb-mips-sim
- name: Build GDB
working-directory: gdb_build/gdb
run: make gdb CFLAGS='-w -O0' CXXFLAGS='-w -O0' MAKEINFO=true > /dev/null
- name: Run GDB
working-directory: gdb_build/gdb
run: ./gdb -x $GITHUB_WORKSPACE/tests/test.gdb --args $GITHUB_WORKSPACE/tests/mips/mips-tt.bin
cobertura:
name: CoberturaCoverage
# needs: [test]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install tools
run: |
choco install opencppcoverage codecov
pip3 install -r requirements.txt
- name: Install tools on Windows
run: |
mkdir boost
curl --progress-bar --location --output boost\download.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download
7z -oboost x boost\download.tar.bz2 -y -bd
7z -oboost x boost\download.tar -y -bd
cd boost
move boost_*\* .
del download.*
- name: Create CMake dir
run: mkdir build
- name: Build with Visual Studio
working-directory: build
run: |
cmake ../simulator -DENABLE_IPO=1 -DBOOST_ROOT="${{github.workspace}}\boost" -DPYTHON3_COMMAND=python
cmake --build . --config Debug --target unit-tests
- name: Unit tests
shell: cmd
run: call "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe" --export_type cobertura:coverage.xml --modules "unit-tests.exe" --excluded_line_regex "\s*\}.*" --sources "simulator\*" -- .\build\Debug\unit-tests.exe
- name: Codecov
run: codecov -f coverage.xml --root .