Skip to content

Commit b9e4c40

Browse files
committed
Enable -fsanitize=address for tests
1 parent b712016 commit b9e4c40

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
jobs:
10-
test:
10+
test-alpine:
1111
runs-on: ubuntu-latest
1212
container: alpine:3.21
1313
steps:
@@ -17,6 +17,20 @@ jobs:
1717
- name: Run tests
1818
run: meson setup test && ninja -C test test
1919

20+
test-archlinux:
21+
runs-on: ubuntu-latest
22+
container: archlinux:latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Install dependencies
26+
run: pacman -Syu --noconfirm && pacman -S --noconfirm base-devel meson wayland wayland-protocols gcc libinih cmocka
27+
- name: Run tests
28+
env:
29+
CFLAGS: "-fsanitize=address"
30+
CXXFLAGS: "-fsanitize=address"
31+
LDFLAGS: "-fsanitize=address"
32+
run: meson setup test && ninja -C test test
33+
2034
analyze:
2135
runs-on: ubuntu-latest
2236
container: alpine:3.21

meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ if cmocka.found()
108108
test('color', executable(
109109
'color_test',
110110
['test/color_test.c', 'src/color.c'],
111-
dependencies: [cmocka]
111+
dependencies: [cmocka],
112112
))
113113

114114
test('readline', executable(
115-
'readline_test',
116-
['test/readline_test.c', 'src/readline.c'],
117-
dependencies: [cmocka]
115+
'readline_test',
116+
['test/readline_test.c', 'src/readline.c'],
117+
dependencies: [cmocka],
118118
))
119119
endif
120120

src/readline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ wob_readline(char *input, unsigned long *out_value, char *out_style)
4343
GOTO(S1);
4444
}
4545
if (*c == '\0') {
46-
GOTO(S3);
46+
GOTO(S4);
4747
}
4848
if (*c == ' ') {
4949
GOTO(S2);

0 commit comments

Comments
 (0)