-
Notifications
You must be signed in to change notification settings - Fork 56
161 lines (140 loc) · 6.04 KB
/
linux.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
---
name: Linux CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build64:
name: Ubuntu 64-bit
strategy:
fail-fast: false
matrix:
include:
# Linux with GCC
- {os: ubuntu-20.04, llvm: '6.0', compiler: gcc}
- {os: ubuntu-20.04, llvm: 7, compiler: gcc}
- {os: ubuntu-20.04, llvm: 8, compiler: gcc}
- {os: ubuntu-20.04, llvm: 9, compiler: gcc}
- {os: ubuntu-20.04, llvm: 10, compiler: gcc}
- {os: ubuntu-20.04, llvm: 10, compiler: gcc, type: Debug}
# FIXME: Edit when KLEE is rebased to latest upstream.
- {os: ubuntu-20.04, llvm: 11, compiler: gcc, klee: 'no-klee'}
- {os: ubuntu-20.04, llvm: 12, compiler: gcc, klee: 'no-klee'}
- {os: ubuntu-22.04, llvm: 13, compiler: gcc, klee: 'no-klee'}
# Linux with Clang
- {os: ubuntu-20.04, llvm: '6.0', compiler: clang}
- {os: ubuntu-20.04, llvm: 7, compiler: clang}
- {os: ubuntu-20.04, llvm: 8, compiler: clang}
- {os: ubuntu-20.04, llvm: 9, compiler: clang}
- {os: ubuntu-20.04, llvm: 10, compiler: clang}
- {os: ubuntu-20.04, llvm: 10, compiler: clang, type: Debug}
# FIXME: Edit when KLEE is rebased to latest upstream.
- {os: ubuntu-20.04, llvm: 11, compiler: clang, klee: 'no-klee'}
- {os: ubuntu-20.04, llvm: 12, compiler: clang, klee: 'no-klee'}
- {os: ubuntu-22.04, llvm: 13, compiler: clang, klee: 'no-klee'}
runs-on: ${{matrix.os}}
steps:
- name: Checkout Symbiotic and submodules
uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt update
sudo apt install ccache cmake clang-${{matrix.llvm}} \
llvm-${{matrix.llvm}}-dev gcc-multilib \
libz3-dev
- name: Set environment
id: env
run: |
# Set buildtype
if [[ "${{matrix.type}}" != "" ]]; then
echo "BUILD_TYPE=${{matrix.type}}" >> $GITHUB_ENV
else
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV
fi
# Build with sanitizers
CFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
CXXFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined"
# TODO: Fail on UBSAN
# CFLAGS="-fno-sanitize-recover=all $CFLAGS"
# CXXFLAGS="-fno-sanitize-recover=all $CXXFLAGS"
# Select compiler and set compiler flags
if [[ "${{matrix.compiler}}" = "clang" ]]; then
# Clang
CC="clang-${{matrix.llvm}}"
CXX="clang++-${{matrix.llvm}}"
# Use shared libasan otherwise LLVMsbt.so would be underlinked.
CFLAGS="-shared-libasan $CFLAGS"
CXXFLAGS="-shared-libasan $CXXFLAGS"
# Dynamic compiler-rt libraries are not in /usr/lib
tmp="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)"
LD_LIBRARY_PATH="$(dirname "$tmp")"
# Force coloured output
CFLAGS="-fcolor-diagnostics $CFLAGS"
CXXFLAGS="-fcolor-diagnostics $CXXFLAGS"
else
# GCC
CC="gcc"
CXX="g++"
# Force coloured output
CFLAGS="-fdiagnostics-color $CFLAGS"
CXXFLAGS="-fdiagnostics-color $CXXFLAGS"
fi
# Save the environment
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
# Set up ccache
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH
# Store the environment
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV
echo "timestamp=$(date -u -Iseconds)" >> $GITHUB_OUTPUT
- name: Set up ccache
uses: actions/cache@v3
with:
path: .ccache
key: ${{matrix.os}}-${{matrix.llvm}}-${{matrix.compiler}}-${{matrix.type}}-${{steps.env.outputs.timestamp}}
restore-keys: ${{matrix.os}}-${{matrix.llvm}}-${{matrix.compiler}}-${{matrix.type}}
- name: Build Symbiotic
run: |
./system-build.sh -j$(nproc) \
build-type=${BUILD_TYPE} ${{matrix.klee}} \
llvm-config=$(which llvm-config-${{matrix.llvm}})
- name: Run tests
# FIXME: Remove when KLEE is rebased to latest upstream.
if: matrix.llvm < 11
run: |
if [[ "${{matrix.compiler}}" = "clang" ]]; then
# libclang_rt.asan-x86_64.so must be loaded as the first library
# See https://systemd.io/TESTING_WITH_SANITIZERS for details.
export LD_PRELOAD="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)"
else
export LD_PRELOAD="$(gcc -print-file-name=libasan.so)"
fi
# Make symbiotic use correct clang & friends from PATH (e.g. no
# disguised ccache or problems with unversioned tools not being
# in PATH).
#
# Also, clang's ASAN and UBSAN expect unversioned llvm-symbolizer
# in PATH.
export PATH="$(llvm-config-${{matrix.llvm}} --bindir):$PATH"
# Due to LD_PRELOAD above, leak sanitizer was reporting leaks
# literally in everything that was executed, e.g. make, shell,
# python and other tools that are not under our control.
ASAN_OPTIONS=detect_leaks=0 make -C tests
- name: ccache statistics
run: ccache -s