Commit 04394ec
chore(ci): run crashtracking ffi example tests in CI (#1687)
# What does this PR do?
Previously, we couldn't run crashtracking FFI examples in CI because the C example had paths like /tmp/libdatadog/bin/libdatadog-crashtracking-receiver and /tmp/crashreports/ baked in, which is variable in CI. Also, the test runner had no way to handle intentional crashes.
This PR
1. Enables the crashtracking FFI example to run in CI instead of being skipped
2. Adds ExpectedCrash support to the FFI test runner to validate tests that intentionally crash
`examples/ffi/crashtracking.c`
- Make receiver binary and output directory configurable via DDOG_CRASHT_TEST_RECEIVER and DDOG_CRASHT_TEST_OUTPUT_DIR env vars (falls back to hardcoded defaults for manual use)
- Forward LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to the receiver process so it can find shared libraries
- Remove the custom signal(SIGSEGV, ...) handler
- I also ran the clang formatter here
`tools/src/bin/ffi_test.rs`
- Remove crashtracking from the skip list
- Add ExpectedCrash concept: validates the process dies with the expected signal (SIGSEGV) and that a crash report file was produced
- Extract shared find_receiver_paths() and library_search_path_env() helpers used by both crashtracking and crashtracking_unhandled_exception tests
# Motivation
Although FFI examples are not meant to increase test coverage, running the crashtracking example in CI is a QOL improvement that makes sure our public FFI surface is buildable and usable in real-world scenarios.
# How to test the change?
crashtracking FFI tests [now run in CI](https://github.com/DataDog/libdatadog/actions/runs/22782590070/job/66091853014?pr=1687)
<img width="290" height="215" alt="Screenshot 2026-03-06 at 4 46 48 PM" src="https://github.com/user-attachments/assets/2dbc51a1-723c-4d5b-ad19-76699abedb2c" />
Co-authored-by: gregory.leocadie <gregory.leocadie@datadoghq.com>1 parent f8900a6 commit 04394ec
2 files changed
Lines changed: 174 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 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 | + | |
40 | 75 | | |
41 | 76 | | |
42 | 77 | | |
43 | 78 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
51 | 83 | | |
52 | 84 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 85 | + | |
58 | 86 | | |
59 | 87 | | |
60 | | - | |
61 | 88 | | |
62 | 89 | | |
63 | 90 | | |
| |||
79 | 106 | | |
80 | 107 | | |
81 | 108 | | |
82 | | - | |
83 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
84 | 113 | | |
85 | 114 | | |
86 | 115 | | |
| |||
91 | 120 | | |
92 | 121 | | |
93 | 122 | | |
94 | | - | |
95 | | - | |
| 123 | + | |
| 124 | + | |
96 | 125 | | |
97 | 126 | | |
98 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
130 | 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 | + | |
131 | 191 | | |
132 | 192 | | |
133 | 193 | | |
134 | | - | |
| 194 | + | |
135 | 195 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
142 | 200 | | |
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 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
170 | 214 | | |
171 | 215 | | |
172 | 216 | | |
173 | 217 | | |
174 | 218 | | |
175 | | - | |
| 219 | + | |
176 | 220 | | |
177 | 221 | | |
178 | 222 | | |
| |||
428 | 472 | | |
429 | 473 | | |
430 | 474 | | |
| 475 | + | |
| 476 | + | |
431 | 477 | | |
432 | 478 | | |
433 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
434 | 515 | | |
435 | 516 | | |
436 | 517 | | |
| |||
451 | 532 | | |
452 | 533 | | |
453 | 534 | | |
454 | | - | |
| 535 | + | |
| 536 | + | |
455 | 537 | | |
456 | 538 | | |
457 | 539 | | |
| |||
467 | 549 | | |
468 | 550 | | |
469 | 551 | | |
470 | | - | |
| 552 | + | |
471 | 553 | | |
472 | 554 | | |
473 | 555 | | |
| |||
0 commit comments