Skip to content

Commit e46f5cc

Browse files
committed
fix(ci): close unused file descriptors before running valgrind
1 parent dd2f0e5 commit e46f5cc

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,22 @@ jobs:
388388
- name: Valgrind checks for memory leaks
389389
shell: bash
390390
run: |
391-
valgrind --leak-check=full --show-leak-kinds=all \
392-
--track-origins=yes --track-fds=yes \
393-
--trace-children=yes \
391+
# hack to close fd 155 and 158 as github leaves them open
392+
# thread: https://github.com/actions/runner-images/issues/3729
393+
# solution from: https://github.com/actions/runner-images/issues/3391#issuecomment-842139475
394+
if [ -d /proc/$$/fd/ ]; then
395+
for descriptor_path in /proc/$$/fd/*; do
396+
descriptor="$(basename "$descriptor_path")"
397+
# Don't close stdin/stderr/stdout (-gt 2)
398+
if [ $descriptor -gt 2 ]; then
399+
exec {descriptor}<&-
400+
fi
401+
done
402+
fi
403+
valgrind --leak-check=full \
404+
--show-leak-kinds=all --show-reachable=yes \
405+
--track-origins=yes --track-fds=yes --trace-children=yes \
394406
--verbose -s \
407+
--demangle=yes \
395408
--error-exitcode=1 \
396409
build/arkscript tests/unittests/resources/LangSuite/unittests.ark -L ./lib valgrind

tests/unittests/resources/LangSuite/unittests.ark

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
macro-tests:macro-output
1616
list-tests:list-output
1717
string-tests:string-output
18-
async-tests:async-output ]))
18+
async-tests:async-output
19+
]))
1920
(let success_count (list:sum (@ outputs 0)))
2021
(let failure_count (list:sum (@ outputs 1)))
2122

0 commit comments

Comments
 (0)