-
Notifications
You must be signed in to change notification settings - Fork 202
184 lines (177 loc) · 7.23 KB
/
build-and-test.yaml
File metadata and controls
184 lines (177 loc) · 7.23 KB
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
# SPDX-FileCopyrightText: 2016-2026 BlueALSA developers
# SPDX-License-Identifier: MIT
name: Build and Test
on:
push:
pull_request:
branches: [ master ]
env:
MAKEFLAGS: -j8
SANITIZE_MEMORY_LIBS: ${{ github.workspace }}/sanitize-memory-libs
SANITIZE_THREAD_LIBS: ${{ github.workspace }}/sanitize-thread-libs
jobs:
check:
strategy:
matrix:
features:
- --enable-debug
- --enable-debug --enable-aac --enable-msbc --enable-lc3-swb
- --enable-debug --enable-mp3lame --enable-mpg123 --enable-upower
- --enable-faststream --enable-midi --enable-mp3lame
- --enable-aplay --with-libsamplerate --enable-ofono --enable-opus
- --disable-aplay --enable-asha --enable-rfcomm --enable-manpages
- --disable-ctl --enable-aptx --enable-aptx-hd --with-libopenaptx
fail-fast: false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Create Build Environment
run: |
mkdir -p ${{ github.workspace }}/{build,m4}
autoreconf --install
- name: Configure GNU Automake
working-directory: ${{ github.workspace }}/build
run: |
${{ github.workspace }}/configure \
${{ matrix.features }} \
--enable-test
- name: Build
working-directory: ${{ github.workspace }}/build
run: make check CFLAGS="-Wall -Wextra -Werror -Wshadow" TESTS=
- name: Run Tests
working-directory: ${{ github.workspace }}/build/test
run: make check-TESTS
- name: Upload Tests Log
uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: ${{ github.job }} (${{ matrix.features }}) logs
path: ${{ github.workspace }}/build/test/*.log
sanitize-prepare:
runs-on: ubuntu-22.04
steps:
- uses: actions/cache@v5
id: cache
with:
key: sanitize-env
path: |
${{ env.SANITIZE_MEMORY_LIBS }}
${{ env.SANITIZE_THREAD_LIBS }}
- name: Create Build Environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt install --yes --quiet --no-install-recommends autoconf-archive meson
mkdir -p ${{ env.SANITIZE_MEMORY_LIBS }}
mkdir -p ${{ env.SANITIZE_THREAD_LIBS }}
- name: Compile Patched GCC Thread Sanitizer Library
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone --depth=1 --branch=releases/gcc-11.3.0 https://github.com/gcc-mirror/gcc.git
# GCC (and Clang) skips interception in case when the call is made while the
# thread is waiting on a blocking system call. In most cases this is a case
# when the call is made from a signal handler. However, BlueALSA uses thread
# cancellation to stop the thread, which operates in a similar way. Therefore,
# we need to patch the thread sanitizer library to not skip the interception.
sed -i 's/|| thr->ignore_interceptors//' gcc/libsanitizer/tsan/tsan_interceptors.h
mkdir libstdc++-v3 && cd $_ && ../gcc/libstdc++-v3/configure --disable-multilib && make && cd -
mkdir libsanitizer && cd $_ && ../gcc/libsanitizer/configure --disable-multilib && make && cd -
mv libsanitizer/tsan/.libs/libtsan.so* ${{ env.SANITIZE_THREAD_LIBS }}
- name: Compile dbus-1
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone --depth=1 --branch=dbus-1.12.20 https://gitlab.freedesktop.org/dbus/dbus.git
cd dbus && autoreconf -i && ./configure --prefix=/usr && cd -
# Build dbus-1 with preserved frame pointers
make -C dbus clean && make -C dbus CFLAGS="-g -O2 -fno-omit-frame-pointer"
mv dbus/dbus/.libs/libdbus-1.so* ${{ env.SANITIZE_MEMORY_LIBS }}
# Build dbus-1 with thread sanitizer
make -C dbus clean && make -C dbus CFLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=thread"
mv dbus/dbus/.libs/libdbus-1.so* ${{ env.SANITIZE_THREAD_LIBS }}
- name: Compile glib-2.0
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone --depth=1 --branch=2.72.4 https://github.com/GNOME/glib.git
# Build glib with preserved frame pointers
CFLAGS="-g -O2 -fno-omit-frame-pointer" meson glib/build-memory glib
DESTDIR=../build-image ninja -C glib/build-memory install
mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* ${{ env.SANITIZE_MEMORY_LIBS }}
# Build glib with thread sanitizer
CFLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=thread" meson glib/build-thread glib
DESTDIR=../build-image ninja -C glib/build-thread install
mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* ${{ env.SANITIZE_THREAD_LIBS }}
sanitize:
strategy:
matrix:
sanitize:
- address alignment bool bounds nonnull-attribute shift undefined
- thread
fail-fast: false
needs: sanitize-prepare
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Create Build Environment
run: |
mkdir -p ${{ github.workspace }}/{build,m4}
autoreconf --install
- name: Configure GNU Automake
working-directory: ${{ github.workspace }}/build
run: |
${{ github.workspace }}/configure \
--enable-aac \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx \
--enable-asha \
--enable-faststream \
--enable-lc3-swb \
--enable-midi \
--enable-mp3lame \
--enable-mpg123 \
--enable-msbc \
--enable-ofono \
--enable-opus \
--enable-upower \
--enable-aplay \
--with-libsamplerate \
--enable-ctl \
--enable-test
- name: Build
working-directory: ${{ github.workspace }}/build
run: |
make clean
SANITIZERS=$(for x in ${{ matrix.sanitize }}; do echo -n " -fsanitize=$x"; done)
make check CFLAGS="-g -O2 $SANITIZERS -fno-omit-frame-pointer -fno-sanitize-recover=all" TESTS=
- uses: actions/cache/restore@v4
with:
key: sanitize-env
path: |
${{ env.SANITIZE_MEMORY_LIBS }}
${{ env.SANITIZE_THREAD_LIBS }}
- name: Run Tests
working-directory: ${{ github.workspace }}/build/test
env:
CK_TIMEOUT_MULTIPLIER: 5
ASAN_OPTIONS: detect_stack_use_after_return=1
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/sanitize-lsan.supp
TSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/sanitize-tsan.supp
run: |
case "${{ matrix.sanitize }}" in
*address*)
export LD_LIBRARY_PATH="${{ env.SANITIZE_MEMORY_LIBS }}:$LD_LIBRARY_PATH"
export LD_PRELOAD_SANITIZER="libasan.so.6" ;;
*thread*)
export LD_LIBRARY_PATH="${{ env.SANITIZE_THREAD_LIBS }}:$LD_LIBRARY_PATH"
export LD_PRELOAD_SANITIZER="libtsan.so.0" ;;
esac
make check-TESTS
- name: Upload Tests Log
uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: ${{ github.job }} (${{ matrix.sanitize }}) logs
path: ${{ github.workspace }}/build/test/*.log